Print Page | Close Window

SOLVED: Changing highlight colour

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=19425
Printed Date: 05 October 2024 at 5:19am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: SOLVED: Changing highlight colour
Posted By: jpbro
Subject: SOLVED: Changing highlight colour
Date 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




Replies:
Posted By: markmark
Date 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


Posted By: Xander75
Date 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)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net