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.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
public class MySplitContainer : SplitContainer
{
[DefaultValue(false)]
public Boolean DrawSmartSeparator { get; set; }
private Boolean blnIn = false;
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (DrawSmartSeparator == false) return;
try
{
if (this.SplitterWidth < 4) return;
int dotsInterval = 8;
Orientation orientation = this.Orientation;
Rectangle rctSplitter = this.SplitterRectangle;
Graphics g = e.Graphics;
PointF cntr;
PointF p1, p2, p3, p4;
if (blnIn)
{
g.FillRectangle(SystemBrushes.ControlDark, rctSplitter);
}
else
{
g.FillRectangle(SystemBrushes.Control, rctSplitter);
}
switch (orientation)
{
case Orientation.Vertical:
cntr = new PointF(rctSplitter.Left + rctSplitter.Width / (float)2, rctSplitter.Top + rctSplitter.Height / (float)2);
p1 = new PointF(cntr.X, cntr.Y - 1 * dotsInterval);
p2 = new PointF(cntr.X, cntr.Y + 1 * dotsInterval);
p3 = new PointF(cntr.X, cntr.Y - 2 * dotsInterval);
p4 = new PointF(cntr.X, cntr.Y + 2 * dotsInterval);
g.FillRectangle(SystemBrushes.ControlDarkDark, p1.X + 1, p1.Y + 1, 2, 2);
g.FillRectangle(SystemBrushes.ControlDarkDark, p2.X + 1, p2.Y + 1, 2, 2);
g.FillRectangle(SystemBrushes.ControlDarkDark, cntr.X + 1, cntr.Y + 1, 2, 2);
g.FillRectangle(SystemBrushes.ControlDarkDark, p3.X + 1, p3.Y + 1, 2, 2);
g.FillRectangle(SystemBrushes.ControlDarkDark, p4.X + 1, p4.Y + 1, 2, 2);
g.FillRectangle(SystemBrushes.ControlLightLight, p1.X, p1.Y, 2, 2);
g.FillRectangle(SystemBrushes.ControlLightLight, p2.X, p2.Y, 2, 2);
g.FillRectangle(SystemBrushes.ControlLightLight, cntr.X, cntr.Y, 2, 2);
g.FillRectangle(SystemBrushes.ControlLightLight, p3.X, p3.Y, 2, 2);
g.FillRectangle(SystemBrushes.ControlLightLight, p4.X, p4.Y, 2, 2);
break;
default:
cntr = new PointF(rctSplitter.Left + rctSplitter.Width / (float)2, rctSplitter.Top + rctSplitter.Height / (float)2);
p1 = new PointF(cntr.X - 1 * dotsInterval, cntr.Y);
p2 = new PointF(cntr.X + 1 * dotsInterval, cntr.Y);
p3 = new PointF(cntr.X - 2 * dotsInterval, cntr.Y);
p4 = new PointF(cntr.X + 2 * dotsInterval, cntr.Y);
g.FillRectangle(SystemBrushes.ControlDarkDark, p1.X + 1, p1.Y + 1, 2, 2);
g.FillRectangle(SystemBrushes.ControlDarkDark, p2.X + 1, p2.Y + 1, 2, 2);
g.FillRectangle(SystemBrushes.ControlDarkDark, cntr.X + 1, cntr.Y + 1, 2, 2);
g.FillRectangle(SystemBrushes.ControlDarkDark, p3.X + 1, p3.Y + 1, 2, 2);
g.FillRectangle(SystemBrushes.ControlDarkDark, p4.X + 1, p4.Y + 1, 2, 2);
g.FillRectangle(SystemBrushes.ControlLightLight, p1.X, p1.Y, 2, 2);
g.FillRectangle(SystemBrushes.ControlLightLight, p2.X, p2.Y, 2, 2);
g.FillRectangle(SystemBrushes.ControlLightLight, cntr.X, cntr.Y, 2, 2);
g.FillRectangle(SystemBrushes.ControlLightLight, p3.X, p3.Y, 2, 2);
g.FillRectangle(SystemBrushes.ControlLightLight, p4.X, p4.Y, 2, 2);
break;
}
}
catch { }
}
protected override void OnMouseEnter(EventArgs e)
{
base.OnMouseEnter(e);
blnIn = true;
Invalidate();
}
protected override void OnMouseLeave(EventArgs e)
{
base.OnMouseLeave(e);
blnIn = false;
Invalidate();
}
}