Home > Software engineering >  MFC draw a blank area next to the ToolBar?
MFC draw a blank area next to the ToolBar?

Time:10-10

RT:
Are using MFC to do a interface, for a long time useless, rusty,
Made 24 bit color TOOLBAR, the problem is not big, but empty area next to also want to make beautiful view, temporarily couldn't find where to draw,
Which friend give a hint, thank you!

CodePudding user response:

CodePudding user response:

Want to look good, got in the derived class onpaint picture, MFC not well function layout, I now use duilib

CodePudding user response:

Well, it is derived from the MainFrame: : OnPaint, but drawing seems useless, drew a box in this area, but is covered, don't know is which function, drawing of this area,

CodePudding user response:

Toolbar has docking state, create can specify a background color:
//
HBRUSH gets=CreateSolidBrush (RGB (0255255));
SetClassLong ( m_wndToolBar m_hWnd, GCL_HBRBACKGROUND, (long) gets);
//
M_wndToolBar. EnableDocking (CBRS_ALIGN_TOP);

CodePudding user response:

You can drag the other without any action under the control of to see

CodePudding user response:

1 class CMyToolBar: public CToolBar
2. The void CMyToolBar: : OnWindowPosChanged (WINDOWPOS FAR * lpwndpos)
{
CToolBar: : OnWindowPosChanged (lpwndpos);
if(! IsFloating ())
{
CPoint pt=0;
Pt. X=2;
Pt. Y=2;
CMainFrame * pMain=(CMainFrame *) AfxGetMainWnd ();
If (pMain)
{//get frame wid
CRect frmRC;
PMain - & gt; GetClientRect (frmRC);
//get the toolbar hei
CRect rc;
GetWindowRect (rc);
MoveWindow (pt. X, pt. J y, frmRC. The Width (), rc, Height ());
}
}
}
3.
HBRUSH gets=CreateSolidBrush (RGB (0255255));
SetClassLong (m_wndToolBar m_hWnd, GCL_HBRBACKGROUND, (long) gets);
4 CMyToolBar m_wndToolBar;

CodePudding user response:

  • Related