CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Oct 2007
    Posts
    96

    How to place a button at the far right of a Toolbar

    I have created a toolbar dynamically using the following function :

    m_ToolBar->Create(WS_CHILD | WS_VISIBLE | CCS_TOP | CCS_NODIVIDER | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT ,CRect(0,0,0, 0),this,0);

    And then adding buttons as follows:

    tbbutton[0].iBitmap = 0;
    tbbutton[0].idCommand = ID_BUTTON32785;
    tbbutton[0].fsState = TBSTATE_ENABLED ;//TBSTATE_ENABLED;
    tbbutton[0].fsStyle = TBSTYLE_BUTTON;
    tbbutton[0].dwData = 0;
    tbbutton[0].iString = 0;


    tbbutton[1].iBitmap = 1;
    tbbutton[1].idCommand = ID_BUTTON32786;
    tbbutton[1].fsState = TBSTATE_ENABLED;//TBSTATE_ENABLED ;
    tbbutton[1].fsStyle = TBSTYLE_BUTTON;
    tbbutton[1].dwData = 0;
    tbbutton[1].iString = 1;

    tbbutton[2].iBitmap = 2;
    tbbutton[2].idCommand = ID_BUTTON32787;
    tbbutton[2].fsState = TBSTATE_ENABLED;//TBSTATE_ENABLED;
    tbbutton[2].fsStyle = TBSTYLE_BUTTON;
    tbbutton[2].dwData = 0;
    tbbutton[2].iString = 2;....
    ....
    ....

    The above code adds the buttons starting at the top left hand side of the toolbar and then every call to the same structure creates the button in the next right position from the left. What I want to do is to place three buttons starting from the left side going right which is what the code above does on the toolbar then leaving a space and then placing one button at the far right... Is it possible to do this ?

    Thanks
    Last edited by justmehere; March 21st, 2009 at 09:29 PM. Reason: more clearity

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured