Code Coverage Statistics for Source File
c:\Tools\SD3\src\Libraries\ICSharpCode.TextEditor\Project\Src\Gui\HRuler.cs
|
Sequence Point Coverage
N/A
0 of 0
|
Branch Coverage
N/A
0 of 0
|
Lines
54
|
Highlight:
Uncovered Code
Covered Code
| L | V | Source |
|---|---|---|
1 |
// <file> |
|
2 |
// <copyright see="prj:///doc/copyright.txt"/> |
|
3 |
// <license see="prj:///doc/license.txt"/> |
|
4 |
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/> |
|
5 |
// <version>$Revision: 1925 $</version> |
|
6 |
// </file> |
|
7 |
||
8 |
using System; |
|
9 |
using System.Drawing; |
|
10 |
using System.Windows.Forms; |
|
11 |
||
12 |
namespace ICSharpCode.TextEditor |
|
13 |
{ |
|
14 |
/// <summary> |
|
15 |
/// Horizontal ruler - text column measuring ruler at the top of the text area. |
|
16 |
/// </summary> |
|
17 |
public class HRuler : Control |
|
18 |
{ |
|
19 |
TextArea textArea; |
|
20 |
||
21 |
public HRuler(TextArea textArea) |
|
22 |
{ |
|
23 |
this.textArea = textArea; |
|
24 |
} |
|
25 |
||
26 |
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) |
|
27 |
{ |
|
28 |
Graphics g = e.Graphics; |
|
29 |
int num = 0; |
|
30 |
for (float x = textArea.TextView.DrawingPosition.Left; x < textArea.TextView.DrawingPosition.Right; x += textArea.TextView.WideSpaceWidth) { |
|
31 |
int offset = (Height * 2) / 3; |
|
32 |
if (num % 5 == 0) { |
|
33 |
offset = (Height * 4) / 5; |
|
34 |
} |
|
35 |
||
36 |
if (num % 10 == 0) { |
|
37 |
offset = 1; |
|
38 |
} |
|
39 |
++num; |
|
40 |
g.DrawLine(Pens.Black, |
|
41 |
(int)x, offset, (int)x, Height - offset); |
|
42 |
} |
|
43 |
} |
|
44 |
||
45 |
protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs e) |
|
46 |
{ |
|
47 |
e.Graphics.FillRectangle(Brushes.White, |
|
48 |
new Rectangle(0, |
|
49 |
0, |
|
50 |
Width, |
|
51 |
Height)); |
|
52 |
} |
|
53 |
} |
|
54 |
} |