Jusqu'ici: j'ai réussi à combiner du code qui fonctionne et affiche une vue de données standard avec une colonne standard de hauteur standard. Si je configure la hauteur columnheadercell dans les propriétés datagridview, la hauteur est acceptée comme d'habitude.custom datagridviewcolumnheadercell height
Objectif: Je souhaite implémenter la hauteur de colonne par défaut d'une colonne datagridviewtextbox standard à l'intérieur de mon propre datagridview personnalisé appelé 'datagridview_filter'. J'aimerais définir une hauteur de colonne personnalisée pour ma nouvelle vue de grille de données. Je suis proche, mais ...
Cela crée mon habitude DGV:
Public Class DataGridView_Filter
End Class
avec le fichier .designer sous-jacent:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class DataGridView_Filter
Inherits System.Windows.Forms.DataGridView
'Control overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Control Designer
Private components As System.ComponentModel.IContainer
' NOTE: The following procedure is required by the Component Designer
' It can be modified using the Component Designer. Do not modify it
' using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
et moi avons créé une nouvelle coutume appelée datagridviewcolumncell 'datagridviewcolumncell_filter':
Public Class DataGridViewTextBoxColumn_Filter
Public Sub New()
Me.CellTemplate = New DataGridViewCell_Filter()
Me.ReadOnly = True
End Sub
End Class
avec un fichier .designer sous-jacent:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class DataGridViewTextBoxColumn_Filter
Inherits System.Windows.Forms.DataGridViewTextBoxColumn
'Control overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Control Designer
Private components As System.ComponentModel.IContainer
' NOTE: The following procedure is required by the Component Designer
' It can be modified using the Component Designer. Do not modify it
' using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
et une coutume DataGridViewCell appelé 'datagridviewcell_filter':
Public Class DataGridViewCell_Filter Inherits DataGridViewTextBoxCell End Class
avec un FIE .designer sous-jacente:
Partial Class DataGridViewCell_Filter
Inherits System.Windows.Forms.DataGridViewTextBoxCell
'Control overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Control Designer
Private components As System.ComponentModel.IContainer
' NOTE: The following procedure is required by the Component Designer
' It can be modified using the Component Designer. Do not modify it
' using the code editor.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
EDIT: Je suis tombé sur le mode 'datagridview_filter [design]' et j'ai remarqué que je pouvais changer les propriétés de 'Datagridview_filter' en mode [design]. Imaginez mon visage heureux à ce moment-là. On peut y installer n'importe quoi. Tout est sauvegardé pour référence future. Mais ... quand j'insère 'Datagridview_filter' dans un formulaire vide tous les paramètres disparaissent comme s'ils n'étaient jamais là. Ainsi, j'obtiens columnheaderheight 18 au lieu de 40 sauvegardé dans les propriétés personnalisées 'datagridview_filter [design]'. Donc, il semble que je suis au même endroit que je l'étais avant.
Merci à l'avance