Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Report Control Selection Color
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Report Control Selection Color

 Post Reply Post Reply
Author
Message
JamGodz View Drop Down
Groupie
Groupie
Avatar

Joined: 25 February 2010
Status: Offline
Points: 67
Post Options Post Options   Thanks (0) Thanks(0)   Quote JamGodz Quote  Post ReplyReply Direct Link To This Post Topic: Report Control Selection Color
    Posted: 22 April 2010 at 10:00pm
Hi Everyone!

i still can't get it, when i tried to select a row the backcolor and forecolor of an item i set is gone... all i want is to retain the backcolor and forecolor of the item...
im using VB6 and ReportControl 13.2.1


Any help would be greatly appreciated.. tnx


Back to Top
Baldur View Drop Down
Senior Member
Senior Member


Joined: 22 November 2006
Location: Germany
Status: Offline
Points: 244
Post Options Post Options   Thanks (0) Thanks(0)   Quote Baldur Quote  Post ReplyReply Direct Link To This Post Posted: 24 April 2010 at 9:45am
What do you realy mean?
Ich you set the for- and backcolor for an individual item, these colors are reused if an other row is selected.
The selectioncolors are defined in the paintmanager of the reportcontrol.
 
If you don't want to use the selection-colors, you must use ownerdraw and you have to draw each item by yourself.
In this case you overwrite the selectioncolors.
 
But the problem may be, that the user can't see any mor, which row is currently selected.
Back to Top
JamGodz View Drop Down
Groupie
Groupie
Avatar

Joined: 25 February 2010
Status: Offline
Points: 67
Post Options Post Options   Thanks (0) Thanks(0)   Quote JamGodz Quote  Post ReplyReply Direct Link To This Post Posted: 25 April 2010 at 8:29pm
Hi Baldur, Good Day!

Thank you for your reply. I had set the backcolor=vbred when an item is less  than zero or have a negative value. Then my problem is when the user select the row, the backcolor=vbred which i set earlier had been replace by the highlighted color. all i need is to retain the vbred backcolor to emphasize to user that the selected/highlighted row had contain a negative value. Please refer my code below on how i set an item to vbred. Please i need help on this.


Private Sub wndReportControl_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)
    If Item.Index >= 1 Then Metrics.ColumnAlignment = xtpAlignmentIconRight Or xtpAlignmentRight
    If Left$(Item.Value, 1) = "-" Then
        Metrics.BackColor = 12632319
        Metrics.Font.Bold = True
        Metrics.ForeColor = vbRed
    End If
    If Row.Selected Then
        If Metrics.BackColor <> 12632319 Then
            Metrics.BackColor = m_HighlightBackcolor
        Else
            Metrics.BackColor = 12632319
        End If
    End If
End Sub

Any suggestion or comment would be greatly appreciated.

Thank you!

Back to Top
Baldur View Drop Down
Senior Member
Senior Member


Joined: 22 November 2006
Location: Germany
Status: Offline
Points: 244
Post Options Post Options   Thanks (0) Thanks(0)   Quote Baldur Quote  Post ReplyReply Direct Link To This Post Posted: 26 April 2010 at 1:17pm
This doesn't help in BeforeDrawRow, because the selected row will be drawn with the selection colors.
You have to draw the entire row by yourself with windows-gdi-functions.
 
You need the flag xtpCustomDrawItem!
Than, in the DrawItem-Event you can decide, what to do.
 
It's too heavy to explain here how to use GDI-Functions to the given hDC.
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post Posted: 26 April 2010 at 2:04pm
Hi,
 
If you set wndReportControl.SelectionEnable = False you are still able to see which row has been selected (dotted rectangle) and you are able to select a color for an item in BeforeDrawRow event (the code you already have)
 
 
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2
Language: Visual Basic 6.0

Zero replies is not an option....
Back to Top
tobi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 09 September 2004
Location: Germany
Status: Offline
Points: 451
Post Options Post Options   Thanks (0) Thanks(0)   Quote tobi Quote  Post ReplyReply Direct Link To This Post Posted: 26 April 2010 at 3:41pm
I'm also looking for a way to make the blue selection bar ( without SelectionEnable = False ) some kind of transparent to see colored cells also when they are selected ...
Back to Top
Baldur View Drop Down
Senior Member
Senior Member


Joined: 22 November 2006
Location: Germany
Status: Offline
Points: 244
Post Options Post Options   Thanks (0) Thanks(0)   Quote Baldur Quote  Post ReplyReply Direct Link To This Post Posted: 26 April 2010 at 3:57pm
Once more again:
If the selectionbar is enabled (SelectionEnable = True) you have to draw the cells by yourself.
You can use the Windows-Function SetBkColor, SetTextColor and ExtTextOut or DrawText to draw each cell as you want.
In the DrawItem-Event you get all you need.
For examlpe:
 
Public Type cRect
  left As Long
  top As Long
  right As Long
  bottom As Long
End Type
 
Public Declare Function SetBkColor Lib "gdi32" (ByVal hDC As Long, ByVal crColor As Long) As Long
Public Declare Function SetTextColor Lib "gdi32" (ByVal hDC As Long, ByVal crColor As Long) As Long
Public Declare Function ExtTextOut Lib "gdi32" Alias "ExtTextOutA" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long, ByVal wOptions As Long, lpRect As cRect, ByVal lpString As String, ByVal nCount As Long, lpDx As Long) As Long
 
 
Private Sub repReport_DrawItem(ByVal Row As XtremeReportControl.IReportRow, ByVal Column As XtremeReportControl.IReportColumn, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal hDC As stdole.OLE_HANDLE, ByVal left As Long, ByVal top As Long, ByVal right As Long, ByVal bottom As Long, DoDefault As Boolean)
   Dim xTextRect As cRect
   
   xTextRect.left = left + 1               ' Text
   xTextRect.right = right - 2
   xTextRect.top = top + 1
   xTextRect.bottom = bottom - 2
   SetBkColor hDC, Item.Backcolor
   SetTextColor hDC, Item.ForeColor
   ExtTextOut hDC, 0, 0, ETO_OPAQUE, xTextRect, Item.Caption, -1, 0
 
   DoDefault = False
end sub
Back to Top
Hemesh View Drop Down
Senior Member
Senior Member


Joined: 10 August 2010
Status: Offline
Points: 135
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hemesh Quote  Post ReplyReply Direct Link To This Post Posted: 26 August 2010 at 5:14am
Just tried this sample, can't get the text to show in the first column now, and the selection highlight still appears. Need to play around with this to get an outline working maybe.

Think CJ need a feature to have different selection modes like xtpSold and xtpOutline!

EDIT: Got the outline I wanted by setting SelectionEnable = False and ShowRowFocus = true and not bothering with customdrawing!
Product: Xtreme SuitePro (ActiveX) version 18.5.0

Platform: Windows 7 Enterprise (64-bit)

Language: Visual Basic 6.0
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.160 seconds.