D2Phap.DXControl 2.1.0

.NET 6.0
NuGet\Install-Package D2Phap.DXControl -Version 2.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
dotnet add package D2Phap.DXControl --version 2.1.0
<PackageReference Include="D2Phap.DXControl" Version="2.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add D2Phap.DXControl --version 2.1.0
#r "nuget: D2Phap.DXControl, 2.1.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install D2Phap.DXControl as a Cake Addin
#addin nuget:?package=D2Phap.DXControl&version=2.1.0

// Install D2Phap.DXControl as a Cake Tool
#tool nuget:?package=D2Phap.DXControl&version=2.1.0

D2Phap.DXControl

  • A WinForms hybrid control that supports both Direct2D and GDI+ drawing thanks to WicNet.
  • This control is used in ImageGlass software since version 9.0.

Nuget

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 draw by GDI+.
  • Supports animation drawing for both Direct2D and GDI+.

Requirements:

  • .NET 6.0

Installation

Run the command

Install-Package D2Phap.DXControl

Example

<img src="https://user-images.githubusercontent.com/3154213/185740243-6a3cb1b6-13e6-4888-8c57-ce8ac9998c6e.png" width="500" />

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

using D2Phap;

// create a WinForms custom control that extends from DXControl
public class DXCanvas : DXControl
{
    private RectangleF animatableRectangle = new(100, 100, 400, 200);

    public DXCanvas()
    {
        EnableAnimation = true;

        // use Direct2D
        UseHardwareAcceleration = true;
    }

    protected override void OnRender(IGraphics 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!

Product Versions
.NET net6.0-windows7.0
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • net6.0-windows7.0

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.0 33 9/24/2022
2.0.0 82 8/20/2022
1.1.0 86 8/5/2022
1.0.6 99 7/31/2022
1.0.5 82 7/31/2022
1.0.4 90 7/31/2022
1.0.3 98 7/30/2022
1.0.2 127 7/30/2022
1.0.1 141 7/30/2022
1.0.0 139 7/30/2022