|
Yeah, I was aware of all those platforms. I learned on an Applle ][, only when I blew it up did I buy a C64, and then a slew of Amigas over the years. I often think if I'd not tried to build an NMI card, I'd be one of 50 people worldwide writing software for the Mac today.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello...
Working with VS 2005 Final Release. I hava a DataGridView in which I would like the row to be highlighted a different color if the value in the row's "TAG" column is equal to the the text "NOTE_TEXT". All rows that have "NOTE_TEXT" as the value in the "TAG" column should be highlighted.
I know I can use the RowPrePaint event to do this but I am not sure how to determine which rows contain "NOTE_TEXT" in the "TAG" column within that event.
Here is the code for the event pulled from this page[^] (excellent article Btw... )
Private Sub dgvOne_RowPrePaint(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowPrePaintEventArgs) Handles dgvOne.RowPrePaint<br />
<br />
' Do not automatically paint the focus rectangle.<br />
e.PaintParts = e.PaintParts And Not DataGridViewPaintParts.Focus<br />
<br />
' Determine whether the cell should be painted with the <br />
' custom selection background.<br />
<br />
If (e.State And DataGridViewElementStates.Selected) = _<br />
DataGridViewElementStates.Selected Then<br />
<br />
' Calculate the bounds of the row.<br />
Dim rowBounds As New Rectangle( _<br />
Me.dgvOne.RowHeadersWidth, e.RowBounds.Top, _<br />
Me.dgvOne.Columns.GetColumnsWidth( _<br />
DataGridViewElementStates.Visible) - _<br />
Me.dgvOne.HorizontalScrollingOffset + 1, _<br />
e.RowBounds.Height)<br />
<br />
' Paint the custom selection background.<br />
Dim backbrush As New _<br />
System.Drawing.Drawing2D.LinearGradientBrush(rowBounds, _<br />
Me.dgvOne.DefaultCellStyle.SelectionBackColor, _<br />
e.InheritedRowStyle.ForeColor, _<br />
System.Drawing.Drawing2D.LinearGradientMode.Horizontal)<br />
Try<br />
e.Graphics.FillRectangle(backbrush, rowBounds)<br />
Finally<br />
backbrush.Dispose()<br />
End Try<br />
End If<br />
End Sub
I need to change this if statement:
If (e.State And DataGridViewElementStates.Selected) = _<br />
DataGridViewElementStates.Selected Then
so that it decides if the row being painted contains "NOTE_TEXT" in its "TAG" column.
Any ideas? This should be a fun one...
Many thanks!
"Half this game is ninety percent mental."
- Yogi Berra
If you can read thank a teacher, if you can read in English, thank a Marine.
|
|
|
|
|
i had the same situation but i did it in a much simpler way like this:
after binding the datagridview to datatable try this:
Dim i As Integer<br />
Dim font As New Font(DataGridView1.DefaultCellStyle.Font.FontFamily, 7, FontStyle.Bold)<br />
For i = 0 To DataGridView1.RowCount - 2<br />
Dim value As String<br />
value = DataGridView1.Rows(i).Cells("TAG").Value.ToString()<br />
If value = "NOTE_TEXT" Then<br />
DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.PeachPuff<br />
<br />
Try<br />
DataGridView1.Rows(i).DefaultCellStyle.Font = font<br />
Finally<br />
font.Dispose()<br />
End Try<br />
<br />
End If<br />
<br />
Next i
try it worked for me..
abhinav
|
|
|
|
|
|
|
Please dont crosspost, pick the forum which matches your question closest and post it there only.
|
|
|
|
|
|
Why wasn't it relevant to the Web Development and the .NET Framework forums then? Almost every question can be said to be relevant in a lot of the forums.
Even if you think that a post is releveant to several forums, it's bad practise to cross post. If you really really think that you absolutely need to draw attention to your extremely important post in more than one forum, post the question in one forum, and post links to it in the other forum.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks Guffa, if I ever need a wise ass I'll be sure to give you a call
|
|
|
|
|
If you don't talk back when someone informs you of the proper use of the forum, I will not throw wise ass cracks at you.
---
b { font-weight: normal; }
|
|
|
|
|
ironstrike1 wrote: Thanks Guffa, if I ever need a wise ass I'll be sure to give you a call
Better a wise ass than a dumb ass!
- I may disagree with what you have to say, but I shall defend, to the death, your right to say it. --Voltaire (1694-1778)
|
|
|
|
|
Peter Ross (aka ironstrike1) wrote: What did I offend your boyfriend jerkoff?
Nope. He's not bothered by the whole thing.
- I may disagree with what you have to say, but I shall defend, to the death, your right to say it. --Voltaire (1694-1778)
|
|
|
|
|
|
|
Hi,
Thanks for that Progload, I'll have a read, it looks a bit over my head, it may take some time.
With regard to cross posting, no problem at all, I will reword in future if posts are relevant to more than one forum.
I just dont like smart ass, sarcastic replies,
Rgds
Ironstrike
|
|
|
|
|
ironstrike1,
Yes I can understand that, But..it is considered rude here to cross post...
It's mentioned somewhere here every day here.
Most all of us, read all the posts in most of the fourms and we all can see all of the posts from the Latest Comments Page:
http://www.codeproject.com/script/comments/all_comments.asp[^]
So if someone is really interesed in responding they will... no matter what fourm it's in.
Regards,
progload
|
|
|
|
|
I Didnt realise that,
Thanks for the tip
Rgds
Ironstrike
|
|
|
|
|
You are the only person being a wise ass in this thread... it is a sure fire way to get your questions NOT answered.
Crossposting is considered rude on 100% of all online forums I have ever visited, take some time to get to know a place before you start calling people out.
Oh, and FYI I never removed your thread from, nor restored it to, this forum.
PS> You can guarantee I will not be answering any of your future questions.
How to get answers to your questions!! Read it[^]
|
|
|
|
|
|
Congrats, this was your first post at this forum and you managed to piss off more than a few regulars.
Plus, thanks for the email calling me an "english twat"... really need abusive emails from f***ing idiots after a piss poor day at work.
|
|
|
|
|
Dont forget tell that I sent you a friendly email and was told to sod off.
If thats the way you deal with people I am not surprised you had a bad day at work.
|
|
|
|
|
Welcome to code project. If I was you, I'd register a new account, and pretend this whole mess never happened.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Lol, Yes, not the perfect start but hey, you cant get on with everybody. I have also encountered a lot of friendly people like yourself
Thanks for the welcome
-- modified at 19:46 Thursday 23rd February, 2006
|
|
|
|
|
Hi,
I've written a VB.NET application that's a front-end interface for an Access database. The application works fine except for one small anomaly.
The first form that loads up is a small login dialog box (username, password, OK, etc.). It's WindowState is set to 'Normal' and it's StartupLocation is set to 'CenterScreen'.
After installing the application and logging in for the first time nothing unexpected happens. But with all subsequent log-ins the login dialog box is maximized over the whole screen (including the taskbar). This does not happen when debugging the application in the IDE. It only happens when the application is installed.
Can anyone help?
Thanks in advance.
QC
|
|
|
|
|
specify the dimensions / coordiantes of the login window
Divya Rathi
|
|
|
|