|
-
May 19th, 2001, 06:17 AM
#1
moving buttons
If you move a command button around the screen using a timer, the caption doesn't seem to stay crystal clear as it jumps, even if the jumps are very small. Is VB just not the sort of thing for this, or are command boxes just not the sort of object?
Thanks
Phil
-
May 19th, 2001, 07:52 AM
#2
Re: moving buttons
Greetings!
I don't exactly know what you're complaining about. I tried out moving a button around a window using a timer myself, it moves perfectly alright. So, what's the matter?
-
May 19th, 2001, 09:44 AM
#3
Re: moving buttons
It should not do that but to force it to refresh itself, just use the Command1.Refresh() method after you move it to new location. It might help.
-Cool Bizs
Good Luck,
-Cool Bizs
-
May 19th, 2001, 11:23 AM
#4
Re: moving buttons
I'm not mad, honostly.
It's fine on my other computers but on my new computer it just looks awful. It's like the word turns to bold italic for .1 of a second and then slowly disovles into focus. I can't change the refresh rate of the screen - could it be that - or a monitor problem?
MANY MANY thanks
Phil
-
May 19th, 2001, 08:35 PM
#5
Re: moving buttons
You can check if it is a problem of your monitor by replacing this new monitor by the old one.
An alternative, if you still face problems of flicker, (and have the time and interest to rewrite,) you can use a picturebox control, with the DrawFrameControl() API and TextOut() API (or the Print Method) to "draw" a command button.
Following is a code that uses a picture box to simulate a command button. Set the borderstyle of the picturebox to none, autoredraw to true and scalemode to Pixel.
private Declare Function DrawFrameControl Lib "user32" (byval hDC as Long, lpRect as RECT, byval un1 as Long, byval un2 as Long) as Long
private Type RECT
Left as Long
Top as Long
Right as Long
Bottom as Long
End Type
private Const DFC_BUTTON = 4
private Const DFCS_BUTTONPUSH = &H10
private Const DFCS_PUSHED = &H200
Dim aRect as RECT
private Sub Form_Load()
aRect.Top = 0
aRect.Left = 0
aRect.Right = Picture1.ScaleWidth
aRect.Bottom = Picture1.ScaleHeight
DrawFrameControl Picture1.hDC, aRect, DFC_BUTTON, DFCS_BUTTONPUSH
Picture1.Refresh
End Sub
private Sub Picture1_MouseDown(Button as Integer, Shift as Integer, X as Single, Y as Single)
DrawFrameControl Picture1.hDC, aRect, DFC_BUTTON, DFCS_BUTTONPUSH Or DFCS_PUSHED
Picture1.Refresh
End Sub
private Sub Picture1_MouseUp(Button as Integer, Shift as Integer, X as Single, Y as Single)
DrawFrameControl Picture1.hDC, aRect, DFC_BUTTON, DFCS_BUTTONPUSH
Picture1.Refresh
End Sub
-
May 20th, 2001, 08:54 AM
#6
Re: moving buttons
THANKS
Most interesting - I shall try out your code. Thanks again.
I'm sure it is the monitor however that is causing the problem - a lap top so I can't stick another monitor on it - but the program works fine on 6 ohter computers including a lap top.
Thaks again.
Phil
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
|