[dba-VB] WinForms: What is the best event for custom drawing ona leftmost cell of DataGridView

Shamil Salakhetdinov shamil at smsconsulting.spb.ru
Wed Dec 1 16:58:21 CST 2010


Hi Gustav --

Google didn't help here.

I finally used .Paint event to draw on TopLeftCell, .RowPostPaint to draw on
RowHeaders with custom drawing in both cases.

And (your google hint)

            e.PaintHeader(DataGridViewPaintParts.All &
~DataGridViewPaintParts.ContentBackground);

to suppress arrow.

It works fine now.

Thank you.

--
Shamil
 
-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: 2 ??????? 2010 ?. 1:28
To: dba-vb at databaseadvisors.com
Subject: Re: [dba-VB] WinForms: What is the best event for custom drawing
ona leftmost cell of DataGridView

Hi Shamil

I guess you have googled what you need to at this moment ...

The one strange thing about the row selectors is the default large width.
Too wide in my opinion.

/gustav


>>> shamil at smsconsulting.spb.ru 01-12-2010 16:00 >>>
Hi Gustav --

Thank you. Yes, that should help. I must note I didn't google for that
somehow - just for RowPostPaint event.
It looks simple now - just information how to draw on left-top cell is
missing.

You're so quick with googling could you find that information? :) (If you'll
not find it quickly in your free time - forget it... )

<<<
Or could you do that and then use column 0 to simulate the row headers?
>>>
I wanted to use row headers - yes, simulation seems to be an "easy way to
go" - but I'd prefer row headers, which have special display view and
properties, which I do not want to spend time on simulation
implementation...

Thank you.

--
Shamil
 
-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: 1 ??????? 2010 ?. 15:24
To: dba-vb at databaseadvisors.com
Subject: Re: [dba-VB] WinForms: What is the best event for custom drawing
ona leftmost cell of DataGridView

Hi Shamil

I see. If you didn't need to draw your +/- you could just remove the row
headers. Or could you do that and then use column 0 to simulate the row
headers?

This:
http://webcache.googleusercontent.com/search?q=cache:lC1xHEMKuvUJ:dotnet.ita
gs.org/web-forms/121172/+%22C%23%22+DataGridView+show+rowselector+arrow&cd=7
&hl=da&ct=clnk&gl=dk

located in the Google cache suggests:

Handle the RowPostPaint event (Code Snippet):

void dataGridView1_RowPostPaint(object sender,
DataGridViewRowPostPaintEventArgs e) {
  e.PaintHeader(DataGridViewPaintParts.All &
~DataGridViewPaintParts.ContentBackground);
}

Also, I located this thread which, however, perhaps collides with your +/-
drawing:

http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/34
6e5839-1813-472b-8b3a-7344118819b3

You may have seen it before (I just googled) but the topic seems pretty
close to that of yours.

/gustav


_______________________________________________
dba-VB mailing list
dba-VB at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-vb
http://www.databaseadvisors.com




More information about the dba-VB mailing list