CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2003
    Location
    Azerbaijan
    Posts
    74

    SetWindowRgn for a button

    Is it true that SetWindowRgn is not applicapable for buttons and also another controls of window?

    It's just because I cannot set a region for the button on my dialog window in OnInitDialog, This is the code:

    Code:
        CWnd *pBtn = GetDlgItem( IDC_BUTTON1 );
        CRect rc;
        pBtn->GetWindowRect( &rc );
        HRGN hRgn = CreateEllipticRgn( 0, 0, rc.Width(), rc.Height() );
        pBtn->SetWindowRgn( hRgn, TRUE );
    For the top level window (that is for dialog window) this code works well, but for a button - nothing changes.

  2. #2
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917
    ModifyStyle(0, WS_CLIPCHILDREN | WS_CLIPSIBLINGS , SWP_FRAMECHANGED);
    But do not expect the end of your trouble. Button drawing is complex; it draws itself with three colors, not to mention default button frame.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

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