Imports System Imports System.IO Imports System.Collections.Generic Imports System.Text Imports Xceed.Grid Imports Xceed.Grid.Viewers Imports System.Drawing
Class BooleanImageTextViewer Inherits CellViewerManager
Shared Sub New() Dim streamFalseImage As Stream = GetType( BooleanImageTextViewer ).Assembly.GetManifestResourceStream( "Xceed.Grid.Samples.Delete.PNG" )
' We clone the bitmap so that exceptions do not occur when the source stream is ' disposed of. BooleanImageTextViewer.FalseImage = New Bitmap( New Bitmap( streamFalseImage ) ) streamFalseImage.Dispose()
Dim streamTrueImage As Stream = GetType( BooleanImageTextViewer ).Assembly.GetManifestResourceStream( "Xceed.Grid.Samples.GreenCheck.png" )
BooleanImageTextViewer.TrueImage = New Bitmap( New Bitmap( streamTrueImage ) )
streamTrueImage.Dispose() End Sub
Public Sub New() MyBase.New() End Sub
Protected Overrides ReadOnly Property DefaultImageArea() As ImageArea Get Return Xceed.Grid.ImageArea.Left End Get End Property
Protected Overrides ReadOnly Property DefaultImagePadding() As Xceed.UI.Margins Get Return New Xceed.UI.Margins( 2 ) End Get End Property
Protected Overrides ReadOnly Property DefaultTextPadding() As Xceed.UI.Margins Get Return New Xceed.UI.Margins( 2 ) End Get End Property
Protected Overrides Function GetImageCore( ByVal value As Object, _ ByVal formatInfo As CellImageFormatInfo, _ ByVal gridElement As GridElement ) As System.Drawing.Image
Return IIf( CBool( Convert.ChangeType( value, GetType( Boolean ) ) ), _ BooleanImageTextViewer.TrueImage, BooleanImageTextViewer.FalseImage ) End Function
Protected Overrides Function GetTextCore( ByVal value As Object, _ ByVal formatInfo As CellTextFormatInfo, _ ByVal gridElement As GridElement ) As String
Return IIf( CBool( Convert.ChangeType( value, GetType( Boolean ) ) ), _ m_receivedText, m_delayedText ) End Function
Private m_receivedText As String = "Order Received" Private m_delayedText As String = "Order Delayed" Private Shared TrueImage As Image Private Shared FalseImage As Image End Class
|