PDA

View Full Version : Visual Studio 2005 - Datagrid Fun


PackerFanatic
05-17-2006, 11:48 AM
Hello FOFC, what's shaking? I have been searching for quite some time now on a very large annoyance with datagrids in .NET 1.0 and was wondering if any of you knew anything. It has been highly documented that datagrids can be annoying, especially with customizing the look and feel of the headers and data seperatately. Basically, I want the alignment of my header to be different than the alignment of my data. We just recently switched to VS2005 (with .NET 2.0) and from what I have heard, the new datagrid object in the new version will allow for this customization (and much more) but we had almost the entire system developed in .NET 1.0 and it would be pain to switch all of our datagrids over (Granted if there is no fix, I will do it if I have to) Anyone know of a good workaround for this or anything that I could try? Thanks :)

PackerFanatic
05-17-2006, 11:48 AM
dola, these are plain ol' windows form.

gstelmack
05-17-2006, 12:04 PM
It's a property of the item in 2.0. Not sure in 1.0/1.1. Oh, and if you're working in C# or VB, porting the whole system to 2.0 shouldn't be difficult at all.

PackerFanatic
05-17-2006, 12:05 PM
Yeah, its not an option in 1.0. Like I said, I know it can be done with the 2.0 object but we want to try and avoid having to switch all of our components (if we can)

gstelmack
05-17-2006, 12:25 PM
Well, you could always derive your own custom DataGrid class and add that property. Or I wonder if you could just get away with deriving the DataGridSubItem and adding the property and new drawing code to it, and adding those to the DataGrid.Items collection?

Also, have you checked www.codeproject.com? They always have lots of cool custom containers to add functionality like this. DraftAnalyzer uses an XList custom ListView for MFC to do all the coloring that I got from there.

PackerFanatic
05-17-2006, 12:33 PM
I will check them out, thanks gstel!

Solecismic
05-17-2006, 12:36 PM
I much prefer List Controls and MFC, for compatibility issues.

Obviously, DataGrids have more function built in (some of which I've already added to my List Control class and supporting classes). If you can control the installation computer, .Net is an option today. If you're building software for mass consumption, I still see .Net as nothing more than a toy. I had to remove it from my Windows Me computer because it just didn't work right - messages didn't fire as documented or as they did on the current OS.

Even with all the new function, generally if you don't like the look of something, you're going to have to use a custom drawing class. I have quite a few. Once you get into drawing on DCs, if you keep it relatively simple (even using bitmap pieces or simple lines, shapes and text) you'll find it's not that hard to get what you want and maintain compatibility.

But that's not what you're asking, of course. When I was looking into moving over to the world of Forms, I didn't even get to the point where I investigated customization, mainly because so many more properties were available.

PackerFanatic
05-17-2006, 12:39 PM
I guess they had realized the crappiness of the regular datagrid in .NET 1.1 because they fixed it up quite nicely in 2.0, but I really don't feel like going through this entire system and changing all the datagrid components. I guess that is the problem with having developed almost the entire thing in VS2003 and then switching right at the end, heh.

I guess I will keep looking, thanks guys :)

Riggins44
05-17-2006, 05:29 PM
I had to remove it from my Windows Me computer because it just didn't work right - messages didn't fire as documented or as they did on the current OS.


I'm sure you have an ME box just for testing...but good lord. I pray for those still out there using ME.

gstelmack
05-17-2006, 06:41 PM
Obviously, DataGrids have more function built in (some of which I've already added to my List Control class and supporting classes). If you can control the installation computer, .Net is an option today. If you're building software for mass consumption, I still see .Net as nothing more than a toy. I had to remove it from my Windows Me computer because it just didn't work right - messages didn't fire as documented or as they did on the current OS.

Well, none of your customers have complained yet about my .NET utilities not working on their box, so you have hope ;)

Dutch
05-17-2006, 08:22 PM
I'm sure you have an ME box just for testing...but good lord. I pray for those still out there using ME.

Hell, ME doesn't even work right on an ME box. :)