|
-
Jul 17th, 2002, 10:52 PM
#1
Thread Starter
Fanatic Member
Trouble with BitBlt
If the form is already painted will it not repaint it? I know this is not TRUE skinning, but it suits my program. I want this to change the main forms background when a user selects it from the dropdown list so they can have a preview before saving the setting. Here's my code. Do I have to erase the form or something of the sort first?
VB Code:
Private Sub comboSkin_Click()
Kamo2.Picture1.Picture = Kamo2.ImageList1.ListImages(liboptions.comboSkin.ListIndex).Picture
ScaleMode = 3
Kamo2.Picture1.AutoRedraw = True
Kamo2.AutoRedraw = True
For X = 0 To Width Step Kamo2.Picture1.Width
For Y = 0 To Height Step Kamo2.Picture1.Height
DoEvents
BitBlt hDC, X, Y, Kamo2.Picture1.ScaleWidth, Kamo2.Picture1.ScaleHeight, Kamo2.Picture1.hDC, 0, 0, vbSrcCopy
Next Y
Next X
ScaleMode = 1
End Sub
-
Jul 18th, 2002, 12:30 AM
#2
PowerPoster
After you call bitblt, you have to call Kamo.Refresh, or whatever window you are drawing to. You have to do this because you have set autoredraw to true. It won't update it until you refresh it.
-
Jul 18th, 2002, 12:08 PM
#3
Thread Starter
Fanatic Member
Still not working.
I put Kamo2.refresh after the bitblt function, and you can see a flash on the form,but the image doesn't change. Any ideas?
-
Jul 18th, 2002, 01:33 PM
#4
Thread Starter
Fanatic Member
-
Jul 18th, 2002, 05:48 PM
#5
Thread Starter
Fanatic Member
^Bump^
Anyone? Repainting the form can't be that difficult can it?
-
Jul 18th, 2002, 05:52 PM
#6
PowerPoster
Are you repainting the source as well? Make sure the source is changing. You will probably have to refresh the source as well as the destination.
-
Jul 18th, 2002, 08:40 PM
#7
Thread Starter
Fanatic Member
Ok, Midgetsbro......
Here's my new code:
VB Code:
Private Sub comboSkin_Click()
Kamo2.Picture1.Picture = Kamo2.ImageList1.ListImages(liboptions.comboSkin.ListIndex).Picture 'set new pic
Kamo2.Picture1.Refresh
ScaleMode = 3
Kamo2.Picture1.AutoRedraw = True
Kamo2.AutoRedraw = True
For x = 0 To Width Step Kamo2.Picture1.Width
For y = 0 To Height Step Kamo2.Picture1.Height
DoEvents
BitBlt hDC, x, y, Kamo2.Picture1.ScaleWidth, Kamo2.Picture1.ScaleHeight, Kamo2.Picture1.hDC, 0, 0, vbSrcCopy
Next y
Next x
ScaleMode = 1
Kamo2.Refresh
End Sub
What I'm trying to do here is set picture1.picture on my main form (Kamo2) = to a new image (the listindex value of the combobox in my options form), and then repaint the Kamo2 form with the new image. Someone please help. This is rediculous. I don't see why it shouldn't work. I change the image and call Bitblt again.
-
Jul 18th, 2002, 11:34 PM
#8
PowerPoster
I am just wondering why you are looping through the whole width and height of the picture and re-bitblting the image. Don't you only need to bitblt it once into the form, and refresh and it should show? Make sure you have your picturebox's autoredraw property set to true if you have it's visible property set to false. You may not be loading the images correctly from the imagelist, but I am not sure, since I never use imagelists. If you are using this for skins, why not just load the pictures from the hard drive using LoadPicture?
-
Jul 25th, 2002, 11:48 AM
#9
PowerPoster
Well
The last post before the accident...
MidgetsBro : What did you break ?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
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
|