【求助】怎样实现在分割条上画图或加载图标?急!!!

55015182 2005-12-21 12:36:45
我继承CSplitterWnd类,创建了切分视图,想在分割条上加一图标以实现点击该图标来隐藏或显示切分视图,怎么实现,跪求解决方法!!!
...全文
106 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
55015182 2005-12-21
  • 打赏
  • 举报
回复
呵呵,刚才就是重载了OnPaint而没有写东西,OnPaint覆盖了OnDrawSplitter,所以没有显示。
还有就是m_cxBorderShare (按下鼠标时splitter拖动条的偏移量)要设成0才可以正常显示。
CSplitterWnd没有Ondraw这个虚函数,OnDrawSplitter应该就相当于OnDraw吧。
wangjs720 2005-12-21
  • 打赏
  • 举报
回复
还还是重写OnPaint,在OnPaint中画吧
55015182 2005-12-21
  • 打赏
  • 举报
回复
我写了这个函数,怎么我画的时候没有显示呢?
void CMySplitter::OnDrawSplitter(CDC* pDC, ESplitType nType, const CRect& rectArg)

CBitmap bt;
bt.LoadBitmap(IDB_TRIANGLE1);
BITMAP bitmap;
bt.GetBitmap(&bitmap);
CBrush bh(&bt);
CRect rt;
rt = rectArg;
//GetClientRect(&rt);
if (pDC == NULL)
{
RedrawWindow(rectArg, NULL, RDW_INVALIDATE|RDW_NOCHILDREN);
return;
}
if( nType == splitBar )
{
pDC->FillRect(rt,&bh);
}
bt.Detach();
CSplitterWnd::OnDrawSplitter(pDC,nType,rectArg);
A_Qiao 2005-12-21
  • 打赏
  • 举报
回复
派生一个子类,重载下面这个函数,想画什么,全在你呀

CSplitterWnd::OnDrawSplitter
virtual void OnDrawSplitter( CDC* pDC, ESplitType nType, const CRect& rect );

Parameters

pDC

A pointer to the device context in which to draw. If pDC is NULL, then CWnd::RedrawWindow is called by the framework and no split window is drawn.

nType

A value of the enum ESplitType, which can be one of the following:

splitBox The splitter drag box.


splitBar The bar that appears between the two split windows.


splitIntersection The intersection of the split windows. This element will not be called when running on Windows 95.


splitBorder The split window borders.
rect

A reference to a CRect object specifying the size and shape of the split windows.

Remarks

This member function is called by the framework to draw and specify the exact characteristics of a splitter window.

Override OnDrawSplitter for advanced customization of the imagery for the various graphical components of a splitter window. The default imagery is similar to the splitter in Microsoft Works for Windows or Microsoft Windows 95, in that the intersections of the splitter bars are blended together.

For more on dynamic splitter windows, see "Splitter Windows" in the articleMultiple Document Types, Views, and Frame Windows in Visual C++ Programmer’s Guide, Technical Note 29, and the CSplitterWnd class overview.

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧