im tring to create a toolbar with buttons that have the text centered. im able to put text on the buttons but the text isnt centered. the buttons are completely bare except for the text i want on them. the text seems to be shifted over to the right.
Posted on 2001-12-16 07:26:28 by smurf
Hi Smurf,

Not sure if you're still having the problems but I just finished grappling with putting an Explorer style toolbar on a Rebar control and think I know what you're getting at.

It sounds like you're trying to put text-only on a button in the TBSTYLE_LIST style. The text may look shifted over to the right because if you are defining the size of the bitmaps to be 0 (which you would logically think of doing if you're not going to be adding bitmaps), the "size" defaults to what looks like 16x16 anyway.

The way to trick it is to define the size of the non-existent bitmaps as a 1x1 pixel instead of 0x0.

For example, this will create 16x16 bitmaps (buttons are added in a TB_ADDBUTTONS SendMessage call afterwards)



invoke CreateToolbarEx, hWnd,\
TBSTYLE_FLAT + TBSTYLE_LIST + TBSTYLE_AUTOSIZE +\
WS_CHILD + WS_VISIBLE,\
NULL,0, NULL, NULL,\
ADDR TBButtons,0,0,0,0,0,SIZEOF(TBBUTTON)


But if you change this to



ADDR TBButtons,0,1,1,1,1,SIZEOF(TBBUTTON)


then your text should look OK either with or without the TBSTYLE_LIST style.

Hope this helps if this was your problem.

Kayaker
Posted on 2001-12-18 10:51:38 by Kayaker