By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,667 Members | 1,283 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,667 IT Pros & Developers. It's quick & easy.

Drawling custom listview column headings

P: n/a
To make my column headings looks like the listviews, I've been doing:

// Draw each column title
e.Graphics.FillRectangle(new SolidBrush(SystemColors.Control), XPos, 0,
cColumn.Width - 1, this.RowHeight - 1);
e.Graphics.DrawLine(new Pen(SystemColors.ControlLightLight), XPos, 0,
XPos + cColumn.Width - 2, 0);
e.Graphics.DrawLine(new Pen(SystemColors.ControlLightLight), XPos, 0,
XPos, this.RowHeight - 2);
e.Graphics.DrawLine(new Pen(SystemColors.ControlDark), XPos + 1,
this.RowHeight - 2, XPos + cColumn.Width - 2, this.RowHeight - 2);
e.Graphics.DrawLine(new Pen(SystemColors.ControlDark), XPos +
cColumn.Width - 2, 1, XPos + cColumn.Width - 2, this.RowHeight - 2);
e.Graphics.DrawString(cColumn.Title, this.TextFont, new
SolidBrush(SystemColors.ControlText), new RectangleF(XPos + 4, 1,
cColumn.Width, this.RowHeight));
XPos = XPos + cColumn.Width;

But obviously this is really messy. Is there a better way than drawing the 4
border lines (they're 3d/diffrent colours, so can't be DrawRactangle). I was
wondering about using Buttons for the headings instead, since they'd depress
then, which'd look good for sorting. Or is there another class I can use
I've missed?
--
Daisy The Cow
Now playing: Jamiroquai - Little L
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.