Announcement

Collapse
No announcement yet.

Gdi Functions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Gdi Functions

    Hello All,

    I am developing a CAD system and therefore I have to use the Api Gdi functions. I need the whole range of curves starting from Bezier, Arc and lines. But I find that most of this functions do not work in Windows 95. This functions are listed in the Windows Api but they are not working. Can anyone throw light into this matter.

    My code is something like this

    Case %WM_PAINT

    Local Ps as PAINTSTRUCT
    HDc& = BeginPaint(CbHndl, Ps)
    ' Gdi Initialisations such as pen, Brush,...

    MoveTo HDc&, 100, 100
    LineTo HDc&, 200, 200
    ' The above draws a line from 100, 100 to 200, 200

    MoveTo HDc&, 100, 100
    AngleArc HDc&, 200, 200, 100, 0, 45
    ' As given by the documentation, this should draw an Arc
    ' But it is never drawn.

    EndPaint HDc&, Ps

    My system is a PII 333 MHz running Windows 95.

    Bye

    Anand



    -------------
    Anand Kumar
    An&

  • #2
    Anand..

    Something like this.. You are not creating a Pen to draw with..
    Code:
    CASE %WM_PAINT
    
            LOCAL Ps AS PAINTSTRUCT
            LOCAL colr1 AS LONG, colr2 AS LONG
            LOCAL hOldPen AS LONG
            colr1  = RGB(255,255,0) ' Yellow
            colr2  = RGB(0,112,255) ' Blue
    
            HDc& = BeginPaint(CBHNDL, Ps)
            ' Gdi Initialisations such as pen, Brush,...
            
            hOldPen = SelectObject(HDc&, CreatePen(%PS_SOLID, 1, colr1))
    
            MoveTo HDc&, 100, 100, BYVAL %NULL
            LineTo HDc&, 200, 200
            ' The above draws a line from 100, 100 to 200, 200
    
            DeleteObject SelectObject(HDc&, CreatePen(%PS_SOLID, 1, colr2))
            
            MoveTo HDc&, 100, 100, BYVAL %NULL
            AngleArc HDc&, 200, 200, 100, 0, 45
            ' As given by the documentation, this should draw an Arc
            ' But it is never drawn.
    
            DeleteObject SelectObject(HDc&, hOldPen)
            EndPaint HDc&, Ps
    I would also suggest that you check into PerfectSync's Graphic Tools.. It will save you a lot of hair pulling.. www.perfectsync.com


    ------------------
    Jim..
    [email protected]
    Jim..

    Comment

    Working...
    X