Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - SOLVED: Changing highlight colour
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SOLVED: Changing highlight colour

 Post Reply Post Reply
Author
Message
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Topic: SOLVED: Changing highlight colour
    Posted: 21 January 2012 at 12:21am
Here's a quick example (add a ReportControl called ReportControl1 to a form then paste the following code):


Option Explicit

Private Sub Form_Load()
   Dim i As Long
  
   With Me.ReportControl1
  
      .Columns.Add 0, "Test", 100, False
     
      For i = 1 To 25
         With .Records.Add
            If i Mod 2 = 0 Then
               .AddItem i
            Else
               .AddItem Chr$(65 + i)
            End If
         End With
      Next i
     
      .Populate
   End With
  
   SetHighlightColor Me.ReportControl1.FocusedRow
End Sub

Private Sub ReportControl1_FocusChanging(ByVal NewRow As XtremeReportControl.IReportRow, ByVal NewColumn As XtremeReportControl.IReportColumn, ByVal NewItem As XtremeReportControl.IReportRecordItem, Cancel As Boolean)
   SetHighlightColor NewRow
End Sub

Private Sub SetHighlightColor(po_Row As XtremeReportControl.IReportRow)
   If po_Row Is Nothing Then Exit Sub
  
   If IsNumeric(po_Row.Record.Item(0).Value) Then
      Me.ReportControl1.PaintManager.HighlightBackColor = vbRed
   Else
      Me.ReportControl1.PaintManager.HighlightBackColor = vbBlue
   End If
End Sub

Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
markmark View Drop Down
Senior Member
Senior Member


Joined: 30 November 2007
Status: Offline
Points: 142
Post Options Post Options   Thanks (0) Thanks(0)   Quote markmark Quote  Post ReplyReply Direct Link To This Post Posted: 21 January 2012 at 7:54am
Hi
 
I do the same with tasks, that are overdue, etc.
This is the idea of the code I use.
 
rRecord will be the record row you want to change.
 
Dim iItems As ReportRecordItem
Dim rRecord As ReportRecord
Dim CColor As Long

CColor = &H998AFD       ' RED
 

For Each iItems In rRecord
           
    iItems.BackColor = CColor
           
Next
Product: Xtreme SuitePro (ActiveX) version 13.0.0
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0
Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 23 January 2012 at 3:04am
Hi,

Add "ReportControl.SetCustomDraw xtpCustomBeforeDrawRow" to the ReportControl setup then using the BeforeDrawRow event:

Private Sub ReportControl_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)
    If Item.Record(7).Value = "Auth" Then
        ReportControl.PaintManager.HighlightBackColor = vbGreen
    Else
        ReportControl.PaintManager.HighlightBackColor = vbRed
    End If
End Sub

Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.