forked from daPhie79/ProgressODoom
-
Notifications
You must be signed in to change notification settings - Fork 1
/
RarBorderPainter.cs
61 lines (53 loc) · 1.76 KB
/
RarBorderPainter.cs
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
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
namespace ProgressODoom {
/// <summary></summary>
[ToolboxBitmapAttribute(typeof(ProgressODoom.RarBorderPainter), "Icons.RarBorderPainter.ico")]
public class RarBorderPainter : Component, IProgressBorderPainter, IDisposable {
private Pen border;
private EventHandler onPropertiesChanged;
/// <summary></summary>
public event EventHandler PropertiesChanged {
add {
if (onPropertiesChanged != null) {
foreach (Delegate d in onPropertiesChanged.GetInvocationList()) {
if (object.ReferenceEquals(d, value)) { return; }
}
}
onPropertiesChanged = (EventHandler)Delegate.Combine(onPropertiesChanged, value);
}
remove { onPropertiesChanged = (EventHandler)Delegate.Remove(onPropertiesChanged, value); }
}
private void FireChange() {
if (onPropertiesChanged != null) { onPropertiesChanged(this, EventArgs.Empty); }
}
/// <summary></summary>
public RarBorderPainter() {
border = new Pen(new SolidBrush(Color.FromArgb(064, 064, 070)), 1f);
}
/// <summary></summary>
[Browsable(false)]
public int BorderWidth {
get { return 1; }
}
/// <summary></summary>
/// <param name="box"></param>
/// <param name="g"></param>
public void PaintBorder(Rectangle box, Graphics g) {
g.DrawRectangle(new Pen(new SolidBrush(SystemColors.Control), 1f), 0, 0, box.Width, box.Height);
g.DrawLine(border, 2, box.Height, box.Width, box.Height);
g.DrawLine(border, box.Width, 3, box.Width, box.Height);
}
/// <summary></summary>
public void Resize(Rectangle box) {
}
/// <summary></summary>
protected override void Dispose(bool disposing) {
base.Dispose(disposing);
border.Dispose();
}
}
}