Problem to convert into Bitmap from wxTextCtrl

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
In need of some credit
In need of some credit
Posts: 1
Joined: Mon Jan 16, 2006 9:29 pm
Location: South Korea

Problem to convert into Bitmap from wxTextCtrl

Post by kyehyun » Mon Jan 16, 2006 10:08 pm

How to convert into Bitmap from wxTextCtrl(RICH2, Color)

Code: Select all

styledEdit = new wxTextCtrl(this, wxID_ANY,
                            wxDefaultPosition, wxDefaultSize,
                            wxTE_MULTILINE | wxTE_RICH2 | wxVSCROLL | wxHSCROLL);
after write at styledEdit (wxTextCTrl, RICH2), and convert into bitmap file.


Code: Select all

    wxClientDC screen(styledEdit); 
    wxSize size = screen.GetSize(); 
    wxBitmap bitmap(size.GetWidth(), size.GetHeight()); 
    wxMemoryDC memory; 
    memory.Blit(0, 0, size.GetWidth(), size.GetHeight(), &screen, 0, 0); 
    bitmap.SaveFile(wxT("bitmaps/Text.bmp"), wxBITMAP_TYPE_BMP);

but, can't convert the invisible region of wxTextCtrl
How to convert into Bitmap from wxTextCtrl(Entire)
Home page :
Wiki page :
Blog page :
Mobile : +82-10-3013-8086
Email : kyehyun at
GoogleTalk IM : kyehyun at
MSN IM : kyehyun at
ICQ IM : 115-079-903

Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Aug 29, 2004 3:09 pm
Location: Grenoble, France

Post by Cursor » Tue Jan 17, 2006 6:15 am

You probably can not capture all the wxTextCtrl canva because, it probably dont store it completly.

IMHO, the wxTextCtrl (and all its specific implementation) use a local drawing function so if you want to draw it, you must paint it yourself based on the wxTextCtrl text-style infos.
What is little and green, witch go up and down ??
Yoda playing with the force.

Can't get richer than this
Can't get richer than this
Posts: 802
Joined: Mon Dec 27, 2004 10:46 am
Location: Estonia, Tallinn

Post by leio » Tue Jan 17, 2006 1:57 pm

That particular drawing function would be deep in the native widgets implementation then. E.g, gtk_textview_expose or similar for wxGTK. In other words, kind of a no go if you can't stretch the width somehow.
Compilers: gcc-3.3.6, gcc-3.4.5, gcc-4.0.2, gcc-4.1.0 and MSVC6
OS's: Gentoo Linux, WinXP; WX: CVS HEAD

Project Manager of wxMUD -
Developer of wxGTK;
gtk+ port maintainer of OMGUI -

Post Reply