Direct2D wrapper library for .NET applications.
Project | Language | Description | Output DLL |
---|---|---|---|
d2dlib | VC++ | Direct2D wrapper host side library, calling Windows SDK and Direct2D API | d2dlib.dll |
d2dlibexport | C# | Direct2D client side interface between .NET and VC++ library, calling d2dlib.dll | d2dlibexport.dll |
d2dlibexportwinform | C# | Provides the .NET classes like D2DWinForm and D2DControl that use Direct2D hardware-acceleration rendering | d2dlibwinform.dll |
- Compile every projects or use the DLLs from the binary folder directly
- Add
d2dlibexport.dll
andd2dlibwinform.dll
as your project references - Put
d2dlib.dll
in theDebug
,Release
or folder where your application runs - Make your windows form or control inherited from
D2DForm
orD2DControl
class - Override
OnRender(D2DGraphics g)
method (do not override .NETOnPaint
method) - Draw anything inside
OnRender
method via theg
context
protected override void OnRender(D2DGraphics g)
{
var ellipse = new D2DEllipse(0, 0, 10, 10);
g.DrawEllipse(ref ellipse, D2DColor.Gray);
}
g.DrawText("Hello World", D2DColor.Yellow, this.Font, 100, 200);