Imports System.Drawing
Imports System.Windows.Forms
Imports System.ComponentModel

''' <summary>
''' Represents a data grid text box column that can be highlighted.
''' </summary>
''' <remarks></remarks>
Public Class MarkableDataGridTextBoxColumn
    Inherits MarkableDataGridColumnBase

    ''' <summary>
    ''' Initializes a new instance of the <see cref="Mercury.Mobile.Forms.MarkableDataGridTextBoxColumn"/> class.
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub New()
    End Sub

    ''' <summary>
    ''' Initializes a new instance of the <see cref="Mercury.Mobile.Forms.MarkableDataGridTextBoxColumn"/> class with the specified property descriptor.
    ''' </summary>
    ''' <param name="pd">The property descriptor to initialize with.</param>
    ''' <remarks></remarks>
    Public Sub New(ByVal pd As PropertyDescriptor)
        MyBase.New(pd)
    End Sub

    ''' <summary>
    ''' Gets the HostedControl as a TextBox.
    ''' </summary>
    ''' <value>TextBox.</value>
    ''' <returns>HostedControl as a TextBox.</returns>
    ''' <remarks></remarks>
    Public Overridable ReadOnly Property TextBox() As TextBox
        Get
            Return CType(Me.HostedControl, TextBox)
        End Get
    End Property

    Protected Overrides Function GetBoundPropertyName() As String
        Return "Text"
    End Function

    Protected Overrides Function CreateHostedControl() As System.Windows.Forms.Control
        Dim box As TextBox = New TextBox()
        ' Set defaults
        box.BorderStyle = BorderStyle.None
        box.Multiline = True
        box.TextAlign = Me.Alignment

        ' Return
        Return box
    End Function

End Class
