Using CDC FrameRgn
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Using CDC FrameRgn

Hybrid View

  1. #1
    Join Date
    Mar 2001
    Location
    Colorado
    Posts
    241

    Using CDC FrameRgn

    I have a modeless dialog that I have changed the shape into a roundrect using SetWindowRgn(). I would like to draw a colored border around it using FrameRgn. Here is the code I am using:

    BOOL CMyDlg::OnInitDialog()
    {
    CDialog::OnInitDialog();

    m_Brush.CreateSolidBrush(RGB(255,255,255));

    CRect rcDialog;
    GetClientRect(rcDialog);

    // This Creates area assigned to Dialog: This goes directly below the above in OnInitDialog
    m_rgnShape.CreateRoundRectRgn(rcDialog.TopLeft().x, rcDialog.TopLeft().y, rcDialog.BottomRight().x,
    rcDialog.BottomRight().y, rcDialog.Width()/8, rcDialog.Height()/8);

    ::SetWindowRgn(GetSafeHwnd(), (HRGN)m_rgnShape, TRUE);

    return TRUE; // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
    }

    void CMyDlg::OnPaint()
    {
    CPaintDC dc(this); // device context for painting

    CBrush brush;
    brush.CreateSolidBrush(RGB(255,0,0));

    dc.FrameRgn(&m_rgnShape, &brush, 2, 2);
    }




    Can anyone explain why the FrameRgn is not working, and maybe provide some sample code that will make it work.

    Thanks in advance,

    Wade

  2. #2
    Join Date
    Apr 2013
    Posts
    4

    Re: Using CDC FrameRgn

    Hi,

    I am facing the same issue to as you.Could anyone please answer if having same experience and got
    resolved.

    Thanks,

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center