Apply MapObjects in C # (Layer)
Summary: MapObjects Csharp .NET
Author: Yang Yutian Blue_Bat@126.Com
Automatic labeling in Mo requires the use of the Labelrenderer object, and a suitable font is required during the general label, and the code I implemented will be given.
Implement code:
/ / Good effect for points
// Get the layer that needs to be marked
MapObjects2.maplayer lyr = (mapobjects2.maplayer) axmap1.layers.Item (0); // I am using the world map, 0 layers are city
MapObjects2.labelrenderer lb = new mapbjects2.LabelrendererClass (); // Create a label object
lb.field = "name"; // automatically labeled the source of the source. The layer added in the map is Esri SharpFiles format, this 'name' is the field name in the DBF file.
MapObjects2.textSymbol Sym = lb.get_symbol (0); // Define SYM to set fonts
Sym.font.name = "Song"; // Setting the font
Sym.font.bold = false; // bold display
Sym.color = (uint) mapobjects2.colorconstants.mored; // Setting label text color
Sym.font.size = 10; // ※ Set the font size
//sym.height = 5000;
lb.allowduplicates = true; // Allow repeat
lyr.renderer = lb; // Set good label to the current layer
The font of the above method does not change the font size as the map is magnified, and the practicability is high. Of course, we can also set the markup marked with the map, the method is to log out the code Sym.font.size = 10; // ※ Set the font size
And cancel the following code
//sym.height = 5000;
Comment.