Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
Hi, We recommend you use cached image fill styles instead of cached bitmaps. If you have many shapes that are animated with these fill styles, you'd better use style sheets. Regarding your other question – please send your questions to support@nevron.com, because this is not a common topic and it is less likely the information we send you to be very valuable for the other users.
Best Regards, Nevron Support Team
|
Group: Forum Members
Last Active: 13 Years Ago
Posts: 16,
Visits: 1
|
I have custom shape that displays a bitmap using a rectangle shape and NImageFillStyle like so:
MyRect.Style.FillStyle = new NImageFillStyle(MyImageBitmap1);
Descended from this custom shape is an Animated Shape. The Animate function is called on a timer tick and simply changes the FillStyle, (See below). Is this the best way to do this? Is there anything I have to dispose, to avoid a memory leak?
protected void Animate() {
//////////////////////////////////////// // Check to see if there is a bitmap // for the index. If not, go to the next // one and try again. If so, break from // our loop. Always break on Index 0 bool Found = false; while (!Found) { MyImageIndex++; if (MyImageIndex > 4) MyImageIndex = 0; switch (MyImageIndex) { case 0: if (MyImageBitmap1 != null) MyRect.Style.FillStyle = new NImageFillStyle(MyImageBitmap1); Found = true; break; case 1: if (MyImageBitmap2 != null) { MyRect.Style.FillStyle = new NImageFillStyle(MyImageBitmap2); Found = true; } break; case 2: if (MyImageBitmap3 != null) { MyRect.Style.FillStyle = new NImageFillStyle(MyImageBitmap3); Found = true; } break; case 3: if (MyImageBitmap4 != null) { MyRect.Style.FillStyle = new NImageFillStyle(MyImageBitmap4); Found = true; } break; case 4: if (MyImageBitmap5 != null) { MyRect.Style.FillStyle = new NImageFillStyle(MyImageBitmap5); Found = true; } break; } } // end while not found }
As an aside, I am porting an application from a competitor's diagram tool. I have a few questions on trying to map some of their functionality to yours. Do you prefer that I post one question per thread, or do you prefer I post all my questions in one thread?
|