How do I use DrawFrameControl in a CDIalog?

  • Thread starter Thread starter RD Holland
  • Start date Start date
R

RD Holland

Guest
I want to call DrawFrameControl( rect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP ) to draw a resizable gripper. I have a VS created MFC application (visual studio style) and I took the CAboutDlg that was created by the MFC app wizard. I have implemented OnPaint and set the dialog property so it is resizable. When I run, the dialog is resizable and this code paints the frame control:

void CAboutDlg::OnPaint()
{
CPaintDC dc(this);
CRect rect;
// rect of size grip
GetClientRect(&rect);
rect.left = rect.right - ::GetSystemMetrics(SM_CXHSCROLL);
rect.top = rect.bottom - ::GetSystemMetrics(SM_CYVSCROLL);

dc.DrawFrameControl(rect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
GdiFlush();
}

Very simple (that code minus GdiFlush I found on the MSDN as a sample with the API MSDN page).

But, when I resize the dialog, the display isn't drawing a backgroup over the frame control graphics. So if I size somewhat slowly I get "zingers" spread across the bottom or right edge of the dialog. The area where I am drawing doesn't repaint the background. At least that is what I think is the issue. If I grab the frame and resize, say to make it wider, and do so with quick jerks, the control draws fine but leaves the sequence of draws unerased (thus the "zingers"). Also, if after resizing and seeing the issue, I can simply grab the caption area and move the dialog down off the screen and back up and the display is fine again (just like the initial draw).

I have played with a myriad of dialog setting using the dialog editor in Visual Studio (clip children/siblings/overlapped vs. popup) but have found nothing that fixes the issue.

I have run this on Win10 and Win7 with the same issue.

Anyone have a suggestion as to what to try.




R.D. Holland

Continue reading...
 
Back
Top