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. C#
  4. DataGrid: lock row height, paint icons in BoolColumn

DataGrid: lock row height, paint icons in BoolColumn

Scheduled Pinned Locked Moved C#
questioncssgraphicshelp
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.
  • S Offline
    S Offline
    SebbaP
    wrote on last edited by
    #1

    Hi, I have two DataGrid related issues that I would like some help to resolve. 1. I need to lock the heights of all rows in my datagrid, and I have not found any way of accomplishing that. As a side note, I have found a way to lock the widths of my columns by hooking onto the ...WidthChanged event and forcing the width to its correct value for each column (is there a better way?). So, how do I lock row heigths? 2. I have a class that derives from DataGridBoolColumn in which I want to paint icons depending on the values of the cells (true, false, null) by overloading the Paint method and do the drawing myself. I got it working, but not to my satisfaction as it involves too "much" work. What I would like to do is to use the three [True/False/Null]Value properties by assigning to each of them an instance of an Icon, and then use that instance to paint the cell with. I thought I could retrieve the Icon by using the protected method "GetColumnValueAtRow" in the Paint method, but all it returns is DBNull. If I dont alter the three ...Value properties, "GetColumnValueAtRow" returns true, false or null as its supposed to. This would be a nice solution because I don't have to figure out which Icon to paint depending on the value of the cell, since the value of the cell is infact the Icon itself. So, the only difference between my working and non-working solutions is that in the non-working one I alter the Value properties in the constructor of my derived column class. Like this: this.TrueValue = new Icon( "true_icon.ico" ); ... I should perhaps say that I have bound a DataSet to my grid, and I add the information, which the grid is supposed to visualize, directly in my DataTable. I can provide source code tomorrow, as the code is on my computer at work. I hope someone can help me! Thanks!

    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