На главную Наши проекты:
Журнал   ·   Discuz!ML   ·   Wiki   ·   DRKB   ·   Помощь проекту
ПРАВИЛА FAQ Помощь Участники Календарь Избранное RSS
msm.ru
! Правила раздела Visual C++ / MFC / WTL (далее Раздела)
1) На Раздел распространяются все Правила Форума.
2) Перед тем, как создать новый топик, убедитесь, что Вы читали Правила создания тем в Разделе.
3) Вопросы, не связанные с программированием (настройки MS Visual Studio, книги, библиотеки и т.д.),
обсуждаются в разделе C/C++: Прочее
4) Вопросы разработки .NET (Windows Form, C++/CLI и т.п.) приложений на Visual C++/C# обсуждаются в разделе .NET.
5) Нарушение Правил может повлечь наказание со стороны модераторов.

Полезные ссылки:
user posted image FAQ Раздела user posted image Обновления для FAQ Раздела user posted image Поиск по Разделу user posted image MSDN Library Online
Модераторы: ElcnU
  
> Как тулбар в диалоговое приложение воткнуть???
    Как тулбар в диалоговое приложение воткнуть???
    Не получается что-то.  Ресурс toolbar  
    создаю, а как его в окно приложения вставить ?????
      Извини, я тебе точного линка не дам, с Инетом напряг, но на в разделе C++ (на сорсах.ру, само собой) в подразделе "Диалоги" есть подробное описание.
        Ставим батону стиль 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.
          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);
            P.S. Описано в MSDN.
            Искать нужно по ключу "RepositionBars".
            Есть раздел "DLGCBR32: Demonstrates Adding a Status Bar and Toolbar to Dialog Boxes", и демо проект.


            0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
            0 пользователей:


            Рейтинг@Mail.ru
            [ Script execution time: 0,0382 ]   [ 16 queries used ]   [ Generated: 27.04.24, 17:46 GMT ]