Hallo Community,
ich habe folgendes Problem:
Ich habe ein Windows.Froms Steuerelement, die DataGridViewCheckBoxColumn.
Da die von Microsoft vorprogrammierte DataGridViewCheckBoxColumn einen unschönen Grafikfehler hat,
habe ich diesen behoben und wollte nun die original Klasse ersetzen.
Da ich den Fehler in einer seperaten Komponenten Klasse behoben habe und diese genau gleich genannt
habe wie die Original DataGridViewCheckBoxColumn habe ich nun in der Spaltenauswahl im DataGridView
2 mal den selben Datentyp. Also DataGridViewCheckBoxColumn taucht 2 mal auf.
Die Frage ist jetzt wie kann ich die Windows.Forms Komponenten (also die
Windows.Forms.DataGridViewCheckBoxColumn) aus meiner Auswahl entfernen?
Zum entfernen des Grafikfehlers gibt es Folgende Klassen:
Namespace Forms
Public Class DataGridViewCheckBoxColumn
Inherits System.Windows.Forms.DataGridViewCheckBoxColumn
Public Overrides Property CellTemplate() As _
System.Windows.Forms.DataGridViewCell
Get
If TypeOf (MyBase.CellTemplate) Is _
System.Windows.Forms.DataGridViewCheckBoxCell Then
MyBase.CellTemplate = New _
BILib.Forms.DataGridViewCheckBoxCell
End If
Return MyBase.CellTemplate
End Get
Set(ByVal value As System.Windows.Forms.DataGridViewCell)
MyBase.CellTemplate = value
End Set
End Property
End Class
End Namespace und die
Namespace Forms
Public Class DataGridViewCheckBoxCell
Inherits System.Windows.Forms.DataGridViewCheckBoxCell
Protected Overrides Sub Paint(ByVal graphics As _
System.Drawing.Graphics, ByVal clipBounds As _
System.Drawing.Rectangle, ByVal cellBounds As _
System.Drawing.Rectangle, ByVal rowIndex As Integer, ByVal _
elementState As System.Windows.Forms.DataGridViewElementStates, ByVal _
value As Object, ByVal formattedValue As Object, ByVal errorText As _
String, ByVal cellStyle As _
System.Windows.Forms.DataGridViewCellStyle, ByVal advancedBorderStyle _
As System.Windows.Forms.DataGridViewAdvancedBorderStyle, ByVal _
paintParts As System.Windows.Forms.DataGridViewPaintParts)
Windows.Forms.Cursor.Hide()
MyBase.Paint(graphics, clipBounds, cellBounds, rowIndex, _
elementState, value, formattedValue, errorText, cellStyle, _
advancedBorderStyle, paintParts)
Windows.Forms.Cursor.Show()
End Sub
End Class
End Namespace Sollte das ausblenden der Original DataGridViewCheckBoxColumn nicht möglich sein muss ich meine Klasse
wohl umbenennen..
Gruß |