Component Designs Support Forums
CDI Support Forums

Forums | Login | Join | My Profile | Inbox | Address Book | My Subscription  
My Forums | Member List | Search | Contact Admin | Log Out  

How to change image when it is runtime?

 
Logged in as: Guest
  Printable Version
All Forums >> [Components] >> IndexCards 3D >> How to change image when it is runtime? Page: [1]
Login
Message << Older Topic   Newer Topic >>
How to change image when it is runtime? - 1/7/2010 10:03:58 PM   
xiaojun.Li

 

Posts: 4
Joined: 1/7/2010
Status: offline
Dear all,
I want to change image to another when program is running, I should how to do ?
Thanks!
Post #: 1
RE: How to change image when it is runtime? - 1/8/2010 10:05:41 AM   
Maxx

 

Posts: 287
Joined: 3/22/2004
Status: offline
You can change any card using code similar to this.

Dim crd As CDI.IndexCard3D.Card = iC3D1.IndexCards[3] 'this will grab the 4th card in the list of cards
crd.ImagePath = "c:\....\myimage.jpg"
iC3D1.Invalidate()

The crd object contains everything about the card you are modifying including Text, BackImage etc.

Hope that helps.



_____________________________

Director of CDI Support

(in reply to xiaojun.Li)
Post #: 2
RE: How to change image when it is runtime? - 1/18/2010 8:23:56 PM   
xiaojun.Li

 

Posts: 4
Joined: 1/7/2010
Status: offline
Thanks,it is exactly what i need.

(in reply to Maxx)
Post #: 3
RE: How to change image when it is runtime? - 1/18/2010 11:03:04 PM   
xiaojun.Li

 

Posts: 4
Joined: 1/7/2010
Status: offline
quote:

Dim crd As CDI.IndexCard3D.Card = iC3D1.IndexCards[3] 'this will grab the 4th card in the list of cards
crd.ImagePath = "c:\....\myimage.jpg"


Hello Maxx,
I try it according to your resolution, but alert "Index was outside the bounds of the array." information, why?

Thanks!

(in reply to Maxx)
Post #: 4
RE: How to change image when it is runtime? - 1/20/2010 7:11:19 AM   
Maxx

 

Posts: 287
Joined: 3/22/2004
Status: offline
This can happen if you try to retrieve a card that is past the last card loaded. If you only had two cards and you tried to read the 3rd one this error would occur.

If you are not using the CacheLoading option you also need to call

iC3D1.IndexCards.LoadTexturesToMemory()

before trying to overwritte a card with a different image. The reason is, the cards have not been written to video memory yet. If you try to replace the card, it tries to update the video memory of where the card should be, but since we didn't load it yet it will cause an error.


_____________________________

Director of CDI Support

(in reply to xiaojun.Li)
Post #: 5
Page:   [1]
All Forums >> [Components] >> IndexCards 3D >> How to change image when it is runtime? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


© Copyright Component Designs, Inc. 2001-2005. All rights reserved.

0.031