- texteditor.zip
- Lib
- ICSharpCode.TextEditor.dll
- LinqBridge.dll
- Src
- ICSharpCode.TextEditor
- ICSharpCode.TextEditor.sln
- Project
- Article1.cd
- Article2.cd
- Configuration
- GlobalAssemblyInfo.cs
- ICSharpCode.TextEditor.cd
- ICSharpCode.TextEditor.csproj
- ICSharpCode.TextEditor.csproj.user
- Resources
- ASPX.xshd
- BAT-Mode.xshd
- Boo.xshd
- Coco-Mode.xshd
- CPP-Mode.xshd
- CSharp-Mode.xshd
- HTML-Mode.xshd
- ICSharpCode.TextEditor.snk
- Java-Mode.xshd
- JavaScript-Mode.xshd
- Mode.xsd
- Patch-Mode.xshd
- PHP-Mode.xshd
- RightArrow.cur
- SyntaxModes.xml
- Tex-Mode.xshd
- TextEditorControl.bmp
- VBNET-Mode.xshd
- XML-Mode.xshd
- Src
- Actions
- Document
- Gui
- Undo
- Util
- Test
- TextEditor.sln
- TextEditor
|
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision: 1925 $</version>
// </file>
using System;
using System.Drawing;
using System.Windows.Forms;
namespace ICSharpCode.TextEditor
{
/// <summary>
/// Horizontal ruler - text column measuring ruler at the top of the text area.
/// </summary>
public class HRuler : Control
{
TextArea textArea;
public HRuler(TextArea textArea)
{
this.textArea = textArea;
}
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
int num = 0;
for (float x = textArea.TextView.DrawingPosition.Left; x < textArea.TextView.DrawingPosition.Right; x += textArea.TextView.WideSpaceWidth) {
int offset = (Height * 2) / 3;
if (num % 5 == 0) {
offset = (Height * 4) / 5;
}
if (num % 10 == 0) {
offset = 1;
}
++num;
g.DrawLine(Pens.Black,
(int)x, offset, (int)x, Height - offset);
}
}
protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs e)
{
e.Graphics.FillRectangle(Brushes.White,
new Rectangle(0,
0,
Width,
Height));
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.