Buenas,
He encontrado un codigo en VB6 que hace exactamente lo que yo necesito pero como no conozco VB.net no sé cómo modificarlo para poder aplicarlo en VB.net.
Me pueden ayudar a convertirlo?
El código en VB6 es el siguiente:
----------------------------------------------------------------------------------------------
Dim X1 As Long 'This Is The X Position Of The Last Line Drawn
Dim Y1 As Long 'This Is The Y Position Of The Last Line Drawn
Dim X2 As Long 'This Is The Start Mark Of The Box or Circle
Dim Y2 As Long 'This Is The Satrt Mark Of The Box or Circle
Private Sub Combo1_Click()
LblType.Caption = Combo1.Text
If Combo1.ListIndex = 1 Then Check1.Enabled = True Else Check1.Enabled = False
End Sub
Private Sub Command1_Click()
FrmMenu.Show vbModal, Me
End Sub
Private Sub Command2_Click()
Picture1.Picture = CaptureScreen
End Sub
Private Sub Form_Load()
Combo1.ListIndex = 0
End Sub
Private Sub Form_Resize()
'Resize and Move Objects To Fit New Form Size...
On Error Resume Next
Frame1.Left = (Me.Width - Frame1.Width) / 2
Frame1.Top = Me.Height - (Frame1.Height + 480)
Picture1.Width = Me.Width - 360
Picture1.Height = Frame1.Top - 180
End Sub
Private Sub HScroll_Change(Index As Integer)
Shape1.BorderColor = RGB(HScroll(0).Value, HScroll(1).Value, HScroll(2).Value)
Shape1.FillColor = RGB(HScroll(0).Value, HScroll(1).Value, HScroll(2).Value)
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
X1 = X
Y1 = Y
X2 = X
Y2 = Y
'If Using Box or Circle Plot a Dot (PSet) to Mark The Begin of Either...
If LblType.Caption = "Box" Or LblType.Caption = "Circle" Then _
Picture1.PSet (X, Y), Shape1.FillColor
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
'Draw Continuous Line...
If LblType.Caption = "Continuous" Then
Picture1.Line (X1, Y1)-(X, Y), Shape1.FillColor
X1 = X: Y1 = Y
End If
'Draw Dots Using PSet...
If LblType.Caption = "PSet" Then
Picture1.PSet (X, Y), Shape1.FillColor
End If
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
X1 = 0
Y1 = 0
''Draw Box...
If LblType.Caption = "Box" Then
If Check1.Value = 0 Then
Picture1.Line (X2, Y2)-(X, Y), Shape1.FillColor, B
Else
Picture1.Line (X2, Y2)-(X, Y), Shape1.FillColor, BF
End If
End If
'
''Draw Circle...
If LblType.Caption = "Circle" Then
If X > X2 Then Picture1.Circle (X2, Y2), X - X2, Shape1.FillColor
If X2 > X Then Picture1.Circle (X2, Y2), X2 - X, Shape1.FillColor
End If
End Sub
----------------------------------------------------------------------------------------------
Gracias de antemano.