Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Datagrid custom columnstyle problem

Datagrid custom columnstyle problem

Scheduled Pinned Locked Moved Visual Basic
helpcsharpcssgraphicsquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    David M J
    wrote on last edited by
    #1

    Hi, I've got a problem with my custum datagridcolumnstyles. As soon as I sort on a column with a custom column style after I have selected a different row, the code redraws a label(which is the columnstyle in the attached code snippet) the size of the entire grid. Also when changing the readonly status of the datagrid the datagrid seems to "freeze". I am probably missing something, but I am not sure what. Any suggestions? The attached code is converted from C# to vb so there might be some error there. Thanks David Public Class clDTRDataGridLabelColumn Inherits DataGridColumnStyle Private lb As New Label ' The isEditing field tracks whether or not the user is ' editing data with the hosted control. Private isEditing As Boolean Public Sub New() lb.Visible = False lb.Dock = DockStyle.Fill Me.NullText = "" 'tb.Height = 27 End Sub Protected Overrides Sub Abort(ByVal rowNum As Integer) isEditing = False RemoveHandler lb.TextChanged, _ AddressOf lbtextChanged Invalidate() End Sub Protected Overrides Function Commit _ (ByVal dataSource As CurrencyManager, ByVal rowNum As Integer) _ As Boolean lb.Bounds = Rectangle.Empty AddHandler lb.TextChanged, _ AddressOf lbtextChanged If Not isEditing Then Return True End If isEditing = False Invalidate() Return True End Function Protected Overloads Overrides Sub Edit( _ ByVal [source] As CurrencyManager, _ ByVal rowNum As Integer, _ ByVal bounds As Rectangle, _ ByVal [readOnly] As Boolean, _ ByVal instantText As String, _ ByVal cellIsVisible As Boolean) Dim value As String If cellIsVisible Then lb.Text = value lb.Visible = True AddHandler lb.TextChanged, _ AddressOf lbtextChanged Else lb.Text = value lb.Visible = False End If If lb.Visible Then DataGridTableStyle.DataGrid.Invalidate(bounds) End If End Sub Protected Overrides Function GetPreferredSize( _ ByVal g As Graphics, _ ByVal value As Object) As Size Return New Size(100, lb.PreferredHeight) End Function Protected Overrides Function GetMinimumHeight() As Integer Return lb.PreferredHeight End Function Protected Overrides Function GetPrefe

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups