From: crazy on

I have crazy ideas but I am no good at drawing nor at VB. Is it
feasible to draw a simple tulip with Line commands? Or define a
few curves and draw them by very short lines? Still better if I
could colour the sketch. Has someone tried to draw simple things
in VB?
From: Mike Williams on
"crazy" <no.one(a)no.addr.org> wrote in message news:e9813q$am0(a)aton.abo.fi...

> I have crazy ideas but I am no good at drawing nor at VB. Is
> it feasible to draw a simple tulip with Line commands? Or define
> a few curves and draw them by very short lines? Still better if
> I could colour the sketch. Has someone tried to draw simple
> things in VB?

I'm not sure exactly what you're after, but here's a start if you just want
to draw using the mouse:

Mike

Option Explicit
Private drawing As Boolean
Private x1 As Single, y1 As Single

Private Sub Form_MouseDown(Button As Integer, _
Shift As Integer, X As Single, Y As Single)
drawing = True
x1 = X
y1 = Y
PSet (X, Y)
End Sub

Private Sub Form_MouseMove(Button As Integer, _
Shift As Integer, X As Single, Y As Single)
If drawing Then
Line -(X, Y)
End If
End Sub

Private Sub Form_MouseUp(Button As Integer, _
Shift As Integer, X As Single, Y As Single)
x1 = X
y1 = Y
drawing = False
End Sub


From: crazy on
In article <e985ct$dsc$1(a)emma.aioe.org>,
Mike Williams <Mike(a)WhiskyAndCoke.com> wrote:
>"crazy" <no.one(a)no.addr.org> wrote in message news:e9813q$am0(a)aton.abo.fi...
>
>> I have crazy ideas but I am no good at drawing nor at VB. Is
>> it feasible to draw a simple tulip with Line commands? Or define
>> a few curves and draw them by very short lines? Still better if
>> I could colour the sketch. Has someone tried to draw simple
>> things in VB?
>
>I'm not sure exactly what you're after, but here's a start if you just want
>to draw using the mouse:
>
>Mike


What I mean is that a VB code
would draw the curves on its own based
on predefined curves, not manually
with a mouse like in Paint.


I can start from
scratch and build up all that is
needed, but if someone has already
done a lot of work on this, I
need not reinvent the wheel.



From: Mike Williams on

crazy wrote:

> What I mean is that a VB code
> would draw the curves on its own based
> on predefined curves, not manually
> with a mouse like in Paint.

You can draw lines in the standard "pixel drawing" way (as in Paint) or
as components of a metafile (as in Corel Draw). But if, as you say,
you're no good at drawing then how are you going to define the lines
and curves to make up your drawing of a tulip? Do you mean you're
looking for some VB code that already knows what a tulip looks like?

Mike

From: David Youngblood on
"crazy" <no.one(a)no.addr.org> wrote...
>
> What I mean is that a VB code
> would draw the curves on its own based
> on predefined curves, not manually
> with a mouse like in Paint.

You might take a look at the Polyline and Polygon API's. The difference between
the two is that the Polygon draws a closed figure, while Polyline draws an open
figure. You specify the points and these APIs connect the dots.

Private Declare Function Polygon Lib "gdi32" ( _
ByVal hdc As Long, _
lpPoint As POINTAPI, _
ByVal nCount As Long) As Long

Private Type POINTAPI
X As Long
Y As Long
End Type

Private Sub Form_Load()

Dim atPoints(0 To 7) As POINTAPI

Me.AutoRedraw = True
Me.FillColor = vbRed
Me.FillStyle = vbSolid

'* POINTAPI array used to draw lightning bolt polygon
atPoints(0).X = 23
atPoints(0).Y = 12
atPoints(1).X = 15
atPoints(1).Y = 42
atPoints(2).X = 23
atPoints(2).Y = 41
atPoints(3).X = 15
atPoints(3).Y = 80
atPoints(4).X = 38
atPoints(4).Y = 32
atPoints(5).X = 30
atPoints(5).Y = 33
atPoints(6).X = 38
atPoints(6).Y = 12
atPoints(7).X = 23
atPoints(7).Y = 12

'* Draw the lightning bolt
Call Polygon(Me.hdc, atPoints(0), 8)

End Sub