Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / wxBitmap, AddHandler()

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. wxBitmap, AddHandler()
#3645
Posted by: 2004-03-29 21:32:04
Hi, haw can I insert a gif-file on the panel? I tryed but I get the error "no image handler for type 13 defined". Could you pleasse help me?

in MyFrame (derived from wxFrame), on the panel panel_bsc:

wxBitmap *picture = new wxBitmap("picture.gif", wxBITMAP_TYPE_GIF);
wxClientDC dc(panel_bsc);

CreateStatusBar();
gedas->InsertHandler(gedas->FindHandler("gif"));

if (picture->Ok()) SetStatusText("LOADED gif!");
else SetStatusText("FAILED TO LOAD gif!");
dc.DrawBitmap(*picture, 220, 30);  //here I get error: invalid bitmap in
                                   //wxDC::DrawBitmap()

thanks!
Message2. Re: wxBitmap, AddHandler()
#3646
Posted by: upCASE 2004-03-29 23:23:14
Hi!
First of all I'd suggest using wxImage instead of wxBitmap.
Either way you should initialize the image handler before loading the image. Try wxInitAllImageHandlers() to initialize all available handlers, or use wxImageHandler::AddHandler(new wxGIFHandler); to initialize only the gif handler.

upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2024-10-5  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0