Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Report Control
  New Posts New Posts RSS Feed - Add Icon to ReportRecordItem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Add Icon to ReportRecordItem

 Post Reply Post Reply
Author
Message
Shawshank View Drop Down
Senior Member
Senior Member


Joined: 16 October 2005
Status: Offline
Points: 117
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shawshank Quote  Post ReplyReply Direct Link To This Post Topic: Add Icon to ReportRecordItem
    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
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Posted: 08 June 2007 at 12:05pm
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


Back to Top
Shawshank View Drop Down
Senior Member
Senior Member


Joined: 16 October 2005
Status: Offline
Points: 117
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shawshank Quote  Post ReplyReply Direct Link To This Post Posted: 08 June 2007 at 12:56pm
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
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Posted: 08 June 2007 at 1:02pm
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
Back to Top
Shawshank View Drop Down
Senior Member
Senior Member


Joined: 16 October 2005
Status: Offline
Points: 117
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shawshank Quote  Post ReplyReply Direct Link To This Post Posted: 08 June 2007 at 1:14pm
Yes, my icon is larger than 16x16. Does this then mean that the CommandBarControl can scale an icon down and the ReportControl cannot?
 
Shawshank
Back to Top
Shawshank View Drop Down
Senior Member
Senior Member


Joined: 16 October 2005
Status: Offline
Points: 117
Post Options Post Options   Thanks (0) Thanks(0)   Quote Shawshank Quote  Post ReplyReply Direct Link To This Post Posted: 08 June 2007 at 2:51pm
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
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Posted: 08 June 2007 at 2:53pm
Cool.  I never even thought of that.  I might have to try it also.

Thanks!
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.109 seconds.