Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

ayuda con circulos

Estas en el tema de ayuda con circulos en el foro de Visual Basic clásico en Foros del Web. hola tengo un problema con un programa.... el programa tendra que dibujar un circulo y una linea. estos circulos y lineas los puede modificar el ...
  #1 (permalink)  
Antiguo 30/03/2006, 14:38
 
Fecha de Ingreso: marzo-2006
Mensajes: 1
Antigüedad: 18 años, 1 mes
Puntos: 0
ayuda con circulos

hola tengo un problema con un programa....
el programa tendra que dibujar un circulo y una linea. estos circulos y lineas los puede modificar el usuario y hacerlo de cualquier tamaño,ademas de poder borrar el circulo o linea que el usuario desee..
tengo una pequeña parte de este programa.... lo pongo...asi se me ocurrio hacerlo pero pues ya no doy mas es mi primer programa en Visual Basic...y no se casi nada todo lo he consultado en tutoriales.....
por su ayuda gracias...


Private Type figuras

fig386 As String
xi386 As Integer
yi386 As Integer
Xf386 As Integer
Yf386 As Integer

End Type
Public contarfigura
Dim figuras386(5, 4)

Public xx1, yy1, xx2, yy2, xxx1, yyy1, xxx2, yyy2

Public contar
Dim tipos386, x1386, y1386, x2386, y2386, cont386, numarch386 As Integer
Dim figu386(10) As figuras
Dim RatonAbajo As Boolean
Dim nombre386 As String

Private Sub Command1_Click()
Call barra(1, "Circulo")
End Sub

Private Sub Command2_Click(Index As Integer)
Form1.Circle (xx1, yy1), xx2, &H80000005 '&H80000005 es el color blanco
yy1 = (yy1 - 40)
xx = figuras386(contarfiguras, 2) + 1
figuras386(contarfiguras, 2) = xx
Form1.Circle (xx1, yy1), xx2, 2


End Sub

Private Sub Command22_Click(Index As Integer)
Form1.Circle (xx1, yy1), xx2, &H80000005
xx1 = (xx1 - 40)
figuras386(contarfiguras, 2) = yy
Form1.Circle (xx1, yy1), xx2, 0
End Sub

Private Sub Command28_Click(Index As Integer)
Form1.Circle (xx1, yy1), xx2, &H80000005
xx1 = (xx1 + 40)
figuras386(contarfiguras, 2) = yy
Form1.Circle (xx1, yy1), xx2, 0

End Sub

Private Sub Command3_Click()
tipos386 = 3
End Sub

Private Sub Command7_Click(Index As Integer)
Form1.Circle (xx1, yy1), xx2, &H80000005
yy1 = (yy1 + 40)
figuras386(contarfiguras, 2) = yy
Form1.Circle (xx1, yy1), xx2, 0
End Sub

Private Sub Command4_Click()
Call barra(2, "linea")

End Sub
Private Sub barra(ByVal l As Integer, ByVal s As String)
tipos386 = l
Form1.StatusBar1.Panels(2).Text = s
End Sub


Private Sub Form_Load()
tipos386 = cont386 = numarch386 = 0
RatonAbajo = False
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X386 As Single, Y386 As Single)
Form1.StatusBar1.Panels(1).Text = "X386:" + Str(X386) + " Y386:" + Str(Y386) + Str(contarfigura) + Str(contar)
If RatonAbajo = True And tipos386 = 3 Then
Form1.Circle (xx1, yy1), xx2, &H80000005
xx1 = (xx1 - 40)
figuras386(contarfiguras, 2) = yy
Form1.Circle (X386, Y386), xx2, 0
xx1 = X386
yy1 = Y386
End If
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X386 As Single, Y386 As Single)
x1386 = X386
y1386 = Y386
RatonAbajo = True
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X386 As Single, Y386 As Single)
x2386 = X386
y2386 = Y386
If tipos386 = 2 Then
Call Dibujo(x1386, y1386, x2386, y2386, "l")
End If
If tipos386 = 1 Then
Call Dibujo(x1386, y1386, x2386, y2386, "c")
End If
Form1.StatusBar1.Panels(2).Text = ""
RatonAbajo = False
End Sub

Private Sub Guardar_Click()
Dim q As Integer
numarch386 = FreeFile
CommonDialog1.ShowSave
Open CommonDialog1.FileTitle For Output As numarch386
Print #numarch386, cont386
For q = 0 To (cont386 - 1)

Print #numarch386, figu386(q).xi386
Print #numarch386, figu386(q).yi386
Print #numarch386, figu386(q).Xf386
Print #numarch386, figu386(q).Yf386
Print #numarch386, figu386(q).fig386

Next q
Close numarch386
End Sub
Private Sub Abrir_Click()
Cls
CommonDialog2.ShowOpen
numarch386 = FreeFile
Open CommonDialog2.FileTitle For Input As numarch386
Input #numarch386, cont386

For q = 0 To cont386 - 1

Input #numarch386, x1386
Input #numarch386, y1386
Input #numarch386, x2386
Input #numarch386, y2386
Input #numarch386, tii
Call Dibujo(x1386, y1386, x2386, y2386, tii)

Next q
Close numarch386
End Sub

Private Sub Nuevo_Click()
Form1.Cls
cont386 = 0
'figu386(0).total = 0
End Sub

Private Sub Salir_Click()
End
End Sub
Private Sub Dibujo(ByVal xi386 As Integer, ByVal yi386 As Integer, ByVal Xf386 As Single, ByVal Yf386 As Single, ByVal tip As String)
contarfigura = contarfigura + 1
If contarfigura = 6 Then
contarfigura = 0
End If

If tip = "l" Then
figu386(cont386).fig386 = "l"
figu386(cont386).xi386 = x1386
figu386(cont386).yi386 = y1386
figu386(cont386).Xf386 = x2386
figu386(cont386).Yf386 = y2386
Form1.Line (x1386, y1386)-(x2386, y2386)

End If
If tip = "c" Then
figu386(cont386).fig386 = "c"
figu386(cont386).xi386 = x1386
figu386(cont386).yi386 = y1386
figu386(cont386).Xf386 = x2386
figu386(cont386).Yf386 = y2386
Dim b386, h386 As Integer
Dim r386 As Single
If x1386 <> x2386 Then
If x1386 < x2386 Then
h386 = x2386 - x1386
Else
h386 = x1386 - x2386
End If
End If
If y1386 <> y2386 Then
If y1386 < y2386 Then
b386 = y2386 - y1386
Else
b386 = y1386 - y2386
End If
End If
r386 = Sqr((h386 ^ 2) + (b386 ^ 2))

Form1.Circle (x1386, y1386), r386, circulo
xx1 = x1386
yy1 = y1386
xx2 = r386
yy2 = circulo

End If
cont386 = cont386 + 1
contar = 0
End Sub
  #2 (permalink)  
Antiguo 31/03/2006, 21:49
 
Fecha de Ingreso: abril-2004
Mensajes: 192
Antigüedad: 20 años
Puntos: 0
¿Es tu primer programa en vb??? mmmmmmmmmmmmmm ... algo me suena raro
  #3 (permalink)  
Antiguo 01/04/2006, 08:53
 
Fecha de Ingreso: abril-2006
Mensajes: 1
Antigüedad: 18 años, 1 mes
Puntos: 0
De acuerdo bueno ya he hecho algunos sencillos

ya he programado en c++, y c ... por eso no se me hace dificil las posiciones del cursor, pero en los libros que tengo en la biblioteca del TEC donde estudio viene como dibujar esos circulos y he bajado un sin numero de tutoriales de VB. solo que ya no lo puedo completar por que ni los libros ni los tutoriales trae algo de como hacer mas grande o pequeño los circulos que dibujo en tiempo de ejecucion......

por fa......si alguien me podria ayudar.....no pido que me lo haga.... solo pido que me diga de que manera se puede hacer.....si existen algunas propiedades o eventos que hagan eso .... se los agradecere....
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:51.