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
kyehyun
In need of some credit
In need of some credit
Posts: 1
Joined: Mon Jan 16, 2006 9:29 pm
Location: South Korea
Contact:

Problem to convert into Bitmap from wxTextCtrl

Post by kyehyun »

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

Code: Select all

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

Image

Code: Select all

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

but, can't convert the invisible region of wxTextCtrl
How to convert into Bitmap from wxTextCtrl(Entire)
Home page : http://kyehyun.com
Wiki page : http://wiki.kyehyun.com
Blog page : http://blog.kyehyun.com
Mobile : +82-10-3013-8086
Email : kyehyun at gmail.com
GoogleTalk IM : kyehyun at gmail.com
MSN IM : kyehyun at gmail.com
ICQ IM : 115-079-903
Cursor
Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Aug 29, 2004 3:09 pm
Location: Grenoble, France
Contact:

Post by Cursor »

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.
leio
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
Contact:

Post by leio »

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 - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/
Post Reply