Styles – Pitney Bowes MapXtreme User Manual
Page 476

Appendix B: Customizing MapXtreme
Customizable Classes
MapXtreme v7.1
483
Developer Guide
Styles
The following classes can be used to add customization to your collections of styles to apply to
objects.
BitmapPointStyleRepository
The BitmapPointStyleRepository class is used to iterate through all current bitmap point styles and
allows you to add new bitmap images from a specified directory. Using the Refresh() method places
any new bitmap images into the repository that holds all images. The following code sample
demonstrates the reloading of the collection of images used for BitmapPointStyles from a directory
named “C:\MyData\MyBitmapImages.”
using MapInfo.Styles;
StyleRepository styleRepository = Session.Current.StyleRepository;
BitmapPointStyleRepository bmpPointStyleRepository =
styleRepository.BitmapPointStyleRepository;
bmpPointStyleRepository.Reload("C:\MyData\MyBitmapImages");
InteriorStyleRepository
The InteriorStyleRepository class is used to iterate through all current interior styles and allows you
to add new bitmap images for new interior styles from a specified directory. To add onto the current
set of interior patterns used to fill regions use the AppendBitmapPattern() method. The following
code sample demonstrates adding a new BMP image to the InteriorStyleRepository.
using MapInfo.Styles;
StyleRepository styleRepository = Session.Current.StyleRepository;
InteriorStyleRepository interiorStyleRepository =
styleRepository.InteriorStyleRepository;
// AppendBitmapPattern returns the zero-based index of the pattern in
// the repository. The index returned may be used to
// retrieve a SimpleInterior style using the repository indexer.
int index = interiorStyleRepository.AppendBitmapPattern(
"C:\MyImages\trees.bmp"
);
if (index >= 0)
{
SimpleInterior style =
(SimpleInterior)interiorStyleRepository[index];
}
LineStyleRepository
The LineStyleRepository class is used to iterate through all current line styles and allows you to add
new line styles. (You can use the Reload() method to put the new file into the repository. The
following sample code demonstrates reloading the collection of line style patterns used for
SimpleLineStyles from a PEN file in the “C:\MyData” directory.
using MapInfo.Styles;