Home > Software engineering >  C after the picture control areas with double buffering, click on the button can't pop-up dialo
C after the picture control areas with double buffering, click on the button can't pop-up dialo

Time:10-19

My c + + after picture control areas with double buffering, click on the button can't pop-up dialog box, and the main dialog
no reaction

This is just the operation interface, after not written child dialog button can realize


This is click on the "circular" button, which is a cascade of a child dialog button interface, the main dialog don't respond, can't move also can't shut down


But was later found in the resource manager to close the main dialog, or click on the keyboard Alt child dialogs will pop up after the

This is my code



//If you add a minimize button to your dialog, you will need the code below
//to draw the icon. The For MFC applications using the document/view model,
//this is automatically done for you by the framework.

Void CMyShapeDlg: : OnPaint ()
{
If (IsIconic ())
{
CPaintDC dc (this);//device context for painting

SendMessage (WM_ICONERASEBKGND, (WPARAM) dc. GetSafeHdc (), 0).

//Center icon in the client rectangle
Int cxIcon=GetSystemMetrics (SM_CXICON);
Int cyIcon=GetSystemMetrics (SM_CYICON);
CRect the rect.
GetClientRect (& amp; The rect);
Int x=(the rect. Width () - cxIcon + 1)/2;
Int y=(the rect. Height () - cyIcon + 1)/2;

//Draw the icon
Dc. DrawIcon (x, y, m_hIcon);
}
The else
{
//CDialog: : OnPaint ();

CRect the rect.
The CDC * pDC=GetDlgItem (IDC_PICTURE) - & gt; GetDC ();
GetDlgItem (IDC_PICTURE) - & gt; GetClientRect (& amp; The rect);
CPen pen (PS_SOLID, 1, RGB (0, 255));

//use double buffering
The CDC dcMem.//memory DC
CBitmap bmpMem;//bitmap
DcMem. CreateCompatibleDC (pDC);//create a compatible DC

DcMem. SelectObject (pen);
BmpMem. CreateCompatibleBitmap (pDC, the rect. Right - the rect. Left, the rect. The bottom - the rect. Top);//create and picture area (empty) the size of the bitmap
//the bitmap choose the device context environment
CBitmap * pOld=dcMem. SelectObject (& amp; BmpMem);
DcMem. FillSolidRect (the rect, pDC - & gt; GetBkColor ());

//built-in round
CRect rect1=new CRect,0,80,80 (0);
DcMem. The Ellipse (rect1);

//built-in rectangular
CRect rect2=new CRect,50,210,100 (110);
DcMem. A Rectangle (rect2);

//built-in triangle
CPoint point [3]={CPoint (250200), CPoint (300150), CPoint (350200)};
DcMem. Polygon (point, 3);


//built-in elliptical
CRect rect3=new CRect,0,510,60 (410);
DcMem. The Ellipse (rect3);

//built-in trapezoidal
DcMem. MoveTo (25150);
DcMem. LineTo (75150);
DcMem. MoveTo (25150);
DcMem. LineTo (0200);
DcMem. MoveTo (75150);
DcMem. LineTo (100200);
DcMem. MoveTo (0200);
DcMem. LineTo (100200);

//click on the button to draw round
for(int i=0; i{
DcMem. The Ellipse (cx [I] - (40), (cy [I] - 40), cx [I] + (40), (cy + 40 [I]));
}

//memory copying the proforma equipment dc
PDC - & gt; BitBlt (0, 0, the rect. Right - the rect. Left, the rect. The bottom - the rect. Top, & amp; DcMem, 0, 0, SRCCOPY);
PDC - & gt; SelectObject (pOld);
BmpMem. DeleteObject ();
DcMem. DeleteDC ();


}
}

//The system calls this to obtain The cursor to display while The user drags
//the minimized window.
HCURSOR CMyShapeDlg: : OnQueryDragIcon ()
{
Return (HCURSOR) m_hIcon;
}

Void CMyShapeDlg: : OnCircle ()
{
//TODO: Add your the control notification handler code here
CDlgAddCircle DLG.
DLG. DoModal ();
The UpdateData (false);
}




CodePudding user response:

This is a question of MFC, you go to the section ask, here is more c + + language
  • Related