Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

image in a datagrid column header

6 views
Skip to first unread message

harry

unread,
Feb 11, 2004, 2:13:02 PM2/11/04
to
Hello,

I would like to instead of placing text in to the header of a column in a
windows.forms.datagrid
to place an image instead. Can it be done? Googling doesn't seem to come up
with anything like this
except for creation of an image column style, which is close to what I want
but not quite close enough
(as I actually want the column to contain checkboxes).

On another similar note is it possible to have multi-line column headers,
where the header could wrap in accordance with the
width of the column so you can always read what it says (more or less)?
Anyone got any ideas.

cheers

H


Dmitriy Lapshin [C# / .NET MVP]

unread,
Feb 12, 2004, 4:08:57 AM2/12/04
to
Hello harry,

Phew...it should be possible but would require much effort. You should
override the OnPaint method (or handle the Pain event) of the DataGrid
control and provide manual painting for the column header you want to
customize.

Another challenge you are likely to encounter is determining the bounds of
the column header. While it is relatively easy task when a data cell is in
question (the grid exposes a GetCellBounds method), I am not so sure a
similar method exists for the headers.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE


"harry" <thedrea...@hotmail.com> wrote in message
news:N8vWb.285$oI1...@news-binary.blueyonder.co.uk...

Harry Longleat

unread,
Feb 12, 2004, 4:40:13 AM2/12/04
to
Cheers, that's what I thought I'd have to do hoping that there was some
secret feature I hadn't found yet. I think I think this "feature" will
have to take a lower priority now.

H

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

0 new messages