개정판 4913851c
issue #923: change control's color when mouse is over1
Change-Id: Id6c30459bd314a0d7d87d9c3ba037aef0db53338
MarkupToPDF/Common/CommentUserInfo.cs | ||
---|---|---|
10 | 10 |
|
11 | 11 |
namespace MarkupToPDF.Common |
12 | 12 |
{ |
13 |
//public class MyEventArgs : System.EventArgs |
|
14 |
//{ |
|
15 |
// public bool isMouseOver { get; set; } |
|
16 |
//} |
|
17 |
|
|
18 | 13 |
public class CommentUserInfo : System.Windows.Controls.Control |
19 | 14 |
{ |
20 | 15 |
public static readonly string[] delimiterChars = { "|DZ|" }; |
... | ... | |
29 | 24 |
public string SymbolID { get; set; } |
30 | 25 |
public long GroupID { get; set; } |
31 | 26 |
|
32 |
//public event EventHandler<MyEventArgs> StateChanged; |
|
27 |
private SolidColorBrush _TempBorderBrush { get; set; } |
|
28 |
private SolidColorBrush _HoverBorderBrush = new SolidColorBrush(Color.FromRgb(255, 0, 255)); |
|
33 | 29 |
|
34 | 30 |
public CommentUserInfo() |
35 | 31 |
{ |
36 |
//this.BorderThickness = new System.Windows.Thickness(5.0); |
|
37 | 32 |
this.BorderThickness = new System.Windows.Thickness(20.0); |
38 |
|
|
39 |
|
|
40 | 33 |
this.MouseEnter += CommentUserInfo_MouseEnter; |
41 | 34 |
this.MouseLeave += CommentUserInfo_MouseLeave; |
42 | 35 |
} |
... | ... | |
45 | 38 |
{ |
46 | 39 |
var temp = base.HitTestCore(hitTestParameters); |
47 | 40 |
return temp; |
48 |
//return base.HitTestCore(hitTestParameters); |
|
49 | 41 |
} |
50 | 42 |
|
51 | 43 |
private void CommentUserInfo_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e) |
52 | 44 |
{ |
53 | 45 |
this.IsMouseOver = false; |
54 |
//if (StateChanged !=null)
|
|
55 |
//{
|
|
56 |
// StateChanged(this, new MyEventArgs { isMouseOver = false });
|
|
57 |
//}
|
|
58 |
//this.Opacity = 1;
|
|
46 |
if (this.StrokeColor != null)
|
|
47 |
{ |
|
48 |
this.StrokeColor = this._TempBorderBrush;
|
|
49 |
this.UpdateLayout();
|
|
50 |
}
|
|
59 | 51 |
} |
60 | 52 |
|
61 | 53 |
private void CommentUserInfo_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e) |
62 | 54 |
{ |
63 | 55 |
this.IsMouseOver = true; |
64 |
//this.Opacity = 0.5; |
|
65 |
//if (StateChanged != null) |
|
66 |
//{ |
|
67 |
// StateChanged(this, new MyEventArgs { isMouseOver = true }); |
|
68 |
//} |
|
56 |
if (this.StrokeColor != null) |
|
57 |
{ |
|
58 |
this._TempBorderBrush = this.StrokeColor; |
|
59 |
this.StrokeColor = this._HoverBorderBrush; |
|
60 |
this.UpdateLayout(); |
|
61 |
} |
|
69 | 62 |
} |
70 | 63 |
|
71 | 64 |
/// <summary> |
... | ... | |
78 | 71 |
/// </summary> |
79 | 72 |
public virtual ControlType ControlType { get; set; } |
80 | 73 |
|
74 |
public virtual SolidColorBrush StrokeColor { get; set; } |
|
75 |
|
|
81 | 76 |
/// <summary> |
82 | 77 |
/// translate commeny by given dx, dy |
83 | 78 |
/// </summary> |
내보내기 Unified diff