Page 1 of 1

Problem to convert into Bitmap from wxTextCtrl

Posted: Mon Jan 16, 2006 10:08 pm
by kyehyun
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)

Posted: Tue Jan 17, 2006 6:15 am
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.

Posted: Tue Jan 17, 2006 1:57 pm
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.