本文整理汇总了C#中System.Windows.Media.EllipseGeometry类的典型用法代码示例。如果您正苦于以下问题:C# EllipseGeometry类的具体用法?C# EllipseGeometry怎么用?C# EllipseGeometry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EllipseGeometry类属于System.Windows.Media命名空间,在下文中一共展示了EllipseGeometry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Ellipse
public Ellipse(Vector centerPt, int radius1, int radius2)
{
Geometry = new EllipseGeometry(centerPt.ToWindowsPt(), (double)radius1, (double)radius2);
DrawMe = true;
BoundingRectangle = Geometry.Bounds;
CenterPoint = centerPt;
}
开发者ID:Amichai,项目名称:ObstructedRandomWalker,代码行数:7,代码来源:IObstruction.cs
示例2: MainWindow
public MainWindow()
{
InitializeComponent();
drawingGroup = new DrawingGroup();
// Создаем объект для описания геометрической фигуры
GeometryDrawing geometryDrawing = new GeometryDrawing();
// Описываем и сохраняем геометрию квадрата
RectangleGeometry rectGeometry = new RectangleGeometry();
rectGeometry.Rect = new Rect(0, 0, 10, 10);
geometryDrawing.Geometry = rectGeometry;
// Настраиваем перо и кисть
geometryDrawing.Pen = new Pen(Brushes.Red, 0.005);// Перо рамки
geometryDrawing.Brush = Brushes.LightBlue;// Кисть закраски
// Добавляем готовый слой в контейнер отображения
drawingGroup.Children.Add(geometryDrawing);
GeometryDrawing ellipsgeomy = new GeometryDrawing();
EllipseGeometry elgeometry = new EllipseGeometry(new Point(5, 5), 2, 2);
ellipsgeomy.Geometry = elgeometry;
ellipsgeomy.Brush = Brushes.White;
drawingGroup.Children.Add(ellipsgeomy);
}
开发者ID:EugeneMurashko,项目名称:git-test,代码行数:31,代码来源:MainWindow.xaml.cs
示例3: ResizeChrome
static ResizeChrome()
{
TransparentBrush = Brushes.Transparent;
TransparentBrush.Freeze();
var borderBrush = new LinearGradientBrush()
{
Opacity = 0.7,
StartPoint = new Point(0, 0),
EndPoint = new Point(1, 0.3),
};
borderBrush.GradientStops.Add(new GradientStop(Colors.SlateBlue, 0));
borderBrush.GradientStops.Add(new GradientStop(Colors.LightBlue, 0.5));
borderBrush.GradientStops.Add(new GradientStop(Colors.SlateBlue, 1));
borderBrush.Freeze();
BorderBrush = borderBrush;
var thumbBrush = new RadialGradientBrush()
{
Center = new Point(0.3, 0.3),
GradientOrigin = new Point(0.3, 0.3),
RadiusX = 0.7,
RadiusY = 0.7,
};
thumbBrush.GradientStops.Add(new GradientStop(Colors.White, 0));
thumbBrush.GradientStops.Add(new GradientStop(Colors.DarkSlateBlue, 0.9));
thumbBrush.Freeze();
ThumbBrush = thumbBrush;
TransparentPen = new Pen(TransparentBrush, 3.5);
BorderPen = new Pen(BorderBrush, 2);
BorderPen.DashStyle = DashStyles.Dash;
ThumbGeometry = new EllipseGeometry();
UpdateZoom(1);
}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:33,代码来源:ResizeChrome.cs
示例4: invalidate
/// <summary>
/// This creates the circular clip around this control
/// </summary>
private void invalidate() {
if (Radius >= 0 && Radius * 2 <= Width) {
//decide the center of the circular region
double centerX = this.Height / 2;
double centerY = this.Width / 2;
//create the clip geometry
EllipseGeometry geom = new EllipseGeometry();
geom.RadiusY = Radius - thickness;
geom.RadiusX = Radius - thickness;
geom.Center = new Point(centerX, centerY);
//apply the clip to this control
image.Clip = geom;
//now setup the shape outline
outline.Width = Radius * 2;
outline.Height = Radius * 2;
//set the location of the notification
double coord = (Width / 1.732) - Radius;
notification.Margin = new Thickness(coord, coord, 0, 0);
}
}
开发者ID:StefanR88,项目名称:SillyUIControls,代码行数:29,代码来源:ChatHead.xaml.cs
示例5: Circle
public Circle()
{
_Circle = new EllipseGeometry();
this.Height = 9;
this.Width = 9;
this.Fill = Brushes.Red;
this.Stroke = Brushes.Black;
}
开发者ID:jwall9108,项目名称:DnA-Animation,代码行数:8,代码来源:Circle.cs
示例6: OnRender
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
var ellipse = new EllipseGeometry(new Point(250, 50), 50, 50);
var drawing = new GeometryDrawing(Brushes.BlueViolet, new Pen(Brushes.Bisque, 2), ellipse);
drawingContext.DrawDrawing(drawing);
}
开发者ID:BerdyPango,项目名称:Researches,代码行数:8,代码来源:02_MyEllipseGeometry.cs
示例7: DrawMenu
public override Canvas DrawMenu()
{
Canvas canvas=new Canvas();
//draw inner circle
EllipseGeometry center = new EllipseGeometry(new Point(0, 0), smlrad, smlrad);
Path circle = new Path();
circle.Data = center;
circle.Fill = children.Get(0).BackGroundBrush;
circle.Stroke = Brushes.Black;
canvas.Children.Add(circle);
children.Get(0).Button.Content = circle;
TextBlock MiddleText = children.Get(0).GetTextBlockNoTransform();
MiddleText.Width = smlrad * 2;
MiddleText.RenderTransform = new TranslateTransform(-smlrad, 0);
canvas.Children.Add(MiddleText);
//draw outer ring
for(int i=1;i<children.Count();i++)
{
Square block = children.Get(i);
PathFigure figure = new PathFigure();
figure.StartPoint=new Point(smlrad*Math.Cos(baseAngle*i),smlrad*Math.Sin(baseAngle*i));
figure.Segments.Add(new LineSegment(new Point(lrgrad*Math.Cos(baseAngle*i),lrgrad*Math.Sin(baseAngle*i)),true));
figure.Segments.Add(new ArcSegment(new Point(lrgrad*Math.Cos(baseAngle*(i+1)),lrgrad*Math.Sin(baseAngle*(i+1))),new Size(lrgrad,lrgrad),0,false,SweepDirection.Clockwise,true));
figure.Segments.Add(new LineSegment(new Point(smlrad*Math.Cos(baseAngle*(i+1)),smlrad*Math.Sin(baseAngle*(1+i))),true));
figure.Segments.Add(new ArcSegment(new Point( smlrad * Math.Cos(baseAngle * i), smlrad * Math.Sin(baseAngle * i)), new Size(smlrad, smlrad), 0, false, SweepDirection.Counterclockwise, true));
PathGeometry geometry=new PathGeometry();
geometry.Figures.Add(figure);
Path path = new Path();
path.Data = geometry;
block.Button.Content = path;
path.Fill = block.BackGroundBrush;
path.Stroke = Brushes.Black;
TextBlock text=block.GetTextBlockNoTransform();
TransformGroup transform = new TransformGroup();
//angle the text properly
transform.Children.Add(new RotateTransform(- 0.5 * (baseAngle * 180 / Math.PI)));
//move the text down into the right radious from center
transform.Children.Add(new TranslateTransform(0,(lrgrad+smlrad)*0.5));
//rotate to the correct section - 0.5 * (baseAngle * 180 / Math.PI)
transform.Children.Add(new RotateTransform((baseAngle *i* 180 / Math.PI) - 0.5 * (baseAngle * 180 / Math.PI)));
text.RenderTransform = transform;
text.Width = FindWidthOfTriangles();
// text.RenderTransform = new TranslateTransform(50, 200);
canvas.Children.Add(path);
canvas.Children.Add(text);
}
canvas.HorizontalAlignment = HorizontalAlignment.Center;
canvas.VerticalAlignment = VerticalAlignment.Center;
return canvas;
}
开发者ID:RiedigerD2,项目名称:OpenHouse,代码行数:57,代码来源:StartMenu.cs
示例8: Hyperlink_Click
private void Hyperlink_Click(object sender, RoutedEventArgs e)
{
var hyperlink = (Hyperlink) sender;
var vm = (TaskAreaItemsViewModel) hyperlink.DataContext;
var contextMenu = new ContextMenu {PlacementTarget = (UIElement) hyperlink.Parent, Placement = PlacementMode.Right, HorizontalOffset = 14, DataContext = vm,
Style = (Style) FindResource("TaskAreaContextMenuStyle")};
bool prevWasGroup = false;
foreach (TaskAreaViewModelBase item in vm.Items)
{
var group = item as TaskAreaCommandGroupViewModel;
if (group != null)
{
if (contextMenu.Items.Count > 0)
contextMenu.Items.Add(new Separator {Style = (Style) FindResource("TaskAreaSeparatorStyle")});
foreach (TaskAreaCommandViewModel command in group.Commands)
{
var menuItem = new MenuItem {Header = command.DisplayName, Command = command.Command, DataContext = command, Tag = group, Style = (Style) FindResource("TaskAreaMenuItemStyle")};
menuItem.Click += menuItem_Click;
if (command == group.SelectedCommand)
{
var geometry = new EllipseGeometry(new Point(0, 0), 3, 3);
var drawingBrush = new DrawingBrush(new GeometryDrawing {Brush = Brushes.Black, Geometry = geometry}) {Stretch = Stretch.None};
menuItem.Icon = new Image {Source = new DrawingImage(drawingBrush.Drawing)};
}
contextMenu.Items.Add(menuItem);
}
prevWasGroup = true;
}
else
{
if (prevWasGroup)
contextMenu.Items.Add(new Separator {Style = (Style) FindResource("TaskAreaSeparatorStyle")});
prevWasGroup = false;
var command = item as TaskAreaCommandViewModel;
if (command != null)
{
var menuItem = new MenuItem {Header = command.DisplayName, Command = command.Command, DataContext = command, Style = (Style) FindResource("TaskAreaMenuItemStyle")};
contextMenu.Items.Add(menuItem);
}
else
{
var booleanItem = item as TaskAreaBooleanViewModel;
if (booleanItem != null)
{
var menuItem = new MenuItem {Header = booleanItem.DisplayName, DataContext = booleanItem, Style = (Style) FindResource("TaskAreaMenuItemStyle"), IsCheckable = true};
menuItem.SetBinding(MenuItem.IsCheckedProperty, "Value");
contextMenu.Items.Add(menuItem);
}
}
}
}
contextMenu.IsOpen = true;
}
开发者ID:rmunn,项目名称:cog,代码行数:57,代码来源:TaskAreaItemsView.xaml.cs
示例9: DrawCircle
public static void DrawCircle(this DrawingGroup drawingGroup, Point centerPoint, double radius, SolidColorBrush brush, Pen pen = null)
{
if (pen == null)
pen = new Pen(brush, 1);
var circle = new EllipseGeometry(centerPoint, radius, radius);
var circleDrawing = new GeometryDrawing(brush, pen, circle);
drawingGroup.Children.Add(circleDrawing);
}
开发者ID:W0dan,项目名称:physicsExperiments,代码行数:9,代码来源:DrawingGroupExtensions.cs
示例10: OnRender
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
EllipseGeometry ellipse = new EllipseGeometry(new Point(150, 150), 50, 20);
RectangleGeometry rect = new RectangleGeometry(new Rect(150, 150, 50, 20), 5, 5);
//Geometry.Combin()静态方法与使用CombinedGeometry对象进行图形合并差不多
//其中Geometry.Combin()静态方法中有用于图形变换的参数(旋转,缩放等),如果不需要变换则填写null
PathGeometry combin = Geometry.Combine(ellipse, rect, GeometryCombineMode.Xor, null);
drawingContext.DrawGeometry(Brushes.LightBlue, new Pen(Brushes.Green, 2), combin);
}
开发者ID:BerdyPango,项目名称:Researches,代码行数:11,代码来源:05_MyPathGeometry.cs
示例11: MainWindow
public MainWindow()
{
InitializeComponent();
this.Loaded += (sender, e) =>{
EllipseGeometry elli = new EllipseGeometry(new Rect(new Size(100, 50)));
//elli.Width = 50;
//elli.Height = 100;
recRed.Clip = elli;
};
}
开发者ID:powernick,项目名称:CodeLib,代码行数:12,代码来源:MainWindow.xaml.cs
示例12: DrawCircleOutline
//Draws outline from inside line boundry to outside line boundry
public void DrawCircleOutline(Color color)
{
using (DrawingContext dc = this.RenderOpen())
{
EllipseGeometry bigEllips = new EllipseGeometry(centre, radius, radius);
EllipseGeometry smallEllips = new EllipseGeometry(centre, radius - lineThickness, radius - lineThickness);
CombinedGeometry ellipseOutline = new CombinedGeometry(GeometryCombineMode.Exclude, bigEllips, smallEllips);
dc.DrawGeometry(new SolidColorBrush(color), new Pen(new SolidColorBrush(color), 1), ellipseOutline);
}
}
开发者ID:annaleida,项目名称:embryosegmenter,代码行数:13,代码来源:Circle.cs
示例13: BuildDrawing
StackPanel BuildDrawing()
{
GeometryDrawing drawing = new GeometryDrawing();
// Use geometries to describe two overlapping ellipses.
EllipseGeometry ellipse1 = new EllipseGeometry();
ellipse1.RadiusX = 20;
ellipse1.RadiusY = 45;
ellipse1.Center = new Point(50, 50);
EllipseGeometry ellipse2 = new EllipseGeometry();
ellipse2.RadiusX = 45;
ellipse2.RadiusY = 20;
ellipse2.Center = new Point(50, 50);
GeometryGroup ellipses = new GeometryGroup();
ellipses.Children.Add(ellipse1);
ellipses.Children.Add(ellipse2);
// Add the geometry to the drawing.
drawing.Geometry = ellipses;
// Specify the drawing's fill.
drawing.Brush = Brushes.Blue;
// Specify the drawing's stroke.
Pen stroke = new Pen();
stroke.Thickness = 10.0;
stroke.Brush = new LinearGradientBrush(
Colors.Black, Colors.Gray, new Point(0, 0), new Point(1, 1));
drawing.Pen = stroke;
// Create a DrawingBrush
DrawingBrush myDrawingBrush = new DrawingBrush();
myDrawingBrush.Drawing = drawing;
// Create a Rectangle element.
Rectangle aRectangle = new Rectangle();
aRectangle.Width = 150;
aRectangle.Height = 150;
aRectangle.Stroke = Brushes.Black;
aRectangle.StrokeThickness = 1.0;
// Use the DrawingBrush to paint the rectangle's
// background.
aRectangle.Fill = myDrawingBrush;
StackPanel mainPanel = new StackPanel();
mainPanel.Children.Add(aRectangle);
mainPanel.Arrange(new Rect(100, 100, 500, 500));
//this.drawing2 = mainPanel;
//this.Content = mainPanel;
return mainPanel;
}
开发者ID:vronikp,项目名称:EventRegistration,代码行数:53,代码来源:DrawingTest.xaml.cs
示例14: Wipe
public void Wipe(TransitionerSlide fromSlide, TransitionerSlide toSlide, Point origin, IZIndexController zIndexController)
{
if (fromSlide == null) throw new ArgumentNullException(nameof(fromSlide));
if (toSlide == null) throw new ArgumentNullException(nameof(toSlide));
if (zIndexController == null) throw new ArgumentNullException(nameof(zIndexController));
var horizontalProportion = Math.Max(1.0 - origin.X, 1.0 * origin.X);
var verticalProportion = Math.Max(1.0 - origin.Y, 1.0 * origin.Y);
var radius = Math.Sqrt(Math.Pow(toSlide.ActualWidth * horizontalProportion, 2) + Math.Pow(toSlide.ActualHeight * verticalProportion, 2));
var scaleTransform = new ScaleTransform(0, 0);
var translateTransform = new TranslateTransform(toSlide.ActualWidth * origin.X, toSlide.ActualHeight * origin.Y);
var transformGroup = new TransformGroup();
transformGroup.Children.Add(scaleTransform);
transformGroup.Children.Add(translateTransform);
var ellipseGeomotry = new EllipseGeometry()
{
RadiusX = radius,
RadiusY = radius,
Transform = transformGroup
};
toSlide.SetCurrentValue(UIElement.ClipProperty, ellipseGeomotry);
zIndexController.Stack(toSlide, fromSlide);
var zeroKeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero);
var midKeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(200));
var endKeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(400));
var opacityAnimation = new DoubleAnimationUsingKeyFrames();
opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(1, zeroKeyTime));
opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(1, midKeyTime));
opacityAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(0, endKeyTime));
opacityAnimation.Completed += (sender, args) =>
{
fromSlide.BeginAnimation(UIElement.OpacityProperty, null);
fromSlide.Opacity = 0;
};
fromSlide.BeginAnimation(UIElement.OpacityProperty, opacityAnimation);
var scaleAnimation = new DoubleAnimationUsingKeyFrames();
scaleAnimation.Completed += (sender, args) =>
{
toSlide.SetCurrentValue(UIElement.ClipProperty, null);
fromSlide.BeginAnimation(UIElement.OpacityProperty, null);
fromSlide.Opacity = 0;
};
scaleAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(0, zeroKeyTime));
scaleAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(1, endKeyTime));
scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleAnimation);
scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleAnimation);
}
开发者ID:Chandu-cuddle,项目名称:MaterialDesignInXamlToolkit,代码行数:52,代码来源:CircleWipe.cs
示例15: OnRender
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
EllipseGeometry ellipse = new EllipseGeometry(new Point(350, 50), 50, 20);
RectangleGeometry rect = new RectangleGeometry(new Rect(350, 50, 50, 20), 5, 5);
GeometryGroup group = new GeometryGroup();
group.Children.Add(ellipse);
group.Children.Add(rect);
group.FillRule = FillRule.EvenOdd;
drawingContext.DrawGeometry(Brushes.Black, new Pen(Brushes.Aqua, 3), group);
}
开发者ID:BerdyPango,项目名称:Researches,代码行数:13,代码来源:03_MyCompositeGeometry.cs
示例16: Contains
/// <summary>
/// Test whether object contains point
/// </summary>
public override bool Contains(Point point)
{
if ( IsSelected )
{
return this.Rectangle.Contains(point);
}
else
{
EllipseGeometry g = new EllipseGeometry(Rectangle);
return g.FillContains(point) || g.StrokeContains(new Pen(Brushes.Black, ActualLineWidth), point);
}
}
开发者ID:VictorHelios,项目名称:OpenCVBestPractice,代码行数:16,代码来源:GraphicsEllipse.cs
示例17: AddJunc
//添加单个检查井
/// <summary>
/// 增加井盖
/// </summary>
/// <param name="cover"></param>
/// <param name="cp"></param>
public void AddJunc(Cover cover, Point cp)
{
Path path = new Path();
path.Fill = cover.GetColorBrush();
path.Stroke = colorCenter.UnSelected_Border_Color;
EllipseGeometry eg = new EllipseGeometry();
eg.Center = cp;
eg.RadiusX = App.StrokeThinkness;
eg.RadiusY = App.StrokeThinkness;
path.Data = eg;
path.ToolTip = cover;
context.Children.Add(path);
listpath.Add(path);
}
开发者ID:chijianfeng,项目名称:PNManager,代码行数:21,代码来源:JuncState.cs
示例18: OnRender
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
EllipseGeometry ellipse = new EllipseGeometry(new Point(50, 150), 50, 20);
RectangleGeometry rect = new RectangleGeometry(new Rect(50, 150, 50, 20), 5, 5);
//注意到GeometryCombineMode枚举,它有四个枚举值,如果我们有A,B分别表示两个图形的话
//GeometryCombineMode.Exclude: 合并结果为A-B
//GeometryCombineMode.Intersect: 合并结果为A与B的相交部分
//GeometryCombineMode.Union: 合并结果为A+B
//GeometryCombineMode.Xor: 合并结果为(A-B)+(B-A)
CombinedGeometry combined = new CombinedGeometry(GeometryCombineMode.Xor, ellipse, rect);
drawingContext.DrawGeometry(Brushes.Black, new Pen(Brushes.BlanchedAlmond, 2),combined);
}
开发者ID:BerdyPango,项目名称:Researches,代码行数:16,代码来源:04_MyCombinedGeometry.cs
示例19: ShowRipple
/// <summary>
/// 以指定的点为原点生成水波纹动画(调用前应先设置背景)
/// </summary>
public void ShowRipple(Point center)
{
GeometryGroup ripple = new GeometryGroup();
EllipseGeometry rippleOutside = new EllipseGeometry();
rippleOutside.RadiusX = rippleOutside.RadiusY = _maxSpacing;
rippleOutside.Center = center;
EllipseGeometry rippleInside = new EllipseGeometry();
rippleInside.RadiusX = rippleInside.RadiusY = 0;
rippleInside.Center = center;
ripple.Children.Add(rippleOutside);
ripple.Children.Add(rippleInside);
_rippleGroup.Children.Add(ripple);
}
开发者ID:aloneplayer,项目名称:BenProjects,代码行数:20,代码来源:Ripple.xaml.cs
示例20: Particle
internal Particle(Point point, Random random)
{
size = 2.0 + random.NextDouble() * 2.0;
alpha = 0.2 + random.NextDouble() * 0.8;
xVelocity = (random.NextDouble() * 1.6) - 0.8;
yVelocity = -(0.7 + random.NextDouble() * 2.0);
yAcceleration = 0.02 + random.NextDouble() * 0.08;
sizeVelocity = (random.NextDouble() * 1.2) - 0.6;
alphaVelocity = -(random.NextDouble() * 0.05);
geometry = new EllipseGeometry(point, size, size);
brush = new SolidColorBrush(Color.FromArgb(PercentageToByte(alpha), 255, 200, 200));
Drawing = new GeometryDrawing();
Drawing.Brush = brush;
Drawing.Geometry = geometry;
}
开发者ID:modulexcite,项目名称:ExplosionStudio,代码行数:18,代码来源:Particle.cs
注:本文中的System.Windows.Media.EllipseGeometry类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论