Visual Basic - AYUDA X FAVOR!!!

Life is soft - evento anual de software empresarial
 
Vista:

AYUDA X FAVOR!!!

Publicado por ana (45 intervenciones) el 04/07/2006 17:46:18
TENGO UN PROBLEMA CON UN SISTEMA....EL CODIGO ES EL SIGUIENTE, LO Q HACE ES ADQUIRIR UNA IMAGEN, Y DIBUJAR UNA LINEA SOBRE LA IMAGEN, ESA LINEA ES LA Q NECESITO MEDIR EN CENTIMETROS Y MOSTRARLO EN UN LABEL P DESPUES HACER OTROS CALCULOS.......... NECESITO AYUDA URGENTE XFISSS!! COMO HAGO P MEDIR LA LINEA???

Dim X0 As Single, Y0 As Single
Private Sub Command1_Click()
image1.Stretch = False
End Sub
Private Sub Form_Load()
image1.Picture = Form1.image1.Picture
Form2.Caption = Form1.File1.FileName
OldX = 0
OldY = 0

' Posicion Inicial de las imagenes
Image2.Move 0, 0, ScaleWidth - VScroll1.Width, ScaleHeight - HScroll1.Height
image1.Move 0, 0

' posicion inicial scrollbar horizontal
HScroll1.Top = Image2.Height
HScroll1.Left = 0
HScroll1.Width = Image2.Width

' posicion inicial scrollbar vertical
VScroll1.Top = 0
VScroll1.Left = Image2.Width
VScroll1.Height = Image2.Height

'Determina si la imagen se sobresale de la pantalla,
'sino, deja de hacer visible las scrollbar

VScroll1.Visible = (Image2.Height < image1.Height)
HScroll1.Visible = (Image2.Width < image1.Width)
End Sub
Sub HScroll1_Change()
' Picture2.Left is set to the negative of the value because
' as you scroll the scroll bar to the right, the display
' should move to the Left, showing more of the right
' of the display, and vice-versa when scrolling to the
' left.
image1.Left = -HScroll1.Value
End Sub
Private Sub image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
X0 = X
Y0 = Y
End Sub
Private Sub image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.image1.Line (X0, Y0)-(X, Y), 0
End Sub
Sub VScroll1_Change()
' Picture2.Top is set to the negative of the value because
' as you scroll the scroll bar down, the display
' should move up, showing more of the bottom
' of the display, and vice-versa when scrolling up.
image1.Top = -VScroll1.Value
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
GetCursorPos Pnt
Text1.Text = Pnt.X
Text2.Text = Pnt.Y
NewX = Pnt.X
NewY = Pnt.Y
End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:AYUDA X FAVOR!!!

Publicado por Pedro Luis (878 intervenciones) el 04/07/2006 18:20:15
Si el ScaleMode del formulario lo pones en 7 (Centimetros), X2-X1 estará en cm. y Y2-Y1 también, el resto es un problema de geomatría.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:AYUDA X FAVOR!!!

Publicado por manolo (239 intervenciones) el 04/07/2006 20:19:42
Respuesta incorrecta. Pongo un control Line en un Form (con la propiedad ScaleMode a centímetros) y a continuación la siguiente instrucción:
centimetros = Line1.X2 - Line1.X1
y el resultado: 3,81236
cojo un metro y mido la linea en la pantalla. Resultado: 4,32
No lo he probado en otro monitor (porque solo tengo uno), pero estoy seguro que el resultado va a ser diferente.
¿Cómo lo explicas?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar