Skip to content

Commit fb0bd3a

Browse files
committed
bump version and update readme
1 parent 0ee44cf commit fb0bd3a

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

README.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# D2Phap.DXControl
22

3-
- A WinForms hybrid control that supports Direct2D and GDI+ drawing thanks to [DirectN](https://github.com/smourier/DirectN) and [WicNet](https://github.com/smourier/WicNet).
3+
- A WinForms hybrid control that supports both Direct2D and GDI+ drawing thanks to [WicNet](https://github.com/smourier/WicNet).
44
- This control is used in [ImageGlass](https://github.com/d2phap/ImageGlass) software since version 9.0.
55

66
![Nuget](https://img.shields.io/nuget/dt/D2Phap.DXControl?color=%2300a8d6&logo=nuget)
@@ -30,18 +30,19 @@ Install-Package D2Phap.DXControl
3030

3131

3232
## Example
33-
Draw 2 rectangles by Direct2D and GDI+ graphics, then animate it to the right side.
3433

35-
<img src="https://user-images.githubusercontent.com/3154213/181906424-27418cfd-5f41-4380-8ae9-0ea577c91b16.png" width="500" />
3634

35+
<img src="https://user-images.githubusercontent.com/3154213/185740243-6a3cb1b6-13e6-4888-8c57-ce8ac9998c6e.png" width="500" />
36+
37+
Draws a rectangle, then moves it to the right side.
3738

3839
```cs
3940
using D2Phap;
4041

4142
// create a WinForms custom control that extends from DXControl
4243
public class DXCanvas : DXControl
4344
{
44-
private D2D_RECT_F animatableRectangle = new(100f, 100f, new(400, 200));
45+
private RectangleF animatableRectangle = new(100, 100, 400, 200);
4546

4647
public DXCanvas()
4748
{
@@ -51,21 +52,11 @@ public class DXCanvas : DXControl
5152
UseHardwareAcceleration = true;
5253
}
5354

54-
// use Direct2D graphics
55-
protected override void OnDirect2DRender(DXGraphics g)
56-
{
57-
// draw a yellow rectangle with green border
58-
g.FillRectangle(rectText, _D3DCOLORVALUE.FromCOLORREF(_D3DCOLORVALUE.Yellow.Int32Value, 100));
59-
g.DrawRectangle(rectText, _D3DCOLORVALUE.Green);
60-
}
61-
62-
63-
// Use GDI+ graphics
64-
protected override void OnGdiPlusRender(Graphics g)
55+
protected override void OnRender(IGraphics g)
6556
{
6657
// draw a yellow rectangle with green border
67-
using var pen = new Pen(Color.Red, 5);
68-
g.DrawRectangle(pen, new Rectangle((int)rectText.left, (int)rectText.top - 50, (int)rectText.Width, (int)rectText.Height));
58+
g.FillRectangle(rectText, Color.FromArgb(100, Yellow));
59+
g.DrawRectangle(rectText, Color.Green);
6960
}
7061

7162

Source/DXControl/D2Phap.DXControl.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<IncludeSymbols>True</IncludeSymbols>
2121
<PackageReleaseNotes></PackageReleaseNotes>
2222
<Authors>Duong Dieu Phap</Authors>
23-
<VersionPrefix>1.1.0</VersionPrefix>
23+
<VersionPrefix>2.0.0</VersionPrefix>
2424
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
2525
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2626
<EmbedUntrackedSources>true</EmbedUntrackedSources>

0 commit comments

Comments
 (0)