Object Model - The AnimationFrame class - FrameImage 

Gets or sets the image associated with the AnimationFrame.

[Visual Basic]
Public Property FrameImage As Image
public Image FrameImage {get; set;}

Property Value

Any bitmap image in a format supported by the .NET framework.


This property holds the image for the AnimationFrame

Important aspects to be considered, when adding images to AnimationFrames, are the dimensions and the size of the used bitmaps. The dimensions of the used bitmap are important because they have an impact on memory-usage and performance. This applies specially to ToolTipsFactory Animations, which are composed of many individual AnimationFrames.

Of course it is perfectly possible to use images with millions of pixels. But images with this dimensions do not make much sense, if they are going to be shown in a tooltip which is only 200 to 500 pixels wide. The details of such high-resolution images get lost anyway in the process and the bitmaps just consume a lot of memory. This and the internal downscaling of the images are also notable in terms of performance. The Animation will be significantly slowed down, when over-dimensioned bitmaps are used as with appropriately sized images.

The file-size of the images is important because it has a direct impact on the size of the compiled executable. Any image added as FrameImage to an Animation at design-time (see "The Animation-Editor") will end up as a resource in the compiled application. Therefore it should be avoided to use multi-megabyte image-files as FrameImages, if you don't want your executable to inflate like a balloon.

You should also keep in mind, that high-resolution images, which maybe are not that big as files, because they are highly compressed JPEG-files, need to get decompressed and end up using quiet a lot of RAM as Image-objects in your application (e.g.: a single 400k JPEG-image with 1536 x 2048 pixels uses up to 10 mb of RAM when residing in memory as a bitmap - imagine what happens, if you have an Animation with 100 frames....). 

There are no golden rules on how to address this issues. The ToolTipsFactory tooltips are definitely able to handle even very large images and you are free to use them if really necessary. But specially for Animations it is strongly suggested to scale the images down to a size that is in the range of the expected or desired tooltip-size. The Animation-Editor accessible in Visual Studio provides the necessary means to reduce the size of FrameImages (see "One size fits all") . 


'Create a new AnimationFrame

Dim myFrame As AnimationFrame

Dim myImage As Image = Image.FromFile("C:\Temp\Photo1.jpg")

myFrame = As AnimationFrame(myImage)

'change the default DisplayTime (30 ms)

'to 10 seconds....

myFrame.DisplayTime = 10000


'assign a new Image to FrameImage

Dim modifiedImage As Image = PaintSomething(myImage)

myFrame.FrameImage = modifiedImage