Add Icon to ReportRecordItem |
Post Reply |
Author | |
Shawshank
Senior Member Joined: 16 October 2005 Status: Offline Points: 117 |
Post Options
Thanks(0)
Posted: 07 June 2007 at 4:00pm |
I have added an icon to the ImageManager control. I then assigned the ImageManager to the .Icons property of the ReportControl. But when I add a ReportRecordItem and assign the .Icon property to the image value of the ImageManager the icon does not appear. Yet, when I assign the icon to a CommandBarControl the icon appears as expected. This tells me 1) that I have successfully added the icon to the ImageManager and 2) that the icon is valid and 3) that I am assigning the proper icon value to the .Icon property. What would cause the ReportRecordItem to not show the icon where the CommandBarControl will? Here is my code:
lRet& = CLSIDFromString(StrPtr("{4D36E977-E325-11CE-BFC1-08002BE10318}"), lGUID)
lRet& = SetupDiLoadClassIcon(lGUID, lIcon&, lIdx&)
'I now have the icon handle in lIcon&
'Assign to ImageManager
Me.ImageManager1.Icons.AddIcon lIcon&, 1, xtpImageNormal
'Assign ImageManager to the .Icons property of RC
Set Me.ReportControl1.Icons = Me.ImageManager1.Icons
'Create ReportRecordItem and assign the icon
Set Record = Me.ReportControl1.Records.Add()
Set Item = Record.AddItem("Test!")
Item.Icon = 1
I would expect the icon to appear on the ReportRecordItem but fails to. Assigning the icon to the CommandBarControl works great. What could I be doing wrong?
Shawshank
|
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
I am doing this also with success. With the exception of the fact that I am adding the images to the ImageManager at design time I only have the following two differences:
Instead of: Set Me.ReportControl1.Icons = Me.ImageManager1.Icons Try: Me.ReportControl1.Icons = Me.ImageManager1.Icons And I am not assigning a value to the item prior to Item.Icon = 1 |
|
Shawshank
Senior Member Joined: 16 October 2005 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
I have tried doing it both ways; with the Set statement and without. In both cases I do not have the icon showing in the ReportControl. It does, however, work with the CommandBarControl in either case.
Also, I have tried adding the icon to the ImageManager before assigning the ImageManager and after assignment.
Shawshank
|
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
Hm. Is your icon 16x16 or larger? Mine are 16x16
My column is set up as follows: Set Column = rpt.Columns.Add(COL_DELETESTEP, "", 3, True) Column.Editable = True Then I fill and populate the report: Set Item = Record.AddItem("") Item.Icon = ID_DELETESTEP rpt.populate |
|
Shawshank
Senior Member Joined: 16 October 2005 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
Yes, my icon is larger than 16x16. Does this then mean that the CommandBarControl can scale an icon down and the ReportControl cannot?
Shawshank
|
|
Shawshank
Senior Member Joined: 16 October 2005 Status: Offline Points: 117 |
Post Options
Thanks(0)
|
I discovered a very easy, succinct solution. Instead of adding the icons to the ImageManager or a MS ImageList control I instead added them to the Icon collection of the ReportControl itself. This had the benefit of allowing me to add large icons and then have them scaled down to 16x16 size when assigned to a ReportRepordItem.
Shawshank
|
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
Cool. I never even thought of that. I might have to try it also.
Thanks! |
|
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 |