If your trying to make a rollover button why not use an actual button and just change the style property of the button to graphical. Then in the appropriate events change the picture property of the button.
The flicker can occur in the Mouse_Move event becuase you are constantly trying to set the picture.. which takes up cpu...
To overcome the flickering.. you can have a Boolean variable where Once your in the Mouse_Move event dont set the picture again constantly until the Boolean goes off when the mouse leaves the button.
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.
Hack, Please can you use different tags, when i copy and paste it goes in a straight line and dosent keep the format. Im at college at the moment, ill try it when i get home. thanks
Im also gona look at the control that aashish_9601 has posted, thanks for that aswell
If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.
If you fail, try and try again, its the only way to success.
I get sub not defined on your code for "ReleaseCapture" do i need to use an api call.
aashish_9601's code works fine just needs touching up abit as the hoverbutton is smaller than the control, it could also do with a few instructions on how to change the picture and stuff.
If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.
If you fail, try and try again, its the only way to success.
Oops...forgot to include the API declares. I will use the Code tags for these.
Code:
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function GetCapture Lib "user32" () As Long
thanks it works, but can i make the background of the picturebox transparent like the imagebox because my button is slightly shaped. Also when the mouse leaves the hover button the form flashes.
If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.
If you fail, try and try again, its the only way to success.
Im using an image thats a tiny bit bigger than the start button on xp. Im trying to make my own customized replacement user interface that replaces the windows desktop.
I dont think any code can be interfering because ive only just started and ive only done the graphics part and lining them up. Heres my code
Code:
Private Sub StartButton_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (X < 0) Or (Y < 0) Or (X > StartButton.Width) Or (Y > StartButton.Height) Then
ReleaseCapture
'the mouse is no longer over the button, reload first image
Me.Picture = RO_Buttons.ListImages(2).Picture
StartButton.Picture = LoadPicture("C:\**\StartButton.gif")
ElseIf GetCapture() <> StartButton.hwnd Then
SetCapture StartButton.hwnd
'the mouse is over the button, so load second image
'Me.Picture = RO_Buttons.ListImages(1).Picture
StartButton.Picture = LoadPicture("C:\Documents and Settings\**\StartButton_Light.gif")
End If
If StartMenu.Visible = True Then
StartButton.Picture = LoadPicture("C:\Documents and Settings\****\Images\StartButton_Dark.gif")
End If
End Sub
oh yeah i have a big background image, which is the part thats flashing.
If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.
If you fail, try and try again, its the only way to success.
oh yeah i have a big background image, which is the part thats flashing.
Well, I guess that is why it has never happened to me as I have never used a big background image.
So, this background image covers the entire form, and all of the controls and such that are on the form are actually on this image, is that how it is set up?
The background image is in its own imagebox and the imagebox stops were the taskbar starts. Im not using the form picture control. Do you think that it wont stop, if not can i some how make the form transparent just so it shows the start menu and run another form on top for the desktop.
If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.
If you fail, try and try again, its the only way to success.
This is just a guess (in 14 years of VB work, I've never had any program specs tossed in my inbox requiring the use of graphic stuff. ), but, the picturebox does have an AutoSize property that is False by default.
If i make the buttons and the rollover effect in flash will i be able to use them as buttons with the flash dll\ocx. I mean do they have the _click sub and do you think this will stop my form from flikering.
If your question is answered then mark your thread RESOLVED and give credit to whoever answered it.
If you fail, try and try again, its the only way to success.