473,401 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

datagridview headers

Hi,

I am using VS 2005 and I want to know if it is possible to override the
onPaint() method of the header of the datagrid columns

and if it is possible how can I do it?

Thanks a lot for your attention

May 29 '06 #1
1 2282
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:D5**********************************@microsof t.com...
Hi,

I am using VS 2005 and I want to know if it is possible to override the
onPaint() method of the header of the datagrid columns

and if it is possible how can I do it?

Thanks a lot for your attention


Handle the CellPainting event. RowIndex will be -1 for row headers and
ColumnIndex will be -1 for column headers. The following example just paints
all header cells in solid red.

private void itemDataGridView_CellPainting(object sender,
DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex < 0 || e.ColumnIndex < 0)
{
e.Graphics.FillRectangle(Brushes.Red, e.CellBounds);
e.Handled = true;
}
}

Chris Jobson
May 29 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David Veeneman | last post by:
How can I set a bound DataGridView control to use a dataset table's column captions, instead of column names? I'm working with a DataGridView control, which I have bound to a table in a dataset....
1
by: mark carew | last post by:
Hi, Problem - An extra column to the left (even with row headers disabled) ---------------------------------------------------------- Apologies if this posting is already in the newsgroup; but...
2
by: Bryan | last post by:
I have a Windows Application that uses a DataGridView for displaying read-only data. Everything work fine, except when my datasource has no data. Ideally, when there is no data I would like to...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
0
by: sghante | last post by:
Here is a datagridview whose data need to be displayed as follows: constant1 constVal1 constVal1 constVal1 constVal1 constVal1 constVal1 constVal1 constVal1 ...
0
by: Dennis Francek | last post by:
Hello I have populated a treeview from my dataset and by clicking in the treeview i want to get the corresponding table shown in a datagridview. Ive managed this by looking at each DataRow and...
1
by: TG | last post by:
Hi! I have an application in which I have some checkboxes and depending which ones are checked those columns will show in the datagridview from sql server or no. After that I have 2 buttons:...
2
by: Steve | last post by:
Hi All I am using VB.net 2005 windows forms I use the Datagridview.cellformatting event to change the colours of individual cells as required and all works fine How can I do the same for...
1
by: =?Utf-8?B?QWxleCBLLg==?= | last post by:
Hi all No matter how hard I try, I cannot force my DataGridView to use specific font in column headers: it seems to be always the same as container's font (which is form in my case). I set...
3
by: Stewart Berman | last post by:
I have an application that populates a DataGridView control with an XML file: private void Form1_Load(object sender, EventArgs e) { dataGridView1.DataSource = gridDataSet;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.