Select Categories Below
Advertisement
Start Your Own Q&A Site
Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.
Status: Closed Points: 75 Time: 13:41 - Jun 14, 2007
webmavin
how to give custom gradient effect background to datagridview header in windows .net2.0?
Categories:
Add Categories
When adding more than one category, separate them with commas.
admin
Date:: Aug 22, 2007
Time:: 13:25
webmavin, did you get your question solved? If you did then please close this question and distribute the points. If you found the solution on your own, we would be very happy if you could explain it here for the sake other users having the same problem. If you didn't get a solution to your problem, please leave a comment here to let the experts know that you're still looking for an answer. Thanks, The Quomon Admin Team
Date:: Aug 23, 2007
Time:: 02:00
Nope, i did not find an efficient way yet to give a custom gradient effect background to the datagridview header.
prashanth.guru
Date:: Oct 18, 2007
Time:: 06:19
Depends on which cells you want to fill with gradient brush. Have a look at : DataGridView.RowPrePaint and / or DataGridView.CellPainting The following code applies a gradient background to each cell within the first column that isn't selected: dataGridView1.CellPainting += new DataGridViewCellPaintingEventHandler(dataGridView1_CellPainting); void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { if ((e.ColumnIndex==0) && (e.RowIndex != -1) && (e.State & DataGridViewElementStates.Selected)!= DataGridViewElementStates.Selected) { // fill gradient background Brush gradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush( e.CellBounds, Color.Blue, Color.BlueViolet, System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal); e.Graphics.FillRectangle(gradientBrush, e.CellBounds); backbrush.Dispose(); // paint rest of cell e.Paint(e.CellBounds, DataGridViewPaintParts.Border | DataGridViewPaintParts.ContentForeground); e.Handled = true; } } ----------------------------------- OR ----------------------------------- private void gridChannel_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { bool isHandled = false; if (e.RowIndex >= 0 && e.ColumnIndex == 2) { if (gridChannel[e.ColumnIndex, e.RowIndex].Value != null && IrcBase.MDIParentForm.AppSettings.ProfileWordWatchSettingsCol.CheckForMatch(gridChannel[e.ColumnIndex, e.RowIndex].Value.ToString())) { System.Drawing.Drawing2D.LinearGradientBrush lBrush = new System.Drawing.Drawing2D.LinearGradientBrush(e.CellBounds, e.CellStyle.BackColor, IrcBase.MDIParentForm.AppSettings.ProfileMatchCellColor, System.Drawing.Drawing2D.LinearGradientMode.Horizontal); e.Graphics.FillRectangle(lBrush, e.CellBounds); lBrush.Dispose(); e.Paint(e.CellBounds, DataGridViewPaintParts.Border | DataGridViewPaintParts.ContentBackground | DataGridViewPaintParts.ContentForeground | DataGridViewPaintParts.ErrorIcon | DataGridViewPaintParts.Focus); e.Handled = true; isHandled = true; } } if (!isHandled) { e.Handled = false; } Thanks, Prash
Date:: Mar 24, 2009
Time:: 09:46
The question looks to be abandoned by the user who asked it. If no action is taken within 2 days, a Quomon Moderator will consider closing the question and distributing the points. The Quomon Team
Question Answered
This question has been closed, and points have been rewarded to the following experts:
You're welcome however to comment or give additional information or if you wish, you have the ability to write a Tutorial in the Tutorial Area.
Answer this Question
New User
Email:
Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address
Registered User
Username:
Password:
Forgot Your Password?
Enter your email address below and we will resend your login information to you.
Login Information Sent
Questions
whats the best food to eat during midnight?
How to identify the tiffany jewelry? www.tffanycheapmall.com.
Send an email alert to each user of the php application based on criteria
How I Increased My AdSense Earnings?
how to choose the lady dress ?
How can I fulfill the minimum requirement to make your computer support 3D?
You have 100 characters to use
Rank
Expert
Points
1.
10354
2.
6493
3.
5596
4.
4848
5.
3487
6.
2840
7.
2770
8.
2303
9.
1820
10.
917
Register today to share your knowledge with the community and be recognized and rewarded for your contributions.
Register Here
"Psst, Quomon is a great site. Pass it on." Tell a Friend | Link To Us | Save to Delicious | Digg it
Language Options
English:
Español:
Sponsors
Questions and Answers Software