C# Класс BrightIdeasSoftware.BaseRenderer

Наследование: AbstractRenderer
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
ClearState void

Открытые методы

Метод Описание
ApplyCellPadding ( Rectangle r ) : Rectangle

Change the bounds of the given rectangle to take any cell padding into account

DrawText ( Graphics g, Rectangle r, String txt ) : void

Draw the given text and optional image in the "normal" fashion

GetBackgroundColor ( ) : Color

Return the Color that is the background color for this item's cell

GetEditRectangle ( Graphics g, Rectangle cellBounds, BrightIdeasSoftware.OLVListItem item, int subItemIndex, Size preferredSize ) : Rectangle

Calculate the edit rectangle

GetForegroundColor ( ) : Color

Return the color to be used for text in this cell

HitTest ( BrightIdeasSoftware.OlvListViewHitTestInfo hti, int x, int y ) : void

Calculate which part of this cell was hit

OptionalRender ( Graphics g, Rectangle r ) : bool

Draw our data into the given rectangle using the given graphics context.

Subclasses should override this method.

Render ( Graphics g, Rectangle r ) : void

Draw our data into the given rectangle using the given graphics context.

Subclasses should override this method if they never want to fall back on the default processing

RenderItem ( DrawListViewItemEventArgs e, Graphics g, Rectangle itemBounds, object rowObject ) : bool

Render the whole item in a non-details view.

RenderSubItem ( DrawListViewSubItemEventArgs e, Graphics g, Rectangle cellBounds, object rowObject ) : bool

Render one cell

Защищенные методы

Метод Описание
AlignHorizontally ( Rectangle outer, Rectangle inner ) : int

Calculate the left edge of the rectangle that aligns the outer rectangle with the inner one according to this renderer's horizontal alignement

AlignRectangle ( Rectangle outer, Rectangle inner ) : Rectangle

Align the second rectangle with the first rectangle, according to the alignment of the column

AlignVertically ( Rectangle outer, Rectangle inner ) : int

Calculate the top of the rectangle that aligns the outer rectangle with the inner rectangle according to this renders vertical alignment

AlignVertically ( Rectangle outer, int innerHeight ) : int

Calculate the top of the rectangle that aligns the outer rectangle with a rectangle of the given height according to this renderer's vertical alignment

CalculateAlignedRectangle ( Graphics g, Rectangle r ) : Rectangle

Calculate the space that our rendering will occupy and then align that space with the given rectangle, according to the Column alignment

CalculateCheckBoxBounds ( Graphics g, Rectangle cellBounds ) : Rectangle
CalculateCheckBoxWidth ( Graphics g ) : int

How much space will the check box for this cell occupy?

Only column 0 can have check boxes. Sub item checkboxes are treated as images

CalculateImageWidth ( Graphics g, object imageSelector ) : int

How much horizontal space will the image of this cell occupy?

CalculatePaddedAlignedBounds ( Graphics g, Rectangle bounds, Size preferredSize ) : Rectangle
CalculateTextWidth ( Graphics g, string txt ) : int

How much horizontal space will the text of this cell occupy?

DrawAlignedImage ( Graphics g, Rectangle r, Image image ) : void

Draw the given image aligned horizontally within the column.

Over tall images are scaled to fit. Over-wide images are truncated. This is by design!

DrawAlignedImageAndText ( Graphics g, Rectangle r ) : void

Draw our subitems image and text

DrawBackground ( Graphics g, Rectangle r ) : void

Fill in the background of this cell

DrawCheckBox ( Graphics g, Rectangle r ) : int

Draw the check box of this row

DrawImage ( Graphics g, Rectangle r, Object imageSelector ) : int

Draw the given text and optional image in the "normal" fashion

DrawImageAndText ( Graphics g, Rectangle r ) : void

Draw our subitems image and text

DrawImages ( Graphics g, Rectangle r, ICollection imageSelectors ) : int

Draw the given collection of image selectors

DrawTextGdi ( Graphics g, Rectangle r, String txt ) : void

Print the given text in the given rectangle using only GDI routines

The native list control uses GDI routines to do its drawing, so using them here makes the owner drawn mode looks more natural.

This method doesn't honour the CanWrap setting on the renderer. All text is single line

DrawTextGdiPlus ( Graphics g, Rectangle r, String txt ) : void

Print the given text in the given rectangle using normal GDI+ .NET methods

Printing to a printer dc has to be done using this method.

GetCheckBoxState ( CheckState checkState ) : CheckBoxState

Calculate the renderer checkboxstate we need to correctly draw the given state

GetImage ( ) : Image

Return the image that should be drawn against this subitem

GetImage ( Object imageSelector ) : Image

Return the actual image that should be drawn when keyed by the given image selector. An image selector can be: an int, giving the index into the image list a string, giving the image key into the image list an Image, being the image itself

GetImageSelector ( ) : Object

GetText ( ) : string

Return the string that should be drawn within this

GetTextBackgroundColor ( ) : Color

Return the Color that is the background color for this item's text

HandleGetEditRectangle ( Graphics g, Rectangle cellBounds, BrightIdeasSoftware.OLVListItem item, int subItemIndex, Size preferredSize ) : Rectangle

Handle a HitTest request after all state information has been initialized

HandleHitTest ( Graphics g, BrightIdeasSoftware.OlvListViewHitTestInfo hti, int x, int y ) : void

Do the actual work of hit testing. Subclasses should override this rather than HitTest()

StandardGetEditRectangle ( Graphics g, Rectangle cellBounds, Size preferredSize ) : Rectangle

This method calculates the bounds of the text within a standard layout (i.e. optional checkbox, optional image, text)

This method only works correctly if the state of the renderer has been fully initialized (see BaseRenderer.GetEditRectangle)

StandardHitTest ( Graphics g, BrightIdeasSoftware.OlvListViewHitTestInfo hti, Rectangle bounds, int x, int y ) : void

Perform normal hit testing relative to the given bounds

StandardRender ( Graphics g, Rectangle r ) : void

Draw the standard "[checkbox] [image] [text]" cell after the state properties have been initialized.

Приватные методы

Метод Описание
ClearState ( ) : void

Описание методов

AlignHorizontally() защищенный Метод

Calculate the left edge of the rectangle that aligns the outer rectangle with the inner one according to this renderer's horizontal alignement
protected AlignHorizontally ( Rectangle outer, Rectangle inner ) : int
outer System.Drawing.Rectangle
inner System.Drawing.Rectangle
Результат int

AlignRectangle() защищенный Метод

Align the second rectangle with the first rectangle, according to the alignment of the column
protected AlignRectangle ( Rectangle outer, Rectangle inner ) : Rectangle
outer System.Drawing.Rectangle The cell's bounds
inner System.Drawing.Rectangle The rectangle to be aligned within the bounds
Результат System.Drawing.Rectangle

AlignVertically() защищенный Метод

Calculate the top of the rectangle that aligns the outer rectangle with the inner rectangle according to this renders vertical alignment
protected AlignVertically ( Rectangle outer, Rectangle inner ) : int
outer System.Drawing.Rectangle
inner System.Drawing.Rectangle
Результат int

AlignVertically() защищенный Метод

Calculate the top of the rectangle that aligns the outer rectangle with a rectangle of the given height according to this renderer's vertical alignment
protected AlignVertically ( Rectangle outer, int innerHeight ) : int
outer System.Drawing.Rectangle
innerHeight int
Результат int

ApplyCellPadding() публичный Метод

Change the bounds of the given rectangle to take any cell padding into account
public ApplyCellPadding ( Rectangle r ) : Rectangle
r System.Drawing.Rectangle
Результат System.Drawing.Rectangle

CalculateAlignedRectangle() защищенный Метод

Calculate the space that our rendering will occupy and then align that space with the given rectangle, according to the Column alignment
protected CalculateAlignedRectangle ( Graphics g, Rectangle r ) : Rectangle
g System.Drawing.Graphics
r System.Drawing.Rectangle
Результат System.Drawing.Rectangle

CalculateCheckBoxBounds() защищенный Метод

protected CalculateCheckBoxBounds ( Graphics g, Rectangle cellBounds ) : Rectangle
g System.Drawing.Graphics
cellBounds System.Drawing.Rectangle
Результат System.Drawing.Rectangle

CalculateCheckBoxWidth() защищенный Метод

How much space will the check box for this cell occupy?
Only column 0 can have check boxes. Sub item checkboxes are treated as images
protected CalculateCheckBoxWidth ( Graphics g ) : int
g System.Drawing.Graphics
Результат int

CalculateImageWidth() защищенный Метод

How much horizontal space will the image of this cell occupy?
protected CalculateImageWidth ( Graphics g, object imageSelector ) : int
g System.Drawing.Graphics
imageSelector object
Результат int

CalculatePaddedAlignedBounds() защищенный Метод

protected CalculatePaddedAlignedBounds ( Graphics g, Rectangle bounds, Size preferredSize ) : Rectangle
g System.Drawing.Graphics
bounds System.Drawing.Rectangle
preferredSize System.Drawing.Size
Результат System.Drawing.Rectangle

CalculateTextWidth() защищенный Метод

How much horizontal space will the text of this cell occupy?
protected CalculateTextWidth ( Graphics g, string txt ) : int
g System.Drawing.Graphics
txt string
Результат int

DrawAlignedImage() защищенный Метод

Draw the given image aligned horizontally within the column.
Over tall images are scaled to fit. Over-wide images are truncated. This is by design!
protected DrawAlignedImage ( Graphics g, Rectangle r, Image image ) : void
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
image Image The image to be drawn
Результат void

DrawAlignedImageAndText() защищенный Метод

Draw our subitems image and text
protected DrawAlignedImageAndText ( Graphics g, Rectangle r ) : void
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
Результат void

DrawBackground() защищенный Метод

Fill in the background of this cell
protected DrawBackground ( Graphics g, Rectangle r ) : void
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
Результат void

DrawCheckBox() защищенный Метод

Draw the check box of this row
protected DrawCheckBox ( Graphics g, Rectangle r ) : int
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
Результат int

DrawImage() защищенный Метод

Draw the given text and optional image in the "normal" fashion
protected DrawImage ( Graphics g, Rectangle r, Object imageSelector ) : int
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
imageSelector Object The optional image to be drawn
Результат int

DrawImageAndText() защищенный Метод

Draw our subitems image and text
protected DrawImageAndText ( Graphics g, Rectangle r ) : void
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
Результат void

DrawImages() защищенный Метод

Draw the given collection of image selectors
protected DrawImages ( Graphics g, Rectangle r, ICollection imageSelectors ) : int
g System.Drawing.Graphics
r System.Drawing.Rectangle
imageSelectors ICollection
Результат int

DrawText() публичный Метод

Draw the given text and optional image in the "normal" fashion
public DrawText ( Graphics g, Rectangle r, String txt ) : void
g System.Drawing.Graphics Graphics context to use for drawing
r System.Drawing.Rectangle Bounds of the cell
txt String The string to be drawn
Результат void

DrawTextGdi() защищенный Метод

Print the given text in the given rectangle using only GDI routines
The native list control uses GDI routines to do its drawing, so using them here makes the owner drawn mode looks more natural.

This method doesn't honour the CanWrap setting on the renderer. All text is single line

protected DrawTextGdi ( Graphics g, Rectangle r, String txt ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
txt String
Результат void

DrawTextGdiPlus() защищенный Метод

Print the given text in the given rectangle using normal GDI+ .NET methods
Printing to a printer dc has to be done using this method.
protected DrawTextGdiPlus ( Graphics g, Rectangle r, String txt ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
txt String
Результат void

GetBackgroundColor() публичный Метод

Return the Color that is the background color for this item's cell
public GetBackgroundColor ( ) : Color
Результат Color

GetCheckBoxState() защищенный Метод

Calculate the renderer checkboxstate we need to correctly draw the given state
protected GetCheckBoxState ( CheckState checkState ) : CheckBoxState
checkState CheckState
Результат CheckBoxState

GetEditRectangle() публичный Метод

Calculate the edit rectangle
public GetEditRectangle ( Graphics g, Rectangle cellBounds, BrightIdeasSoftware.OLVListItem item, int subItemIndex, Size preferredSize ) : Rectangle
g System.Drawing.Graphics
cellBounds System.Drawing.Rectangle
item BrightIdeasSoftware.OLVListItem
subItemIndex int
preferredSize System.Drawing.Size
Результат System.Drawing.Rectangle

GetForegroundColor() публичный Метод

Return the color to be used for text in this cell
public GetForegroundColor ( ) : Color
Результат Color

GetImage() защищенный Метод

Return the image that should be drawn against this subitem
protected GetImage ( ) : Image
Результат Image

GetImage() защищенный Метод

Return the actual image that should be drawn when keyed by the given image selector. An image selector can be: an int, giving the index into the image list a string, giving the image key into the image list an Image, being the image itself
protected GetImage ( Object imageSelector ) : Image
imageSelector Object The value that indicates the image to be used
Результат Image

GetImageSelector() защищенный Метод

protected GetImageSelector ( ) : Object
Результат Object

GetText() защищенный Метод

Return the string that should be drawn within this
protected GetText ( ) : string
Результат string

GetTextBackgroundColor() защищенный Метод

Return the Color that is the background color for this item's text
protected GetTextBackgroundColor ( ) : Color
Результат Color

HandleGetEditRectangle() защищенный Метод

Handle a HitTest request after all state information has been initialized
protected HandleGetEditRectangle ( Graphics g, Rectangle cellBounds, BrightIdeasSoftware.OLVListItem item, int subItemIndex, Size preferredSize ) : Rectangle
g System.Drawing.Graphics
cellBounds System.Drawing.Rectangle
item BrightIdeasSoftware.OLVListItem
subItemIndex int
preferredSize System.Drawing.Size
Результат System.Drawing.Rectangle

HandleHitTest() защищенный Метод

Do the actual work of hit testing. Subclasses should override this rather than HitTest()
protected HandleHitTest ( Graphics g, BrightIdeasSoftware.OlvListViewHitTestInfo hti, int x, int y ) : void
g System.Drawing.Graphics
hti BrightIdeasSoftware.OlvListViewHitTestInfo
x int
y int
Результат void

HitTest() публичный Метод

Calculate which part of this cell was hit
public HitTest ( BrightIdeasSoftware.OlvListViewHitTestInfo hti, int x, int y ) : void
hti BrightIdeasSoftware.OlvListViewHitTestInfo
x int
y int
Результат void

OptionalRender() публичный Метод

Draw our data into the given rectangle using the given graphics context.

Subclasses should override this method.

public OptionalRender ( Graphics g, Rectangle r ) : bool
g System.Drawing.Graphics The graphics context that should be used for drawing
r System.Drawing.Rectangle The bounds of the subitem cell
Результат bool

Render() публичный Метод

Draw our data into the given rectangle using the given graphics context.

Subclasses should override this method if they never want to fall back on the default processing

public Render ( Graphics g, Rectangle r ) : void
g System.Drawing.Graphics The graphics context that should be used for drawing
r System.Drawing.Rectangle The bounds of the subitem cell
Результат void

RenderItem() публичный Метод

Render the whole item in a non-details view.
public RenderItem ( DrawListViewItemEventArgs e, Graphics g, Rectangle itemBounds, object rowObject ) : bool
e System.Windows.Forms.DrawListViewItemEventArgs
g System.Drawing.Graphics
itemBounds System.Drawing.Rectangle
rowObject object
Результат bool

RenderSubItem() публичный Метод

Render one cell
public RenderSubItem ( DrawListViewSubItemEventArgs e, Graphics g, Rectangle cellBounds, object rowObject ) : bool
e System.Windows.Forms.DrawListViewSubItemEventArgs
g System.Drawing.Graphics
cellBounds System.Drawing.Rectangle
rowObject object
Результат bool

StandardGetEditRectangle() защищенный Метод

This method calculates the bounds of the text within a standard layout (i.e. optional checkbox, optional image, text)
This method only works correctly if the state of the renderer has been fully initialized (see BaseRenderer.GetEditRectangle)
protected StandardGetEditRectangle ( Graphics g, Rectangle cellBounds, Size preferredSize ) : Rectangle
g System.Drawing.Graphics
cellBounds System.Drawing.Rectangle
preferredSize System.Drawing.Size
Результат System.Drawing.Rectangle

StandardHitTest() защищенный Метод

Perform normal hit testing relative to the given bounds
protected StandardHitTest ( Graphics g, BrightIdeasSoftware.OlvListViewHitTestInfo hti, Rectangle bounds, int x, int y ) : void
g System.Drawing.Graphics
hti BrightIdeasSoftware.OlvListViewHitTestInfo
bounds System.Drawing.Rectangle
x int
y int
Результат void

StandardRender() защищенный Метод

Draw the standard "[checkbox] [image] [text]" cell after the state properties have been initialized.
protected StandardRender ( Graphics g, Rectangle r ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
Результат void