Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dnyamicly check for a value 3

Status
Not open for further replies.

BenniP

Technical User
Nov 18, 2001
39
DE
hello,

i want to drag a form around, but in label in this form i want to inform the user every second, or half second, about the current position.
 

Are you talking about its X and Y (Left and Top) properties?

If so then you could use a timer control with the code in it that would be something like...

Label1.Caption = Me.Left & ", " & Me.Top

Good Luck
 
Add a Timer named (Timer1) on your form with the code shown below.

Private Sub Timer1_Timer()
Me.Caption = "Left = " & Format$(Me.Left) & ", Top = " & Format$(Me.Top)
End Sub
 
and to you also RonVaught,

but another question. how can i change the twips from vb, to pixel?
 
Check out the Screen.TwipsPerPixelX and .TwipsPerPixelY properties. Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 

or

Label1.Caption = Me.Left / Screen.TwipsPerPixelX & ", " & Me.Top / Screen.TwipsPerPixelY

Good Luck

 

Nope, that won't return pixel position you would need to add (* screen.width/height) to get pixel position based on resolution. (oops! if forgot).

Good Luck

 
sorry but i didn't understood your last post. it work fine for me without *screen.width or *screen.height.
 

When you set your screen resolution to 1600x1200 my origional code will return 1600x1200 for the bottom right corner of the screen, but 1600x1200 is not the number of pixels horizontally or vertically. When setting your resolution to 1600x1200 you are telling your OS to send to your screen 1600x1200 dots (pixels) per square inch.

So while my second post of code may be what you are looking for the actual answer for pixel position is my second and third post combined.

I hope that helps. Good Luck


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top