Fit text to CXTPButton with image |
Post Reply |
Author | |
ibmldev
Groupie Joined: 17 October 2006 Status: Offline Points: 19 |
Post Options
Thanks(0)
Posted: 15 December 2008 at 10:36am |
If I make a CXTPButton with image and text, and the text is too long to fit in the button, then the text is trunctated to fit (as expected). But, the button does not reserve space for the image. As a result, the text fills the entire width of the button and the image sits on top of the text, obscuring part of it.
It would be nice if the text were not only clipped to fit the button, but also clipped to fit the non-image portion of the button. Can this be done automatically, or do I need to somehow manually trim the text to some appropriate length when the button is resized? If I need to do it, do you have any tips to offer? Here is the code I use to create the button: m_btn.Create( _T( "Foo - Now is the time for all good men to come to the aid of their country." ), WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | BS_PUSHLIKE, dummyRect, this, ID_LED ); m_btn.SetChecked( FALSE ); m_btn.SetShowFocus( FALSE ); m_btn.SetBitmap( 0, IDB_RED_LED_16X16 ); m_btn.SetImageAlignment( BS_VCENTER | BS_LEFT ); m_btn.SetTextImageRelation( xtpButtonImageBeforeText ); This button is resized by the application when the dialog containing it is resized, so the amount of spaced available may vary after creation. -Mark |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |