Report Control Selection Color |
Post Reply |
Author | |
JamGodz
Groupie Joined: 25 February 2010 Status: Offline Points: 67 |
Post Options
Thanks(0)
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 |
|
Baldur
Senior Member Joined: 22 November 2006 Location: Germany Status: Offline Points: 244 |
Post Options
Thanks(0)
|
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.
|
|
JamGodz
Groupie Joined: 25 February 2010 Status: Offline Points: 67 |
Post Options
Thanks(0)
|
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! |
|
Baldur
Senior Member Joined: 22 November 2006 Location: Germany Status: Offline Points: 244 |
Post Options
Thanks(0)
|
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.
|
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
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.... |
|
tobi
Senior Member Joined: 09 September 2004 Location: Germany Status: Offline Points: 451 |
Post Options
Thanks(0)
|
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 ...
|
|
Baldur
Senior Member Joined: 22 November 2006 Location: Germany Status: Offline Points: 244 |
Post Options
Thanks(0)
|
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
|
|
Hemesh
Senior Member Joined: 10 August 2010 Status: Offline Points: 135 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |