Re: Afficher un DXF en utilisant GDI+ et DotNet

Posté par Anonyme le 21/4/2006 20:39:52
Voici la solution :

GdiplusStartupInput is structure
    GdiplusVersion is int           // Must be 1
    DebugEventCallback is int       // Ignored on free builds
    SuppressBackgroundThread is int // FALSE unless you're prepared to call
                                    // the hook/unhook functions properly
    SuppressExternalCodecs is int   // FALSE unless you want GDI+ only to use
                                    // its internal image codecs.
END

hDLL is int = ChargeDLL("gdiplus.dll")
 
GSI is GdiplusStartupInput
GSI:GdiplusVersion = 1
hGDIplus is int 
IF API("gdiplus", "GdiplusStartup", &hGDIplus, &GSI, Null) = 0 THEN 
    nGraphics is 4-byte unsigned int
    nBrush is 4-byte unsigned int
    Hwnd is int = Handle(IMG_GRAPH)
    hDC is int = dDébutDessin(IMG_GRAPH, dSansEffacer)
 
    nRet is int = API("gdiplus", "GdipCreateFromHDC", hDC, &nGraphics)
    nARGB is 4-byte unsigned int = 0xFFFF0000
    nRet = API("gdiplus", "GdipCreateSolidFill", nARGB, &nBrush)
    nRet = API("gdiplus", "GdipFillRectangleI", nGraphics, nBrush, 1, 1, 500, 500)
    nRet = API("gdiplus", "GdipDeleteBrush", nBrush)
    nRet = API("gdiplus", "GdipDeleteGraphics", nGraphics)
 
    UpdateWindow(Hwnd)
 
    API("gdiplus", "GdiplusShutdown", hGDIplus)
END


Note : comme le code n'est pas réellement compilé,
ne vous attendez pas à des miracles du point de vue de la vitesse.

Cette contribution était de : http://old.wdforge.org/newbb/viewtopic.php?forum=17&topic_id=3838&post_id=16325