Re: Forms

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
> >
>
>
>
.



Relevant Pages

  • Re: Simple synthetic proof of an "obvious" geometric theorem?
    ... With centre A and radius AF construct the circle passing ... with centre B and radius BG construct the (arc of the) circle ... passing through G and E and extending to I such that angle ...
    (sci.math)
  • Re: Forms
    ... The degrees for adjustment appear to be measured from horizontal ... that establishes the end of the Arc. ... Dim cTop As Long ... > Radius and I can provide the position for the centre, ...
    (microsoft.public.excel.programming)
  • Re: Forms
    ... Thank you Tom and Alok I have got it cracked now and drawing just what I wanted ... > the top of the arc being at top of the sheet). ... > Dim cTop As Long ... >> Radius and I can provide the position for the centre, ...
    (microsoft.public.excel.programming)
  • Re: how to draw an arc between two points given centre and radius
    ... The distance from the centre and each of the points define radii, and if those two radii are not equal or are not equal to the given radius, then you cannot draw a circular arc. ... You can use arctan to find the sector angle to be drawn. ...
    (comp.soft-sys.matlab)
  • Re: Need Horiz. Curve Equation for L+M and L+E
    ... specific case of the "given" being Arc Length and Middle Ordinate, ... Arc Length and External Ordinate, and the needed value being Delta ... Angle and/or Radius. ...
    (sci.engr.surveying)