當前位置: 首頁>>代碼示例>>C#>>正文


C# Ellipse.Measure方法代碼示例

本文整理匯總了C#中System.Windows.Shapes.Ellipse.Measure方法的典型用法代碼示例。如果您正苦於以下問題:C# Ellipse.Measure方法的具體用法?C# Ellipse.Measure怎麽用?C# Ellipse.Measure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Shapes.Ellipse的用法示例。


在下文中一共展示了Ellipse.Measure方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ParticleSystem

        public ParticleSystem(int maxCount, System.Windows.Media.Color color)
        {
            this.maxParticleCount = maxCount;

            this.particleList = new List<Particle>();

            this.particleModel = new GeometryModel3D();
            this.particleModel.Geometry = new MeshGeometry3D();

            Ellipse e = new Ellipse();
            e.Width = 32.0;
            e.Height = 32.0;
            RadialGradientBrush b = new RadialGradientBrush();
            b.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0xFF, color.R, color.G, color.B), 0.25));
            b.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0x00, color.R, color.G, color.B), 1.0));
            e.Fill = b;
            e.Measure(new System.Windows.Size(32, 32));
            e.Arrange(new Rect(0, 0, 32, 32));

            var brush = new VisualBrush(e);

            DiffuseMaterial material = new DiffuseMaterial(brush);

            this.particleModel.Material = material;

            this.rand = new Random(brush.GetHashCode());
        }
開發者ID:xerxesb,項目名稱:codekatas,代碼行數:27,代碼來源:ParticleSystem.cs

示例2: AddGraphicToMap_Click

        private void AddGraphicToMap_Click(object sender, RoutedEventArgs e)
        {
            // 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));

            // Add 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 = 50;
            myEllipse.Height = 50;

            //Force render
            myEllipse.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
            myEllipse.Arrange(new Rect(myEllipse.DesiredSize));

            RenderTargetBitmap render = new RenderTargetBitmap(200, 200, 150, 150, PixelFormats.Pbgra32);
            render.Render(myEllipse);

            PictureMarkerSymbol pms = new PictureMarkerSymbol()
            {
                Source = render,
            };

            Random random = new Random();
            var graphic = new Graphic() { Geometry = new MapPoint(random.Next(-20000000, 20000000), random.Next(-20000000, 20000000)) };
            graphic.Symbol = pms;
            MarkerGraphicsLayer.Graphics.Add(graphic);
        }
開發者ID:GlenDhu,項目名稱:tips-and-tricks-wpf,代碼行數:44,代碼來源:MainWindow.xaml.cs

示例3: ParticleSystem

        public ParticleSystem(int maxCount, Color color)
        {
            _maxParticleCount = maxCount;

            _particleModel = new GeometryModel3D {Geometry = new MeshGeometry3D()};

            _particleList = new List<Particle>();

            //FELO: Drawing particle: Ellipse.
            var ellipse = new Ellipse {Width = ParticleSizeConst, Height = ParticleSizeConst};
            var radialGradientBrush = new RadialGradientBrush();
            radialGradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, color.R, color.G, color.B), StandardColorOffset));
            radialGradientBrush.GradientStops.Add(new GradientStop(Color.FromArgb(0x00, color.R, color.G, color.B), StandardColorOffsetBorder));
            ellipse.Fill = radialGradientBrush;
            ellipse.Measure(new Size(ParticleSizeConst, ParticleSizeConst));
            ellipse.Arrange(new Rect(0, 0, ParticleSizeConst, ParticleSizeConst));

            ApplyMaterialToBrush(ellipse);
        }
開發者ID:smalice,項目名稱:SurfaceWPFApp,代碼行數:19,代碼來源:ParticleSystemManager.xaml.cs

示例4: ParticleSystem

        public ParticleSystem(int maxCount, Color color)
        {
            MaxParticleCount = maxCount;

            _particleList = new List<Particle>();

            _particleModel = new GeometryModel3D {Geometry = new MeshGeometry3D()};

            var e = new Ellipse
            {
                Width = 32.0,
                Height = 32.0
            };
            var b = new RadialGradientBrush();
            b.GradientStops.Add(new GradientStop(Color.FromArgb(0xFF, color.R, color.G, color.B), 0.25));
            b.GradientStops.Add(new GradientStop(Color.FromArgb(0x00, color.R, color.G, color.B), 1.0));
            e.Fill = b;
            e.Measure(new Size(32, 32));
            e.Arrange(new Rect(0, 0, 32, 32));

            Brush brush = null;

#if USE_VISUALBRUSH
            brush = new VisualBrush(e);
#else
            var renderTarget = new RenderTargetBitmap(32, 32, 96, 96, PixelFormats.Pbgra32);
            renderTarget.Render(e);
            renderTarget.Freeze();
            brush = new ImageBrush(renderTarget);
#endif

            var material = new DiffuseMaterial(brush);

            _particleModel.Material = material;

            _rand = new Random(brush.GetHashCode());
        }
開發者ID:ClemensT,項目名稱:WPF-Samples,代碼行數:37,代碼來源:ParticleSystem.cs

示例5: ParticleSystem

        public ParticleSystem(int maxCount, System.Windows.Media.Color color)
        {
            this.maxParticleCount = maxCount;

            this.particleList = new List<Particle>();

            this.particleModel = new GeometryModel3D();
            this.particleModel.Geometry = new MeshGeometry3D();

            Ellipse e = new Ellipse();
            e.Width = 32.0;
            e.Height = 32.0;
            RadialGradientBrush b = new RadialGradientBrush();
            b.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0xFF, color.R, color.G, color.B), 0.25));
            b.GradientStops.Add(new GradientStop(System.Windows.Media.Color.FromArgb(0x00, color.R, color.G, color.B), 1.0));
            e.Fill = b;
            e.Measure(new System.Windows.Size(32, 32));
            e.Arrange(new Rect(0, 0, 32, 32));

            System.Windows.Media.Brush brush = null;

            #if USE_VISUALBRUSH
            brush = new VisualBrush(e);
            #else
            RenderTargetBitmap renderTarget = new RenderTargetBitmap(32, 32, 96, 96, PixelFormats.Pbgra32);
            renderTarget.Render(e);
            renderTarget.Freeze();
            brush = new ImageBrush(renderTarget);
            #endif

            DiffuseMaterial material = new DiffuseMaterial(brush);

            this.particleModel.Material = material;

            this.rand = new Random(brush.GetHashCode());
        }
開發者ID:rcLzen,項目名稱:TicTacToe_5X5X4,代碼行數:36,代碼來源:WinParticles.xaml.cs


注:本文中的System.Windows.Shapes.Ellipse.Measure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。