CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2009
    Posts
    23

    increase padding of separator in toolbar

    Hi there,

    In my toolbar I made a button that is a separator by using the BTNS_SEP style. I'm using this button to break up two buttons. However, that amount of separation is not enough for my tastes. Is there a way to increase the padding around the separator so that it is larger/thicker? Thanks.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    894

    Re: increase padding of separator in toolbar

    You have three options:

    (1) Put two or more separators (which will probably look silly)

    (2) Create another toolbar and position it so that it is "enough for your tastes", or

    (3) Program a toolbar from scratch and make separators thicker.

  3. #3
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: increase padding of separator in toolbar

    The trick is:
    MSDN
    TBBUTTON
    If the button is a separator, that is, if fsStyle is set to BTNS_SEP, iBitmap determines the width of the separator, in pixels.
    Example:
    Code:
       int nIndex = 2;
       TBBUTTON tbb = {0};
       tbb.fsStyle = BTNS_SEP; // or TBSTYLE_SEP;
       tbb.iBitmap = 20; // The width of the separator, in pixels
       
       ::SendMessage(hWndToolbar, TB_INSERTBUTTON, (WPARAM)nIndex, (LPARAM)&tbb);
    Last edited by ovidiucucu; August 23rd, 2009 at 03:32 AM.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    894

    Re: increase padding of separator in toolbar

    Hey, it's a good one, ovidiucucu. Is it actually documented?

  5. #5
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: increase padding of separator in toolbar

    Quote Originally Posted by dc_2000 View Post
    Hey, it's a good one, ovidiucucu. Is it actually documented?
    Yes. In MSDN.

    // Sorry, I added the quote later.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  6. #6
    Join Date
    May 2009
    Posts
    23

    Re: increase padding of separator in toolbar

    Quote Originally Posted by ovidiucucu View Post
    The trick is:


    Example:
    Code:
       int nIndex = 2;
       TBBUTTON tbb = {0};
       tbb.fsStyle = BTNS_SEP; // or TBSTYLE_SEP;
       tbb.iBitmap = 20; // The width of the separator, in pixels
       
       ::SendMessage(hWndToolbar, TB_INSERTBUTTON, (WPARAM)nIndex, (LPARAM)&tbb);

    It worked! Thanks!

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