|
-
Nov 24th, 2006, 11:13 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Problem with picturebox hdc
In order to make some visual enhacements into a program I decided to load and stretch a picture into a picturebox directly from memory (using different APIs like BitBlt, StretchBlt, CreateCompatibleDC, etc). However when doing this the picture is loaded on top of the labels I've placed over the picturebox.
For example: I have a label with caption "HELLO" over the picturebox, it's shown correctly both in the IDE, if I don't load any picture into the picbox, or I load one directly from the IDE. When I load a picture into the picbox using the APIs and its hDc property the label stays behind the picture.
How can I fix this without changing the zorder of the label? like some sort of API or message that forces the picture to show at the back of any control.
-
Nov 25th, 2006, 04:26 AM
#2
Re: Problem with picturebox hdc
try putting:after you Blt the picture
-
Nov 25th, 2006, 04:55 AM
#3
Re: Problem with picturebox hdc
If you use PaintPicture you won't have this problem
VB Code:
Picture1.PaintPicture YourPic, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight
-
Nov 25th, 2006, 08:41 AM
#4
Thread Starter
Addicted Member
Re: Problem with picturebox hdc
 Originally Posted by bushmobile
try putting: after you Blt the picture
That doesn't work well either, plus I'd prefer to make this code so I don't have to worry about the control that are over the picbox, and so make it more portable.
 Originally Posted by jcis
If you use PaintPicture you won't have this problem
VB Code:
Picture1.PaintPicture YourPic, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight
Uhm, right now what I do is creating directly a DC, and using StretchBlt with picture1.hdc. Your method would imply using a Image and its LoadPicture method, wouldn't it? or do you mean some other thing? I'll give a try to this.
-
Nov 25th, 2006, 10:40 AM
#5
Thread Starter
Addicted Member
Re: Problem with picturebox hdc
 Originally Posted by Neverbirth
Uhm, right now what I do is creating directly a DC, and using StretchBlt with picture1.hdc. Your method would imply using a Image and its LoadPicture method, wouldn't it? or do you mean some other thing? I'll give a try to this.
Well, after using the proposed method I was having the same problem, so I thought it was definately not a problem of the original method I was using, and after looking at this more I found out my problem was the autoredraw property being set to false.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|