It is said that a popular word called devigner is actually to combine the words designer and developer. However, we can see a trend from this word. In the future, web development will become simpler and simpler. We once had a headache about how to effectively cooperate designers and programmers, because designers generally do not understand program development, and it is difficult for developers to make beautiful results. Of course, it is not ruled out that there are some abnormal big cows, wandering in the "I am the best programming designer, I have the most artistic cells among programmers" and this kind of state is not flat. In fact, I am not very familiar with Microsoft Visual Studio 2008. I only learned vesl development a few days ago and found that vs2008 is reflecting the concept of devigner. As mentioned in the previous example, there are two ways to display a map: Using XAML and C # code. If I understand it well, XAML is intended for designers, while C # is intended for developers. Sorry, in fact, I am mainly responsible for marketing work, but I am not doing development, so vs2008 is rarely used at ordinary times. However, the advantage is that the development examples I have written do not have high requirements on the reader's development level :) now that you are away from the question, let's have a look. Currently, the Virtual Earth Silverlight (vesl) map control is only based on the virtual Earth global platform, and the map of China region is in English version. I am communicating with the headquarters to see if I can build a vesl Based on the ve China Map platform. I continued to run my questions. Some of my friends reported that my blog was too professional. It was just a book for non-IT friends. In fact, such a photo is not my style, and I don't want to be so professional either. Next, let's see if I can write a development reference in the form of novels? Who specifies how to write a professional blog. However, we still need to have some basic knowledge on how to get started. Otherwise, we don't even know how to start.
If you have developed a javascript-based example, it is not difficult to develop vesl. Of course, if you didn't know anything about Virtual Earth development before, I tried to describe it simpler.
From the common sense, each polygon should have some basic attributes, such as fill color, border, transparency, and so on. Similarly, we need to define these attributes when initializing a polygon instance.
- Fill-How to fill a polygon? It is a brush object.
- Stroke-What is the border of a polygon? It is also a brush object.
- Strokethickness-Border width, double precision value
- Opacity-Polygon transparency, double precision value
Call map. Children. Add () when adding a polygon to a map.
- Add a polygon through a program
Mappolygon polygon = new mappolygon (); // initialize a polygon instance.
Polygon. Fill = new solidcolorbrush (colors. Red); // defines the filled red color.
Polygon. Stroke = new solidcolorbrush (colors. Yellow); // defines the border yellow
Polygon. strokethickness = 5; // The Border width is 5.
Polygon. Opacity = 0.7; // transparency 70%
Polygon. Locations = new locationcollection () // positions of several polygon vertices
{
New location (20,-20 ),
New location (20, 20 ),
New location (-20, 20 ),
New location (-20,-20)
};
Map1.addchild (polygon );
// Map1.children. Add (polygon); // It indicates the last line.
<Usercontrol X: class = "virtualearthsilverlightapplication1.page"
Xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
Xmlns: M = "CLR-namespace: Microsoft. virtualearth. mapcontrol; Assembly = Microsoft. virtualearth. mapcontrol"
Width = "400" Height = "300">
<Grid X: Name = "layoutroot" background = "white">
<M: Map Name = "map1">
<M: map. Children>
<M: mappolygon fill = "red" stroke = "yellow" strokethickness = "5" opacity = "0.7"> // defines attributes of a polygon.
<M: mappolygon. Locations>
<M: locationcollection> // defines the polygon vertex.
<M: Location> 20,-20 </M: Location>
<M: Location> 20, 20 </M: Location>
<M: Location>-20, 20 </M: Location>
<M: Location>-20,-20 </M: Location>
</M: locationcollection>
</M: mappolygon. Locations>
</M: mappolygon>
</M: map. Children>
</M: Map>
</GRID>
</Usercontrol>
In fact, there is little difference between adding a line and adding a polygon. Let's look at the source code:
- Add a polygon through a program
Mappolyline polyline = new mappolyline ();
Polyline. Stroke = new solidcolorbrush (colors. Yellow );
Polyline. strokethickness = 5;
Polyline. Opacity = 0.7;
Polyline. Locations = new locationcollection ()
{
New location (10,-10 ),
New location (10, 10 ),
New location (-10,-10 ),
New location (-10, 10)
};
Map1.addchild (polyline );
// Map1.children. Add (polyline); // <-this also works just the same
<Usercontrol X: class = "virtualearthsilverlightapplication1.page"
Xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
Xmlns: M = "CLR-namespace: Microsoft. virtualearth. mapcontrol; Assembly = Microsoft. virtualearth. mapcontrol"
Width = "400" Height = "300">
<Grid X: Name = "layoutroot" background = "white">
<M: Map Name = "map1">
<M: map. Children>
<M: mappolyline stroke = "yellow" strokethickness = "5" opacity = "0.7">
<M: mappolyline. Locations>
<M: locationcollection>
<M: Location> 10,-10 </M: Location>
<M: Location> 10, 10 </M: Location>
<M: Location>-10,-10 </M: Location>
<M: Location>-10, 10 </M: Location>
</M: locationcollection>
</M: mappolyline. Locations>
</M: mappolyline>
</M: map. Children>
</M: Map>
</GRID>
</Usercontrol>
Try it by yourself.