1、创建一个基于对话框的MFC工程,名字设为“Example51”。 2、在自动生成的对话框模板IDD_EXAMPLE51_DIALOG中,删除“TODO: Place dialog controls here.”静态文本框,添加一个按钮控件和一个Picture控件,ID分别设为IDC_COLOR_SEL_BUTTON和IDC_COLOR_SHOW_STATIC,按钮控
在【LineCutView.cpp】的OnDraw(CDC* pDC)函数中绘制矩形 //初始化时绘制矩形CClientDCdc(this);//获取画布CPenpen(PS_SOLID,3,RGB(0,0,225));//获取画笔dc.SelectObject(&pen);//将画笔移动到画布上dc.Rectangle(wxl,wyt,wxr,wyb);//在画布上绘制矩形 1. 2. 3. 4. 5. 6. 添加完这三部分代码,...
pBrush=dc->SelectObject(&cbrush); //载入笔刷 dc->Rectangle(&rect); //绘制矩形 dc->SelectObject(pBrush); //恢复笔刷 cbrush.DeleteObject(); pBrush->DeleteObject(); } (3)找到CBrushDemoDlg::OnDrow()函数,修改这个函数的内容: void CBrushDemoDlg::OnPaint() { CPaintDC dc(this); //背景填充...
CBrush brush2(HS_DIAGCROSS, RGB(0,255,255));//DIAGCROSS网格填充、CROSS方格填充、BDIAGONAL左斜45°填充、FDIAGONAL右斜45°、HORIAONTAL水平、VERTICAL竖直dc.SelectObject(&brush2); dc.Rectangle(350,40,450,140);//pen画笔}
dc->Rectangle(&rect); //绘制矩形 dc->SelectObject(pBrush); //恢复笔刷 cbrush.DeleteObject(); pBrush->DeleteObject(); } (3)找到CBrushDemoDlg::OnDrow()函数,修改这个函数的内容: void CBrushDemoDlg::OnPaint() { CPaintDC dc(this);
[in] A rectangle that specifies the region to update, in screen coordinates. Remarks This method is useful when pop-up menus are displayed over animated controls or other windows that have dynamic content. CMFCPopupMenu::UpdateShadow Updates the shadow for the pop-up menu. C++ Copy void Up...
CMFCToolBar::GetItemRect Returns the bounding rectangle of the button at a specified index. CMFCToolBar::GetLargeColdImages Returns a pointer to the collection of large cold toolbar button images in the application. CMFCToolBar::GetLargeDisabledImages Returns a pointer to the collection of larg...
RECT rc = {50,50,200,200}; Rectangle(pDC->GetSafeHdc(), rc.left, rc.top, rc.right, rc.bottom);// The Win32 call to FillRect requires an HBRUSH.// The HBRUSH operator casts the CBrush object// to the required type.CBrush brush; brush.CreateSysColorBrush(COLOR_BTNFACE); FillRect...
A pointer to CRect object that receives the coordinates of the image bounding rectangle. Remarks The CRect object to which lpRect points is set to 0 if a button at the specified index does not exist. Example The following example demonstrates how to use the GetItemRect method of the CMFCTool...
CMFCPreviewCtrlImpl::SetHostSets a new parent for this control. CMFCPreviewCtrlImpl::SetPreviewVisualsCalled by a Rich Preview handler when it needs to set visuals of rich preview content. CMFCPreviewCtrlImpl::SetRectSets a new bounding rectangle for this control. ...