Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » image drawn in Paint(Draw &w) does not stay when refereshed
image drawn in Paint(Draw &w) does not stay when refereshed [message #12917] |
Wed, 28 November 2007 13:10  |
amit
Messages: 17 Registered: November 2007
|
Promising Member |
|
|
hi,
problem:
1) I am trying to write a small app with a logo in the start of it.
2) the logo was made in the constructor from RGB raw data.
3) the image is painted on Paint() function.
-- when build and executed the logo works out fine
-- but if refreshed (window size changed, alt-tabbed back or if Refresh() is called), the image goes away.
-- note: other stuff as DrawRect(..) and DrawText(..) works fine it just the image is not redrawn.
code:
#include "my_class.h"
#include "logo.h"
#include "windows.h"
my_class::my_class()
{
CtrlLayout(*this, "Window title");
//ToolWindow(true);
//ExStyle(WS_EX_TOOLWINDOW | WS_OVERLAPPED);
//Style(WS_POPUP);
login_btn <<= THISBACK(process_login);
////////////< ------------------------------------------------------------ ------------------------------------------------------------ --------------------------logo stuff start
logo = ImageBuffer(150,30);
RGBA *pixel = logo;
byte *raw_image_data = (byte *)logo_hex_data;
for(int i=0; i<150*30; i++)
{
pixel->a = 255;
pixel->r = *raw_image_data++;
pixel->g = *raw_image_data++;
pixel->b = *raw_image_data++;
pixel++;
}
logo.SetKind(IMAGE_OPAQUE);
////////////< ------------------------------------------------------------ ------------------------------------------------------------ ----------------------------------------logo stuff end
//Maximize(true);
Sizeable(false);
Sizeable().Zoomable();
BackPaint();
}
void my_class::Paint(Draw& w)
{
w.DrawRect(GetSize(), SWhite);
w.DrawImage(10, 20, logo); ///////////< ------------------------------------------------------------ -------------------------------------------- logo drawn
w.DrawText(20, 20, "Hello world!", Arial(30), Magenta);
}
void my_class::process_login()
{
console.SetText((user_id.GetText() + password.GetText()).ToString());
//MessageBox( NULL, (user_id.GetText() + password.GetText()).ToString(), "wow", MB_OK);
}
GUI_APP_MAIN
{
my_class().Run();
}
[Updated on: Wed, 28 November 2007 13:15] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Tue May 13 10:54:06 CEST 2025
Total time taken to generate the page: 0.01349 seconds
|