C# Class VietOCR.NET.Controls.CustomPaintTextBox

This is the class that handles painting the wavy red lines. It utilizes the NativeWindow to find out when it needs to draw
Inheritance: System.Windows.Forms.NativeWindow, IDisposable
Show file Open project: nguyenq/VietOCR3.NET

Public Methods

Method Description
CustomPaintTextBox ( TextBoxBase clientTextBox, SpellCheckHelper speller ) : System
Dispose ( ) : void
ForcePaint ( ) : void

The textbox is not redrawn much, so this will force the textbox to call the custom paint function. Otherwise, text can be entered and no wavy red lines will appear

Protected Methods

Method Description
Dispose ( bool disposing ) : void
WndProc ( System &m ) : void

This is called when the textbox is being redrawn. When it is, for the textbox to get refreshed, call its default paint method and then call our method

Private Methods

Method Description
CustomPaint ( ) : void

Gets the ranges of chars that represent the spelling errors and then draw a wavy red line underneath them.

DrawWave ( Point start, Point end ) : void

Draws the wavy red line given a starting point and an ending point

GetOffsets ( TextBoxBase &curTextBox, int startingIndex, int endingIndex, System.Windows.Forms.RichTextBox tempRTB ) : Point

Determines the X and Y offsets to use based on font height last letter width

TextBoxBase_ClientSizeChanged ( object sender, System e ) : void

When the TextBoxBase is resized, this will reset the objects that are used to draw the wavy, red line. Without this, anything outside of the original bounds will not be drawn

TextBoxBase_HandleCreated ( object sender, System e ) : void

Reassign this classes handle and the graphics object anytime the textbox's handle is changed

Method Details

CustomPaintTextBox() public method

public CustomPaintTextBox ( TextBoxBase clientTextBox, SpellCheckHelper speller ) : System
clientTextBox System.Windows.Forms.TextBoxBase
speller SpellCheckHelper
return System

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

ForcePaint() public method

The textbox is not redrawn much, so this will force the textbox to call the custom paint function. Otherwise, text can be entered and no wavy red lines will appear
public ForcePaint ( ) : void
return void

WndProc() protected method

This is called when the textbox is being redrawn. When it is, for the textbox to get refreshed, call its default paint method and then call our method
protected WndProc ( System &m ) : void
m System The windows message
return void