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

Gustav Brock Gustav at cactus.dk
Thu Dec 2 07:56:47 CST 2010


Hi Shamil

That sounds like a good approach.
I just wondered because the option to build custom controls is promoted quite a lot.

/gustav


>>> shamil at smsconsulting.spb.ru 02-12-2010 13:22 >>>
Hi Gustav --

No, I didn't turn it into a generic custom control.
That coding (which I have put in a class library) is used within a custom
control (UserControl) with a custom business functionality.
I do not develop generic custom controls.
But I do develop applications' UI using custom controls - WinForm (with a
TabControl, with TableLayout and/or Splitter controls) are used just as a
"frame" to put custom user controls in.
That way happens to be here the most effective development approach in
context of constantly changing customers' requirements.

Recap:

1. I do put generic functionality in class libraries.
2. I do not develop generic custom controls.
3. I do "religiously" try to keep UI blocks' custom functionality within
dedicated custom controls. 
4. I do use "copy&paste" these days when I do not expect that a generic
functionality will be used in more than three-four cases but even if I
expect it will, I'm often "procrastinating" to develop a generic solution
until such a generic functionality will be really needed to reuse here and
to save quite a few time for further development and support...
...

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 ?. 13:27
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

Quite tricky, I must say.
So now you have turned all this into a custom control of yours? I've never
made such (haven't had the need) but wouldn't this be a good example?

/gustav

>>> shamil at smsconsulting.spb.ru 01-12-2010 23:58 >>>
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






More information about the dba-VB mailing list