CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    15

    How to draw only within the area of a shaped custom control?

    Hello!

    I have an owner-drawn (derived from CButton) control in my dialog box. In it's PreSubclassWindow function, I set it a new region (elliptic region) using SetWindowRgn. And here's the problem: although the control looks elliptic in the dialog box (I checked it with Spy++), when I do a simple draw like this:

    dc.FillSolidRect(&myRect, RGB(0, 0, 0));
    (from within "CSpecialButton::OnPaint" or something alike)

    the entire rectangle gets painted in black; not only the elliptic shape!! The same happens with other draw functions.

    If you have any idea what might be wrong, please post me a response or E-Mail: [email protected]

    Thanx! Ziv


  2. #2
    Join Date
    May 1999
    Location
    Oregon, USA
    Posts
    302

    Re: How to draw only within the area of a shaped custom control?

    Have you tried CDC::FillRgn ?
    Its arguments are a CRgn pointer and CBrush pointer.

    Another possibility is to call SelectClipRgn.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured