Наши проекты:
Журнал · Discuz!ML · Wiki · DRKB · Помощь проекту |
||
ПРАВИЛА | FAQ | Помощь | Поиск | Участники | Календарь | Избранное | RSS |
[3.135.198.49] |
|
Сообщ.
#1
,
|
|
|
Как тулбар в диалоговое приложение воткнуть???
Не получается что-то. Ресурс toolbar создаю, а как его в окно приложения вставить ????? |
Сообщ.
#2
,
|
|
|
Извини, я тебе точного линка не дам, с Инетом напряг, но на в разделе C++ (на сорсах.ру, само собой) в подразделе "Диалоги" есть подробное описание.
|
Сообщ.
#3
,
|
|
|
Ставим батону стиль BS_BITMAP (или заходим в свойства батона -> Стили -> Bitmap).
А потом посылаем мессагу BM_SETIMAGE! BM_SETIMAGE An application sends a BM_SETIMAGE message to associate a new image (icon or bitmap) with the button. To send this message, call the SendMessage <messques_8ht1.htm> function with the following parameters. SendMessage( (HWND) hWnd, // handle to destination window BM_SETIMAGE, // message to send (WPARAM) wParam; // image type (LPARAM) lParam; // handle to the image (HANDLE) ); Parameters wParam Specifies the type of image to associate with the button. This parameter can be one of the following values: IMAGE_BITMAP IMAGE_ICON lParam Handle to the image to associate with the button. Return Values The return value is a handle to the image previously associated with the button, if any; otherwise, it is NULL. Requirements Windows NT/2000: Requires Windows NT 4.0 or later. Windows 95/98: Requires Windows 95 or later. Header: Declared in Winuser.h; include Windows.h. |
Сообщ.
#4
,
|
|
|
m_MainToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE |
CBRS_ALIGN_TOP | CBRS_BORDER_3D | CBRS_BORDER_BOTTOM | CBRS_BORDER_TOP, CRect(2,2,0,2)); m_MainToolBar.LoadToolBar(IDR_MAINTOOLBAR); CRect rcClientStart; CRect rcClientNow; GetClientRect(rcClientStart); RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, rcClientNow); CPoint ptOffset(rcClientNow.left - rcClientStart.left, rcClientNow.top - rcClientStart.top); CRect rcChild; CWnd* pwndChild = GetWindow(GW_CHILD); while (pwndChild) { pwndChild->GetWindowRect(rcChild); ScreenToClient(rcChild); rcChild.OffsetRect(ptOffset); pwndChild->MoveWindow(rcChild, FALSE); pwndChild = pwndChild->GetNextWindow(); } CRect rcWindow; GetWindowRect(rcWindow); rcWindow.right += rcClientStart.Width() - rcClientNow.Width(); rcWindow.bottom += rcClientStart.Height() - rcClientNow.Height(); MoveWindow(rcWindow, FALSE); RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0); |
Сообщ.
#5
,
|
|
|
P.S. Описано в MSDN.
Искать нужно по ключу "RepositionBars". Есть раздел "DLGCBR32: Demonstrates Adding a Status Bar and Toolbar to Dialog Boxes", и демо проект. |