Dictionary
If one item (for example, an image or an icon) is used in several places in a document, you can store that item once in a location available from the whole document and reference that instance, rather than inserting the same image or icon in every place it is used. For that, C1PrintDocument provides a dictionary.
To access the dictionary, use the Dictionary property. The dictionary contains items of the base type DictionaryItem, which is an abstract type. Two derived classes are provided, DictionaryImage and DictionaryIcon, to store images and icons correspondingly. Items in the dictionary are referenced by names. In order to use an item, you must assign a name to it. The name must be unique within the dictionary.
Dictionary items may be used in the following places in the document:
• As the background image of a style, using the property BackgroundImageName.
• As the image in a RenderImage object, using the property ImageName.
So, if in your document the same image is used in several places, do the following:
• Add the image to the dictionary, for instance like this:
Me.C1PrintDocument1.Dictionary.Add(New C1.C1Preview.DictionaryImage("image1", Image.FromFile("myImage.jpg")))
• C#
this.c1PrintDocument1.Dictionary.Add(new DictionaryImage("image1", Image.FromFile("myImage.jpg")));
• Use that image by setting either the BackgroundImageName on styles, or the ImageName property on render images, for example, like this:
Dim ri As New C1.C1Preview.RenderImage()
ri.ImageName = "image1"
• C#
RenderImage ri = new RenderImage();
ri.ImageName = "image1";
|