// Create a diagonal linear gradient with four stops. // http://msdn.microsoft.com/en-us/library/system.windows.media.lineargradientbrush.aspx LinearGradientBrush myLinearGradientBrush = new LinearGradientBrush(); myLinearGradientBrush.StartPoint = new Point(0, 0); myLinearGradientBrush.EndPoint = new Point(1, 1); myLinearGradientBrush.GradientStops.Add( new GradientStop(Colors.Yellow, 0.0)); myLinearGradientBrush.GradientStops.Add( new GradientStop(Colors.Red, 0.25)); myLinearGradientBrush.GradientStops.Add( new GradientStop(Colors.Blue, 0.75)); myLinearGradientBrush.GradientStops.Add( new GradientStop(Colors.LimeGreen, 1.0)); // Create an Ellipse Element // http://msdn.microsoft.com/en-us/library/system.windows.shapes.ellipse.aspx Ellipse myEllipse = new Ellipse(); myEllipse.Stroke = System.Windows.Media.Brushes.Black; myEllipse.Fill = myLinearGradientBrush; myEllipse.HorizontalAlignment = HorizontalAlignment.Left; myEllipse.VerticalAlignment = VerticalAlignment.Center; myEllipse.Width = 12; myEllipse.Height = 25; //Force render myEllipse.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity)); myEllipse.Arrange(new Rect(myEllipse.DesiredSize)); // Render to an bitmap // http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.rendertargetbitmap.aspx RenderTargetBitmap render = new RenderTargetBitmap(200, 200, 150, 150, PixelFormats.Pbgra32); render.Render(myEllipse); // Use the bitmap as the source for a PMS _pms = new PictureMarkerSymbol() { Source = render, }; #. The following code would be run in a loop when creating multiple graphics: graphic.Symbol = _pms;
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.