输入此代码时出现错误:
System.Windows.Point centre = new System.Windows.Point();
centre = _bingMap.LocationToViewportPoint(pushpinLoc);
float diametre = (float)_bingMap.ZoomLevel * (25 / 4) + (5 - (25 * 17 / 4));
System.Drawing.Point[] verticies = Creation_Points(diametre / 2, centre);
Bitmap polygon = new Bitmap((int)diametre, (int)diametre);
Graphics g = Graphics.FromImage(polygon);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.DrawPolygon(Pens.Black, verticies);
bool exception = false;
try
{
_bingMap.Children.Add(g); // HERE (1)
}
catch (Exception excep)
{
exception = true;
}
finally
{
if (exception)
{
_bingMap.Children.Remove(g); // HERE (2)
}
}
由于g的类型,错误出现在(1)和(2)上。我要在我的地图上添加一个UIElement,但我不知道如何没有图形我的多边形:/
是否可以将我的图形转换为UIElements?
谢谢:)