PC Review


Reply
Thread Tools Rate Thread

DataGridView - OnCellPainting - PaintBackground

 
 
Florian Schmidt
Guest
Posts: n/a
 
      14th Nov 2006
Hello,

since the german newsgroup couldn't help with this issue, I'll post it
here:

I am trying to change the background color of some cells in my
dataGridView, but only partly. Therefore I am overriding the
OnCellPainting-method in my DataGridView like:

Rectangle groupBounds = new Rectangle(
e.CellBounds.X,
e.CellBounds.Y +
Convert.ToInt32(e.CellBounds.Height * 0.5),
e.CellBounds.Width,
Convert.ToInt32(e.CellBounds.Height * 0.5)
);
e.PaintBackground(groupBounds, false);

BUT the e.PaintBackground(...) seems to ignore the new bounds, which
are given in the argument "groupBounds". I can set "groupBounds" to
whatever I want, but it allways paints the whole background.

If I use e.Graphics.FillRectangle(..) it works like expected. But
shouldn't the e.PaintBackground(...) work as well?

Regards
Flo

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Refreshing Linq query to update second DataGridView when position in first DataGridView changes Arved Sandstrom Microsoft C# .NET 1 25th May 2008 04:06 AM
dataGridView.Rows.Count and datagridview.RowCount SePp Microsoft C# .NET 1 15th Jan 2008 10:27 AM
DataGridView (.NET 2.0 Windows Forms) Text wrapping in DataGridView Items Chris Hayes Microsoft Dot NET Framework 1 27th Aug 2006 06:07 PM
Clearing selection in DataGridView when user clicks outside the DataGridView control djyakov@gmail.com Microsoft Dot NET Framework Forms 0 16th Feb 2006 06:38 PM
Refreshing datagridview contents after a failed delete in bound datagridview Bob Microsoft VB .NET 0 5th Jan 2006 06:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:48 AM.