| |||
![]() ¿Cómo se pueden dibujar círculos en VB al estilo paint? O sea, el problema que tengo se centra en determinar el radio a medida que se aleja o acerca el cursor., ¿cómo puedo hacer? Gracias! |
| |||
Otra forma de hacer eso también sería esta: Private DrawNow As Integer Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then Form1.Cls DrawNow = -1 CurrentX = X CurrentY = Y End Sub Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If DrawNow Then 'Se puede jugar con estas dos sentencias Line -(X, Y) Circle (X, Y), 200 End If End Sub Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) DrawNow = 0 End Sub espero que te sirva |
| |||
No, no me sirve. Con ese código dibuja un círculo de 200 de radio, y yo lo que quiero es que el radio se vaya modificando a medida que el cursor se aleje o acerce del punto donde pulsé, ¿me entendes? Sería como el estilo paint... |
| |||
Puedes empezar entendiendo esto:
Código:
Option Explicit Dim DrawNow As Boolean Dim InicioX As Single Dim InicioY As Single Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) DrawNow = True InicioX = X InicioY = Y End Sub Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If DrawNow = True Then Form1.Cls If X >= 0 Then Circle (InicioX, InicioY), X End If End Sub Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) DrawNow = False End Sub |
| |||
No, eso es lo mismo de antes. Lo que yo buscaba era esto: Cita: Dim draw As Boolean Dim d, c Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) draw = 1 c = X d = Y End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If draw Then Cls a = X - c b = Y - d Circle (c, d), Sqr(a * a + b * b) End If End Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) a = X - c b = Y - d AutoRedraw = True Circle (Form1.CurrentX, Form1.CurrentY), Sqr(a * a + b * b) AutoRedraw = False draw = 0 End Sub |
| |||
No, no es lo mismo que antes. Gracias por ni leerlo. Lo que hice fue modificar el código de arriba para que vieses como hacer un círculo más o menos grande moviendo el ratón. Pero ya veo que aquí... |
| |||
Sí que lo leí. Y yo no necesitaba saber eso, de otra manera hubiera pedido eso y no esto: Cita: ¿Cómo se pueden dibujar círculos en VB al estilo paint? O sea, el problema que tengo se centra en determinar el radio a medida que se aleja o acerca el cursor., ¿cómo puedo hacer? Gracias! |