int CDlg_GroupBlockList::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: 在此添加您专用的创建代码
// 创建列表控件
m_DrawGroup.Create(NULL, WS_CHILD | WS_VISIBLE | SS_OWNERDRAW, CRect(40, 0, 100, 100), this, IDC_STATIC_DrawGroup);
m_VScroll.Create(SBS_VERT | WS_CHILD | WS_VISIBLE, CRect(0, 0, 20, 100), this, IDC_SCROLLBAR_VScroll);
m_HScroll.Create(SBS_HORZ | WS_CHILD | WS_VISIBLE, CRect(0, 0, 100, 20), this, IDC_SCROLLBAR_HScroll);
// 创建工具栏作为窗格的子控件
bool is = m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_LEFT | CBRS_GRIPPER |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0, 0, 0,0), IDR_TOOLBAR_GROUPBLOCK);
m_wndToolBar.LoadToolBar(IDR_TOOLBAR_GROUPBLOCK);
DockPane(&m_wndToolBar, CRect(0, 0, 0, 0), DM_SHOW);
// 创建工具栏作为窗格的子控件
bool isSel = m_wndToolBarSel.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_RIGHT | CBRS_GRIPPER |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(0, 0, 0, 0), IDR_TOOLBAR_SelOperation);
m_wndToolBarSel.LoadToolBar(IDR_TOOLBAR_SelOperation);
DockPane(&m_wndToolBarSel, CRect(1000, 0, 0, 0), DM_SHOW);
return 0;
}
void CDlg_GroupBlockList::OnSize(UINT nType, int cx, int cy)
{
CDockablePane::OnSize(nType, cx, cy);
if (GetSafeHwnd() == NULL) {
return;
}
CRect rcDialog;
GetClientRect(&rcDialog);
CRect SelBarRect, rectSelWindow;
m_wndToolBarSel.GetClientRect(SelBarRect);
m_wndToolBarSel.GetWindowRect(rectSelWindow);
rcDialog.right -= rectSelWindow.Width();
CRect rectDraw = rcDialog;
CRect BarRect, rectWindow;
m_wndToolBar.GetClientRect(BarRect);
m_wndToolBar.GetWindowRect(rectWindow);
rectDraw.left += rectWindow.Width();
CRect ViewSize;
CWnd* pControl = GetDlgItem(IDC_STATIC_DrawGroup);
if (m_DrawGroup.GetSafeHwnd()) {
m_DrawGroup.SetWindowPos(NULL, rectDraw.left, rectDraw.top, rectDraw.Width(), rectDraw.Height(),
SWP_NOZORDER | SWP_NOACTIVATE);
}
m_wndToolBar.SetWindowPos(NULL, BarRect.left, BarRect.top, rectWindow.Width(), rectDraw.Height(), SWP_NOZORDER);
// 立即更新工具栏状态
m_wndToolBar.Invalidate();
m_wndToolBar.UpdateWindow();
m_wndToolBarSel.SetWindowPos(NULL, rectDraw.right, SelBarRect.top, rectSelWindow.Width(), rectDraw.Height(), SWP_NOZORDER);
// 立即更新工具栏状态
m_wndToolBarSel.Invalidate();
m_wndToolBarSel.UpdateWindow();
为啥工具栏按钮没有显示我设置的提示
最新发布