• <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++技術(shù) 在這里寫下自己的學(xué)習(xí)心得 感悟 和大家討論 共同進(jìn)步(歡迎批評(píng)!!!)

              C++博客 :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
              66 Posts :: 16 Stories :: 236 Comments :: 0 Trackbacks

            公告

            王一偉 湖南商學(xué)院畢業(yè) 電子信息工程專業(yè)

            常用鏈接

            留言簿(19)

            我參與的團(tuán)隊(duì)

            搜索

            •  

            積分與排名

            • 積分 - 387834
            • 排名 - 64

            最新隨筆

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            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 @王一偉 閱讀(1656) 評(píng)論(0)  編輯 收藏 引用 所屬分類: 1. MFC
            久久精品一区二区| 国内精品免费久久影院| 久久九九免费高清视频| 久久一区二区三区免费| 色8久久人人97超碰香蕉987| 久久99热只有频精品8| 国内精品久久久久久麻豆| 精品久久久久久无码中文字幕| 亚洲伊人久久综合影院| 狠狠狠色丁香婷婷综合久久五月| 久久最近最新中文字幕大全| 日韩精品久久无码中文字幕| 亚洲狠狠综合久久| 精品久久久久久中文字幕人妻最新| 久久91精品久久91综合| 思思久久好好热精品国产| 久久精品卫校国产小美女| 伊人久久综在合线亚洲2019 | 久久无码AV一区二区三区| 国产成人综合久久综合| 色综合久久久久久久久五月| 欧美粉嫩小泬久久久久久久| 精品久久8x国产免费观看| 亚洲а∨天堂久久精品9966| 久久99国产一区二区三区| 国内精品久久久久久99蜜桃| 亚洲国产婷婷香蕉久久久久久| 亚洲成人精品久久| 久久精品黄AA片一区二区三区| 久久久老熟女一区二区三区| 国产精品久久久久久久久久影院 | 亚洲伊人久久综合影院| 一本一本久久A久久综合精品| 国内精品九九久久精品| 青青热久久国产久精品| 国产免费久久精品丫丫| 国内精品久久久久久麻豆| 免费一级欧美大片久久网 | 少妇被又大又粗又爽毛片久久黑人| 欧美亚洲日本久久精品| 久久伊人精品青青草原高清|