Skip to content

Commit 7e664e9

Browse files
authored
Add files via upload
1 parent ccbb0e1 commit 7e664e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+10026
-0
lines changed

App.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
</configuration>

ElipseControl.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Drawing;
5+
using System.Linq;
6+
using System.Runtime.InteropServices;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
using System.Windows.Forms;
10+
11+
namespace ElipseToolDemo
12+
{
13+
class ElipseControl : Component
14+
{
15+
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
16+
private static extern IntPtr CreateRoundRectRgn
17+
(
18+
int nLeftRect,
19+
int nTopRect,
20+
int nRightRect,
21+
int nBottomRect,
22+
int nWidthEllipse,
23+
int nHeightEllipse
24+
);
25+
private Control? _cntrl;
26+
private int _CornerRadius = 30;
27+
28+
public Control TargetControl
29+
{
30+
get { return _cntrl; }
31+
set
32+
{
33+
_cntrl = value;
34+
_cntrl.SizeChanged += (sender, eventArgs) => _cntrl.Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, _cntrl.Width, _cntrl.Height, _CornerRadius, _CornerRadius));
35+
}
36+
}
37+
38+
public int CornerRadius
39+
{
40+
get { return _CornerRadius; }
41+
set
42+
{
43+
_CornerRadius = value;
44+
if (_cntrl != null)
45+
_cntrl.Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, _cntrl.Width, _cntrl.Height, _CornerRadius, _CornerRadius));
46+
}
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)