Object applies mapobjects in C # (layer callout)
Summary: Mapobjects CSharp. NET
Author: Yang Yutin Blue_Bat@126.Com
In MO automatic annotation needs to use the Labelrenderer object, the general annotation process needs to set a suitable font, below gives the code which I implements.
Implementation code:
Works well for point layers
Get the layer that needs to be annotated
Mapobjects2.maplayer Lyr = (mapobjects2.maplayer) axMap1.Layers.Item (0);//I use the world map, 0 floors for the city
Mapobjects2.labelrenderer lb = new Mapobjects2.labelrendererclass ();//Create Callout Object
Lb. field = "Name";//Automatically callout fields from the source. The layer I added to 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 the font
Sym. Font.Name = "Song body";//Set Font
Sym. Font.Bold = false;//Bold display
Sym. color = (UINT) mapobjects2.colorconstants.mored;//Set callout text colors
Sym. Font.Size = 10;//※ Set Font size
Sym. Height = 5000;
Lb. AllowDuplicates = true;//Allow duplicates
Lyr. Renderer = lb;//A set of annotations to the current layer
The method set above will not change the font size with the zoom of the map, and the utility is higher. Of course, we can also set the callout to zoom in with the map, by logging off the code sym above. Font.Size = 10;//※ Set Font size
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.