FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Background image for window on Windows

 
Post new topic   Reply to topic     Forum Index -> MinWin
View previous topic :: View next topic  
Author Message
stjepan



Joined: 11 Apr 2005
Posts: 22
Location: Croatia

PostPosted: Wed Apr 27, 2005 11:41 am    Post subject: Background image for window on Windows Reply with quote

I use:
Code:
paintDelegate ~= delegate void(Component source, GContext gc) {
   HBITMAP bmp = cast(HBITMAP)LoadImageA(null, "img/background.bmp", IMAGE_BITMAP, 0, 0, 0x10);
   SelectObject(gc.peer, bmp);
   BitBlt(gc.peer, 0, 0, 700, 700, GetDC(bmp), 0, 0, 0xCC0020);
   gc.flush();
};
It doesn't work. I don't know very much about WinAPI. Sad
_________________
I speak a little English. I am beginner in programming. I know C++, C# and D.
Back to top
View user's profile Send private message
BenHinkle



Joined: 27 Mar 2004
Posts: 76

PostPosted: Thu Apr 28, 2005 8:32 pm    Post subject: Reply with quote

Try something like
Code:

paintDelegate ~= delegate void(Component source, GContext gc) {
   HBITMAP bmp = cast(HBITMAP)LoadImageA(null, "img/background.bmp", IMAGE_BITMAP, 0, 0, 0x10);
   HDC bmpdc = CreateCompatibleDC(gc.peer);
   SelectObject(bmpdc, bmp);
   BitBlt(gc.peer, 0, 0, 700, 700, bmpdc, 0, 0, 0xCC0020);
   gc.flush();
   DeleteDC(bmpdc);
   DeleteObject(bmp);
};

Caching the handles so that they are create and deleted every time through the paint delegate would speed up the drawing if needed.
Back to top
View user's profile Send private message
stjepan



Joined: 11 Apr 2005
Posts: 22
Location: Croatia

PostPosted: Fri Apr 29, 2005 2:59 pm    Post subject: Reply with quote

Now it works, thanks.
_________________
I speak a little English. I am beginner in programming. I know C++, C# and D.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> MinWin All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group