Showing posts with label graphics. Show all posts
Showing posts with label graphics. Show all posts

Thursday, March 28, 2013

BitmapImage.BeginInit()

A very common error new UI developers make is trying to create new BitmapImages without properly initializing them.

All property changes made to a BitmapImage must be made between the BeginInit() and EndInit() calls. Every property change made after the EndInit() call is ignored.

Here is a small code snippet on how to properly create a new bitmap image and set that as the source of an Image object.

// Define a BitmapImage.
Image myImage = new Image();
BitmapImage bi = new BitmapImage();

// Begin initialization.
bi.BeginInit();

// Set BitmapImage properties. (CacheOption,CreateOptions… etc.)

// End initialization.
bi.EndInit();


myImage.Source = bi;


Thursday, July 5, 2012

How to Create a Custom Stroke in Expression Design

 

1) First, draw whatever you want to be used as a stroke. In this case, I will drew an ant.

image

2) Select the paths with the selection tool and go to Object > Stroke > New Stroke Definition

image

This will open up a new tab that look something like this

image

3) Select everything with the selection tool and right click. You should see this:

image

This gives you the option to anchor the image and make repeating. In my case, I want the ants to repeat, so I select that.

4) File >  Save

image

Give your stroke an appropriate name.

That’s it. Now you should be able to use your stroke in your designs.

image

With this new stroke, I can now make a line of ants following whatever path I want.

image

I hope this helps! Have fun!