wxBitmapButton with text Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
jkbagain
Knows some wx things
Knows some wx things
Posts: 29
Joined: Wed May 09, 2007 1:01 am
Location: Manila,Philippines
Contact:

wxBitmapButton with text

Post by jkbagain » Wed May 09, 2007 5:01 am

How could I load a text in the wxBitmapButton for i am having a problem on how to put a text value like "enter" or "submit" on top of the image in the button...

Thanks in advanced..............
What important in a problem is not the solution but the lessons you learned in finding the solution.

Lloyd
Super wx Problem Solver
Super wx Problem Solver
Posts: 350
Joined: Wed May 03, 2006 2:36 pm
Location: India
Contact:

Post by Lloyd » Wed May 09, 2007 5:06 am

There is no control for this. You have to make your own!

see these threads

http://forums.wxwidgets.org/viewtopic.php?t=5172

http://forums.wxwidgets.org/viewtopic.php?t=13137

megabyte
I live to help wx-kind
I live to help wx-kind
Posts: 196
Joined: Tue Dec 07, 2004 8:54 pm
Location: Essen, Germany

Post by megabyte » Wed May 09, 2007 5:08 am

Draw your text on a bitmap using wxMemoryDC. In the controls sample you will find a complete code. It looks like

Code: Select all

    wxBitmap bitmap( 100, 100 );
    wxMemoryDC dc;
    dc.SelectObject( bitmap );
    dc.SetBackground(*wxGREEN);
    dc.SetPen(*wxRED_PEN);
    dc.Clear();
    dc.DrawEllipse(5, 5, 90, 90);
    dc.DrawText(_T("Bitmap"), 30, 40);
    dc.SelectObject( wxNullBitmap );

    (void)new wxBitmapButton(panel, ID_BITMAP_BTN, bitmap, wxPoint(100, 20));
Edit: Use wxDC::DrawBitmap to draw your own bitmap on the wxMemoryDC's bitmap.

lowjoel
Moderator
Moderator
Posts: 1511
Joined: Sun Jun 19, 2005 11:37 am
Location: Singapore
Contact:

Post by lowjoel » Wed May 09, 2007 9:19 am

You should never be using Bitmap Buttons with labels, especially if they do not add meaning to the buttons.

See the Vista UX guidelines: http://msdn.microsoft.com/library/defau ... e/home.asp

Joel

jkbagain
Knows some wx things
Knows some wx things
Posts: 29
Joined: Wed May 09, 2007 1:01 am
Location: Manila,Philippines
Contact:

thanks...

Post by jkbagain » Thu May 10, 2007 3:12 am

thanks to both of u.....thank so much.....
What important in a problem is not the solution but the lessons you learned in finding the solution.

Post Reply