是否就是说你的主VIEW的WM_PAINT多响应了一次?
用breakpoint看看
用breakpoint看看
解决方案 »
- vc++ ,基于mfc的对话框的摄像头采集的视频显示程序 能发给我吗 381541766 QQ邮箱
- 下载邮件附件,用wireshark抓包,如何提取其中的附件?
- 调用了addnew()函数怎么会把第一条记录覆盖了呢?
- MFC 树控件
- (对话框) 子类关闭(点右上角的叉) 一定会调用到父类的onClose函数吗?
- CListCtrl的大图标风格编程基础?
- 如果我想用一个类似CArray的动态增长的容器来保存从文件读进来的字符串,不用MFC,不用STL,如何实现,谢谢
- 如何在视图类中得到工具栏对象?
- 如何编程实现更改文件图标?
- 如何设计调用摄像头并可以拍照的界面,提供思路流程也可以
- 如何知道用户按了最小化按钮?
- 鼠标单击和双击的判断
{
CMozartDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc); // DocObjects don't require any drawing
}void CMFCBindView::OnInitialUpdate()
{
CView::OnInitialUpdate(); if(m_pSelection)
return; CMFCBindCntrItem* pItem = NULL;
TRY
{
// Create new item connected to this document.
pItem = new CMFCBindCntrItem(GetDocument());
ASSERT_VALID(pItem);
CLSID clsid;
if(FAILED(::CLSIDFromProgID(OLESTR("Excel.sheet"),&clsid))){
delete pItem;
AfxThrowMemoryException();
}
// Create the Excel embedded item.
if(!pItem->CreateNewItem(clsid)){
//Any exception will do. We just need to break out of the
//TRY statement.
if(pItem)
delete pItem;
AfxMessageBox("创建 COM 失败,可能是内存不足.");
}
ASSERT_VALID(pItem); // make sure we deactivate any active items first.
COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
if (pActiveItem != NULL)
pActiveItem->Deactivate(); // If item created from class list (not from file) then launch
// the server to edit the item.
pItem->Activate(OLEIVERB_SHOW, this);
ASSERT_VALID(pItem); // As an arbitrary user interface design, this sets the selection
// to the last item inserted. // TODO: reimplement selection as appropriate for your application // set selection to last inserted item
m_pSelection = pItem; }
CATCH(CException , e)
{
if (pItem != NULL)
{
ASSERT_VALID(pItem);
pItem->Delete();
GetDocument()->RemoveItem(pItem);
}
//e->Delete();
AfxMessageBox("Failed.");
}
END_CATCH
}
以上是生成 COleClientItem* m_pSelection的过程
CMFCBindCntrItem inherited from COleClientItem
{
//return CSplitterWnd::OnEraseBkgnd(pDC); CRect rectClient;
GetClientRect(rectClient);
rectClient.InflateRect(-m_cxBorder, -m_cyBorder);
rectClient.bottom = rectClient.top + m_upBorder;
pDC->FillSolidRect(rectClient, GetSysColor(COLOR_3DFACE));
return true;
}void CGfxSplitterWnd::OnPaint()
{
CSplitterWnd::OnPaint();
if (bWhiteLine)
{
CClientDC dc(this);
CRect rectClient;
GetClientRect(rectClient); //the Top Line
CPen pn(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
CPen * op = dc.SelectObject(&pn);
dc.MoveTo(rectClient.left, rectClient.top);
dc.LineTo(rectClient.right, rectClient.top);
CPen pn1(PS_SOLID, 1, GetSysColor(COLOR_3DHILIGHT));
dc.SelectObject(&pn1);
dc.MoveTo(rectClient.left, rectClient.top+1);
dc.LineTo(rectClient.right, rectClient.top+1);
// the Bottom line
//dc.SelectObject(GetStockObject(BLACK_PEN) );
//dc.MoveTo(rectClient.left, rectClient.bottom-1);
//dc.LineTo(rectClient.right, rectClient.bottom-1); dc.SelectObject(op);
}
}
void CGfxSplitterWnd::OnDrawSplitter(CDC* pDC, ESplitType nType, const CRect& rectArg)
{
//CSplitterWnd::OnDrawSplitter(pDC,nType,rectArg);
if (pDC == NULL)
{
RedrawWindow(rectArg, NULL, RDW_INVALIDATE|RDW_NOCHILDREN);
return;
}
ASSERT_VALID(pDC);
CRect rect = rectArg;
switch (nType)
{
case splitBorder:
return;
case splitBox:
pDC->Draw3dRect(rect, GetSysColor(COLOR_3DFACE), GetSysColor(COLOR_WINDOWFRAME));
rect.InflateRect(-CX_BORDER, -CY_BORDER);
pDC->Draw3dRect(rect, GetSysColor(COLOR_BTNHIGHLIGHT), GetSysColor(COLOR_BTNSHADOW));
rect.InflateRect(-CX_BORDER, -CY_BORDER);
break;
} COLORREF clr = GetSysColor(COLOR_3DFACE);
pDC->FillSolidRect(rect, clr);
}
以上是 CSplitterWnd 的部分重载函数
能把工程发过来吗?(因为在网吧,save money) :p