-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectableFlowLayoutPanel.cs
More file actions
44 lines (38 loc) · 1.19 KB
/
Copy pathSelectableFlowLayoutPanel.cs
File metadata and controls
44 lines (38 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace DropResize
{
public class SelectableFlowLayoutPanel : FlowLayoutPanel
{
private Rectangle selectionRectangle;
public SelectableFlowLayoutPanel()
{
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true);
}
public Rectangle SelectionRectangle
{
get { return selectionRectangle; }
set
{
selectionRectangle = value;
Invalidate();
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (selectionRectangle.Width <= 0 || selectionRectangle.Height <= 0)
{
return;
}
using (var brush = new SolidBrush(Color.FromArgb(40, 51, 153, 255)))
using (var pen = new Pen(Color.FromArgb(80, 120, 200)))
{
pen.DashStyle = DashStyle.Dash;
e.Graphics.FillRectangle(brush, selectionRectangle);
e.Graphics.DrawRectangle(pen, selectionRectangle);
}
}
}
}