Visual Basic - Como puedo pintar una figura

Life is soft - evento anual de software empresarial
 
Vista:

Como puedo pintar una figura

Publicado por jimcov (5 intervenciones) el 18/02/2006 05:25:27
hola a todos

necesito saber como pintar una figura irregular en VB
aqui les dejo un ejemplo

Option Explicit
Dim x1 As Integer
Dim x2 As Integer
Dim y1 As Integer
Dim y2 As Integer

Private Sub Command1_Click()
x1 = 500: x2 = 1500: y1 = 500: y2 = 500
Line (x1, y1)-(x2, y2)
y2 = y2 + 1000: Line -(x2, y2)
x2 = x2 + 500: y2 = y2 + 500: Line -(x2, y2)
y2 = y2 + 1000: Line -(x2, y2)
x2 = x2 - 1000: Line -(x2, y2)
y2 = y2 - 1000: Line -(x2, y2)
x2 = x2 - 500: y2 = y2 - 500:: Line -(x2, y2)
x2 = 500: y2 = 500: Line -(x2, y2)
x2 = 200: Line -(x2, y2)
y2 = y2 + 1000: Line -(x2, y2)
x2 = x2 + 500: y2 = y2 + 500:: Line -(x2, y2)
y2 = y2 + 1000: Line -(x2, y2)
x2 = x2 + 300: Line -(x2, y2)
End Sub

gracias

jimcov
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

APIS y mas APIS

Publicado por Hely (126 intervenciones) el 19/02/2006 17:42:36
Esto es copiado y pegado desde el internet USA GOOOOOOOGLE
usa una matrix de puntos que puede ser de cualquier tamaño .
averigua sobre regiones, lineas y rectangles para como dibujar con codigo.
ademas la funcin FILLRECT, FILLRGN para rellenar con color un poligo.

Private Declare Function PolyPolygon Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, lpPolyCounts As Long, ByVal nCount As Long) As Long
Private Type POINTAPI
x As Long
y As Long
End Type

Option Base 1

Private Sub Command1_Click()
' Draw a diamond and a triangle on window Form1. The two
' polygons are not interconnected and are drawn using the window's current pen
' and brush. Note how the two arrays delineate each polygon's set of vertices.
Dim points(0 To 6) As POINTAPI ' holds diamond's and triangle's vertices
Dim numpoints(0 To 1) As Long ' holds number of points belonging to each polygon
Dim retval As Long ' return value

' Load the points belonging to the diamond.
points(0).x = 200: points(0).y = 100 ' 1st point: (200,100)
points(1).x = 250: points(1).y = 150 ' 2nd point: (250,150)
points(2).x = 200: points(2).y = 200 ' 3rd point: (200,200)
points(3).x = 150: points(3).y = 150 ' 4th point: (150,150)
numpoints(0) = 4 ' first four points identify the diamond

' Load the points belonging to the triangle.
points(4).x = 350: points(4).y = 200 ' 1st point: (350,200)
points(5).x = 400: points(5).y = 250 ' 2nd point: (400,250)
points(6).x = 300: points(6).y = 250 ' 3rd point: (300,250)
numpoints(1) = 3 ' next three points identify the triangle

' Draw the two polygons
retval = PolyPolygon(Form1.hdc, points(0), numpoints(0), 2) ' two polygons

Visita mi Pagina

telnet.col.nu

Hely
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