• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            醬壇子

            專注C++技術 在這里寫下自己的學習心得 感悟 和大家討論 共同進步(歡迎批評!!!)

              C++博客 :: 首頁 :: 聯系 :: 聚合  :: 管理
              66 Posts :: 16 Stories :: 236 Comments :: 0 Trackbacks

            公告

            王一偉 湖南商學院畢業 電子信息工程專業

            常用鏈接

            留言簿(19)

            我參與的團隊

            搜索

            •  

            積分與排名

            • 積分 - 387045
            • 排名 - 64

            最新隨筆

            最新評論

            閱讀排行榜

            評論排行榜

            1) Right click Solution Explorer -> Add -> Resource -> Tool Bar -> New. This will open into Tool Bar Editor.

            2)You can Create/Paint Buttons here. Make sure you change the default Ids of these buttons to some proper usable ids. (Use Property Explorer for this), this will create a .bmp image in resources. (Lets say, The Tool Bar is ‘TDR_TOOLBAR1’ and the two buttons are ‘IDC_TBUTTON1’ and ‘IDC_TBUTTON2’ )

            3)Now go to the .h for dialog(You can add a class to a dialog) on which toolbar need to be placed. Declare a ‘CToolBar’ Object

            CToolBar m_FirstToolBar
            

            4)Now on the .cpp file of the dialog, in ‘OnInitDialog()’ add following code;(You Can add OnInitDialog event to the directly by declaring it in .h file added and using it in .cpp file)

            if(!m_FirstToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_FirstToolBar.LoadToolBar(IDR_TOOLBAR1))
            {
               EndDialog(IDCANCEL);
            }
            
            RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,0);
             
            

            4.1. Here you can see the various attributes set for the toolbar in ‘CreateEx(...)’ like ‘TBSTYLE_FLAT’ for flat look of toolbar buttons;

            4.2 In ‘LoadToolBar(...)’ the Resource created for the toolbar is used. This maps our toolbar object ‘m_FirstToolBar’ with resource ‘IDR_TOOLBAR1’

            4.3 ‘RepositionBars()’ is used to place the toolbar on the dialog.

            5) ‘MoveWindow()’ can be used to place the toolbar on the desired position.

            m_FirstToolBar.MoveWindow( 50, 0,100, 100, 1 );
            

            Now if you have finalized the place where you want to place the tool bar you can put it there using MoveWindow(...), my suggestion is to put a label in the design of dialog at place you want to put you toolbar; Then at run time get the position of this label and place the toolbar there using MoveWindow(...)

            If you want to place this toolbar on Top Left and dynamically move all the controls accordingly and increase the dialog dimensions refer the article on this site I suggested above.

            6)This is how the buttons of Tool Bar can be made visible/invisible

            m_FirstToolBar.GetToolBarCtrl().HideButton(IDC_TBUTTON1, TRUE);
            

            Notice that we have used the ‘IDC_TBUTTON1’ which we declared at the time of creating toolbar resource.

            7) Similarly

            m_FirstToolBar.GetToolBarCtrl().EnableButton(IDC_TBUTTON1,false)
            

            can be used to disable a button.

            8) To handle Click events: 8.1 Add following line to BEGIN_MESSAGE_MAP()

            ON_COMMAND(IDC_TBUTTON1,OnToolBarButton1) 
            

            8.2 Write the desired code in .cpp file

            FirstToolBarDialog:: OnToolBarButton1()
            
            {
            
            - - - 
            
                  - - - 
            
            }
            
            ?
            posted on 2006-10-22 13:45 @王一偉 閱讀(1652) 評論(0)  編輯 收藏 引用 所屬分類: 1. MFC
            久久精品免费全国观看国产| 日韩精品久久无码人妻中文字幕 | 欧美日韩中文字幕久久伊人| 久久99国产精品二区不卡| 狠狠久久综合伊人不卡| 91麻豆国产精品91久久久| 99久久99久久精品免费看蜜桃| 久久97久久97精品免视看秋霞| 久久精品无码一区二区WWW| 精品一区二区久久久久久久网站| 午夜精品久久久久久| 99久久人妻无码精品系列蜜桃 | 久久最新精品国产| 国产成人综合久久精品红| 91性高湖久久久久| www性久久久com| 久久人与动人物a级毛片| 国产成人精品综合久久久| 日韩欧美亚洲综合久久 | 色婷婷久久综合中文久久一本| 2021久久精品国产99国产精品| 伊人色综合久久天天人守人婷 | 伊人久久大香线蕉AV一区二区| 国产精品久久网| 久久精品水蜜桃av综合天堂| 人妻丰满?V无码久久不卡| 精品国产婷婷久久久| 日本精品久久久久中文字幕| 久久精品www人人爽人人| 天天躁日日躁狠狠久久 | 国内精品久久久久久久久电影网| 欧美va久久久噜噜噜久久| 伊人久久大香线蕉综合Av| 中文字幕亚洲综合久久菠萝蜜| 久久久WWW免费人成精品| 9999国产精品欧美久久久久久| 日本道色综合久久影院| 99久久免费国产精品| 国产精品久久久久久久久久免费| 久久综合狠狠综合久久激情 | 国产亚洲精品自在久久|