Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

πŸ–ŒοΈ A WinForms hybrid control that supports Direct2D drawing

License

Notifications You must be signed in to change notification settings

d2phap/DXControl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

103 Commits

Repository files navigation

D2Phap.DXControl

  • A WinForms control that supports drawing with Direct2D thanks to WicNet.
  • This control has been used in ImageGlass software since version 9.0.

Nuget

Resource links

Features

  • High performance drawing using Direct2D.
  • Names and types are exactly the same as the native concepts of Direct2D (interfaces, enums, structures, constants, methods, arguments, guids, etc...). So you can read the official documentation, use existing C/C++ samples, and start coding with .NET right away.
  • All native COM interfaces are generated as .NET (COM) interfaces, this makes .NET programming easier, but they are not strictly needed.
  • Option to use Software or Hardware render target
  • Supports animation drawing with Direct2D.

Requirements:

  • .NET 8.0, 9.0

Installation

Run the command

Install-Package D2Phap.DXControl

Example

Draws a rectangle, then moves it to the right side.

using D2Phap.DXControl;
// create a WinForms custom control that extends from DXCanvas
public class DemoCanvas : DXCanvas
{
 private RectangleF animatableRectangle = new(100, 100, 400, 200);
 public DemoCanvas()
 {
 EnableAnimation = true;
 UseHardwareAcceleration = true;
 }
 protected override void OnRender(DXGraphics g)
 {
 // draw a yellow rectangle with green border
 g.FillRectangle(rectText, Color.FromArgb(100, Yellow));
 g.DrawRectangle(rectText, Color.Green);
 }
 // Update frame logics for animation
 protected override void OnFrame(FrameEventArgs e)
 {
 // animate the rectangle to the right
 animatableRectangle.left++;
 }
}

See Demo project for full details.

License

MIT

Support this project

Thanks for your gratitude and finance help!

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /