Re: Forms
- From: "PraxisPete" <PraxisPete@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 25 May 2005 06:25:45 -0700
Thank you for your comments Tom,
I have found this code which meets my requirements i.e. has an argument for
Radius and I can provide the position for the centre, start angle and sweep
angle, this would be perfect. Is there anyway this can run, or is there a
similar tool or addin ?
Thanks in anticipation
Declare Function AngleArc Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As
Long,
ByVal y As Long, ByVal dwRadius As Long, ByVal eStartAngle As Single, ByVal
eSweepAngle As Single) As Long
' Draw an arc formed by the upper half of a circle (from 0 to 180
' degrees counterclockwise). The circle is centered at (100, 150) and has a
radius
' of 50. The arc is drawn using the solid black stock pen.
Dim hpen As Long ' handle to the black stock pen
Dim holdpen As Long ' handle to Form1's previously selected pen
Dim retval As Long ' return value
' Get the solid black stock pen and select it for use in Form1.
hpen = GetStockObject(BLACK_PEN) ' get the pen's handle
holdpen = SelectObject(Form1.hDC, hpen) ' select the pen
' Make sure arcs are drawn going counterclockwise
retval = SetArcDirection(Form1.hDC, AD_COUNTERCLOCKWISE)
' Draw the arc
retval = AngleArc(Form1.hDC, 100, 150, 50, 0, 180)
' Select Form1's previous pen to restore the "defaults".
retval = SelectObject(Form1.hDC, holdpen) ' select the old pen
"Tom Ogilvy" wrote:
> That code is for VB the language, where the work is done on a form.
>
> I don't see any argument on it to specify a radius, so I would go back to
> the code offered previously and see if you can't figure out how to translate
> the parameters you have into the parameters you need.
>
> --
> Regards,
> Tom Ogilvy
>
>
>
> "PraxisPete" <PraxisPete@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:00FC96EF-CEC7-49D3-B6D0-A7EB7209517E@xxxxxxxxxxxxxxxx
> > Hi Everybody, I am using Excel 2002 and I have only been using vb for a
> short
> > while
> >
> > I need to draw arcs and I have Pick-up this code on the net which does not
> > run. The error is Run-time error '424': Object required. I think its some
> > thing to do with Form1 but I do not understand about Forms and I cannot
> find
> > anything about forms in my ref books apart from Userforms.
> >
> > Can somebody please explain?
> >
> > Many Thanks
> >
> > Private Declare Function Arc Lib "gdi32" (ByVal hdc As Long, ByVal X1 As
> > Long, _
> > ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long,
> > ByVal Y3 As Long, _
> > ByVal X4 As Long, ByVal Y4 As Long) As Long
> >
> >
> > Private Sub Form_Load()
> > Dim rval As Long
> > 'play about with the values
> > rval = Arc(Form1.hdc, 100, 450, 300, 10, 250, 100, 100, 150)
> >
> > End Sub
> >
>
>
>
.
- Prev by Date: Re: Format of Variable
- Next by Date: Re: Combining Data in Multiple Cells
- Previous by thread: Re: Forms
- Next by thread: Re: Forms
- Index(es):
Relevant Pages
|