本文整理汇总了C#中System.Windows.Shapes.Ellipse类的典型用法代码示例。如果您正苦于以下问题:C# Ellipse类的具体用法?C# Ellipse怎么用?C# Ellipse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Ellipse类属于System.Windows.Shapes命名空间,在下文中一共展示了Ellipse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: boardCanvas_MouseDown
public void boardCanvas_MouseDown(object sender, MouseButtonEventArgs e)
{
boardCanvas.CaptureMouse();
sP = e.GetPosition(boardCanvas);
newAtr.Color = (Color)colorStroke.SelectedColor;
newAtr.Height = newAtr.Width = slider.Value;
boardCanvas.DefaultDrawingAttributes = newAtr;
if (tempTool == pencilImage.Name || tempTool == eraserImage.Name || tempTool == circleImage.Name || tempTool == rectangleImage.Name)
{
if (tempTool == circleImage.Name)
{
ellipse = new Ellipse();
}
else if (tempTool == rectangleImage.Name)
{
rect = new Rectangle();
}
}
else if (tempTool == lineImage.Name)
{
line_C = new Line();
}
else if (tempTool == textBoxImage.Name) {
tB = new TextBox();
}
//eP = new Point(0, 0);
}
示例2: DraggableCanvas
public DraggableCanvas()
{
m_handles = new Ellipse[4];
for (int i = 0; i < m_handles.Length; i++)
{
m_handles[i] = new Ellipse();
this.Children.Add(m_handles[i]);
m_handles[i].Height = SizingHandleSize;
m_handles[i].Width = SizingHandleSize;
m_handles[i].StrokeThickness = 2;
m_handles[i].Fill = new SolidColorBrush(Color.FromArgb(32, 255, 255, 255));
m_handles[i].Stroke = Brushes.Red;
m_handles[i].Opacity = 0;
m_handles[i].IsEnabled = false;
Canvas.SetZIndex(m_handles[i], 100);
}
m_handles[(int)SizingHandles.TopLeft].Cursor = Cursors.SizeNWSE;
m_handles[(int)SizingHandles.TopRight].Cursor = Cursors.SizeNESW;
m_handles[(int)SizingHandles.BottomLeft].Cursor = Cursors.SizeNESW;
m_handles[(int)SizingHandles.BottomRight].Cursor = Cursors.SizeNWSE;
}
示例3: Star
public Star()
{
centerX = 285;
centerY = 285;
starGFX = new Ellipse();
starSEL = new Ellipse();
starCanvas = new Canvas();
starLabel = new Label();
starSEL.Visibility = Visibility.Hidden;
starGFX.Fill = backgroundBrush;
starLabel.FontFamily = new FontFamily(new Uri("pack://application:,,,/Fonts/"), "./#Euro Caps");
starLabel.Foreground = backgroundBrush;
starCanvas.Children.Add(starGFX);
starCanvas.Children.Add(starLabel);
starCanvas.Children.Add(starSEL);
movePoint = new Point3D(0,0,0);
rotaPoint = new Point3D(0,0,0);
starCanvas.PreviewMouseDown += MoveToSystem;
}
示例4: AddPoint
private void AddPoint(Map controlMap, GeoCoordinate geo)
{
// With the new Map control:
// Map -> MapLayer -> MapOverlay -> UIElements
// - Add a MapLayer to the Map
// - Add an MapOverlay to that layer
// - We can add a single UIElement to that MapOverlay.Content
MapLayer ml = new MapLayer();
MapOverlay mo = new MapOverlay();
// Add an Ellipse UI
Ellipse r = new Ellipse();
r.Fill = new SolidColorBrush(Color.FromArgb(255, 240, 5, 5));
// the item is placed on the map at the top left corner so
// in order to center it, we change the margin to a negative
// margin equal to half the width and height
r.Width = r.Height = 12;
r.Margin = new Thickness(-6, -6, 0, 0);
// Add the Ellipse to the Content
mo.Content = r;
// Set the GeoCoordinate of that content
mo.GeoCoordinate = geo;
// Add the MapOverlay to the MapLayer
ml.Add(mo);
// Add the MapLayer to the Map
controlMap.Layers.Add(ml);
}
示例5: KinectController
public KinectController(DrawController dController, Image image, SoundController sController, Ellipse[] buttons)
{
debugImage = image;
drawController = dController;
soundController = sController;
this.buttons = buttons;
}
示例6: ShowMyLocationOnTheMap
private async void ShowMyLocationOnTheMap()
{
Geolocator myGeolocator = new Geolocator();
Geoposition myGeoposition = await myGeolocator.GetGeopositionAsync();
Geocoordinate myGeocoordinate = myGeoposition.Coordinate;
GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate);
this.BettingMap.Center = myGeoCoordinate;
this.BettingMap.ZoomLevel = 15;
Ellipse myCircle = new Ellipse();
myCircle.Fill = new SolidColorBrush(Colors.Blue);
myCircle.Height = 20;
myCircle.Width = 20;
myCircle.Opacity = 50;
MapOverlay myLocationOverlay = new MapOverlay();
myLocationOverlay.Content = myCircle;
myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
myLocationOverlay.GeoCoordinate = myGeoCoordinate;
MapLayer myLocationLayer = new MapLayer();
myLocationLayer.Add(myLocationOverlay);
BettingMap.Layers.Add(myLocationLayer);
}
示例7: Lock
public Lock(Ellipse ellipse, Canvas canvas, double width)
{
_ellipse = ellipse;
_canvas = canvas;
_width = width;
Position = 0;
}
示例8: GetMovingPlayer
/// <summary>
/// Método que obtiene una instancia 'Player' a partir de un Ellipse
/// </summary>
/// <param name="ellipse">Instancia Ellipse que será representada como clase 'Player'</param>
/// <returns>Instancia Player</returns>
public static Player GetMovingPlayer(Ellipse ellipse)
{
Player currentPlayer = new Player();
// Se obtiene el color del ellipse
SolidColorBrush brush = ellipse.Fill as SolidColorBrush;
// Color que se comparará con el del Ellipse
Color colorToCompare = new Color()
{
A=255,
B=170,
G=178,
R=32
};
if (brush.Color == colorToCompare)
{
// Es el jugador 1
currentPlayer.PlayerNumber = PlayerNum.PlayerOne;
}
else
{
// Es el jugador 2
currentPlayer.PlayerNumber = PlayerNum.PlayerTwo;
}
// Se guarda el Ellipse en la instancia Player
currentPlayer.Shape = ellipse;
return currentPlayer;
}
示例9: BuildAddButton
private Grid BuildAddButton()
{
Grid g = new Grid();
g.Width = 120;
g.Height = 120;
g.Margin = new Thickness(0, 0, 10, 10);
Rectangle r = new Rectangle();
r.Fill = new SolidColorBrush(Color.FromArgb(0x33, 0xFF, 0xFF, 0xFF));
g.Children.Add(r);
TextBlock t = new TextBlock();
t.Text = "+";
t.VerticalAlignment = VerticalAlignment.Center;
t.HorizontalAlignment = HorizontalAlignment.Center;
t.TextAlignment = TextAlignment.Center;
t.FontSize = 60;
t.Margin = new Thickness(0, -15, 0, 0);
g.Children.Add(t);
Ellipse e = new Ellipse();
e.Stroke = new SolidColorBrush(Colors.White);
e.Fill = new SolidColorBrush(Colors.Transparent);
e.StrokeThickness = 3;
e.Margin = new Thickness(30);
g.Children.Add(e);
return g;
}
示例10: MensSpeler
public MensSpeler()
: base()
{
kleur = "Red";
bol = new Ellipse();
bol.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(kleur));
bol.Width = grote;
bol.Height = grote;
xRand = new Random();
yRand = new Random();
positie.X = xRand.Next(0, 631);
positie.Y = yRand.Next(0, 278);
xChange = xRand.Next(-2, 2);
while(xChange == 0)
{
xChange = xRand.Next(-2, 2);
}
yChange = yRand.Next(-2, 2);
while (xChange == 0)
{
yChange = yRand.Next(-2, 2);
}
}
示例11: canvasDrawingArea_MouseLeftButtonDown
private void canvasDrawingArea_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
Shape shapeToRender = null;
// Configure the correct shape to draw.
switch (currentShape)
{
case SelectedShape.Circle:
shapeToRender = new Ellipse() { Fill = Brushes.Green, Height = 35, Width = 35 };
break;
case SelectedShape.Rectangle:
shapeToRender = new Rectangle() { Fill = Brushes.Red, Height = 35, Width = 35, RadiusX = 10, RadiusY = 10 };
break;
case SelectedShape.Line:
shapeToRender = new Line() { Fill = Brushes.Blue, StrokeThickness = 10, X1 = 0, X2 = 50, Y1 = 0, Y2 = 50 };
break;
default:
return;
}
// Set top/left position to draw in the canvas.
Canvas.SetLeft(shapeToRender, e.GetPosition(canvasDrawingArea).X);
Canvas.SetTop(shapeToRender, e.GetPosition(canvasDrawingArea).Y);
// Draw shape!
canvasDrawingArea.Children.Add(shapeToRender);
}
示例12: OrganismVisual
public OrganismVisual(Organism source, Ellipse organism, Polygon sight, PointCollection boundaries, TextBlock energy)
{
this.source = source;
source.OnDeath += source_OnDeath;
this.organism = organism;
this.boundaries = boundaries;
this.energy = energy;
organism.Dispatcher.Invoke(new Action(() => organism.Fill = new SolidColorBrush(Colors.Red)));
organism.Dispatcher.Invoke(new Action(() => organism.Height = source.getSize()));
organism.Dispatcher.Invoke(new Action(() => organism.Width = source.getSize()));
this.sight = sight;
sight.Dispatcher.Invoke(new Action(() => sight.Fill = new SolidColorBrush(Color.FromArgb(50, 200, 200, 200))));
sight.Dispatcher.Invoke(new Action(() => sight.Points = boundaries));
energy.Dispatcher.Invoke(new Action(() => energy.Foreground = new SolidColorBrush(Colors.White)));
energy.Dispatcher.Invoke(new Action(() => energy.HorizontalAlignment = HorizontalAlignment.Center));
energy.Dispatcher.Invoke(new Action(() => energy.VerticalAlignment = VerticalAlignment.Center));
energy.Dispatcher.Invoke(new Action(() => energy.TextAlignment = TextAlignment.Center));
energy.Dispatcher.Invoke(new Action(() => energy.Height = 15));
energy.Dispatcher.Invoke(new Action(() => energy.Width = 40));
constructPointCollection();
}
示例13: Flush
public void Flush()
{
var thicknessAnimationUsingKeyFrames = new ThicknessAnimationUsingKeyFrames();
thicknessAnimationUsingKeyFrames.KeyFrames = new ThicknessKeyFrameCollection();
double delta = (Width - Height) / 2;
var thicknessAnimation = new ThicknessAnimation()
{
From = new Thickness(delta, 0, delta, 0),
To = new Thickness(delta - 500, -500, delta - 500, -500),
Duration = new Duration(TimeSpan.FromSeconds(1)),
AutoReverse = true
};
thicknessAnimation.Completed += new EventHandler(animation_Completed);
_flushEllipse = new Ellipse()
{
Fill = new SolidColorBrush(Colors.LightBlue),
Stroke = new SolidColorBrush(Colors.Orange),
StrokeThickness = 5,
Opacity = 0.5
};
Children.Add(_flushEllipse);
_flushEllipse.BeginAnimation(Ellipse.MarginProperty, thicknessAnimation);
}
示例14: DrawRpmCanvas
public void DrawRpmCanvas(List<int> rpms, List<float> speeds)
{
_cachedRpms = rpms;
_cachedSpeeds = speeds;
RpmCanvas.Children.Clear();
if (rpms.Count == 0)
{
return;
}
int maxRpm = rpms.Max();
float maxSpeed = speeds.Max();
float yRatio = (CanvasHeight-40) / (float)maxRpm;
float xRatio = (CanvasWidth-20) / (float)maxSpeed;
for (int i = 0; i < rpms.Count; i++)
{
Ellipse e = new Ellipse();
e.Height = 2;
e.Width = 2;
e.Fill = Brushes.Blue;
Canvas.SetTop(e, (CanvasHeight-40) - rpms[i] * yRatio);
Canvas.SetLeft(e, speeds[i] * xRatio);
RpmCanvas.Children.Add(e);
}
}
示例15: MainWindow
public MainWindow()
{
InitializeComponent();
ApplicationCommands.New.Text = "Новый";
ApplicationCommands.Open.Text = "Открыть...";
ApplicationCommands.Save.Text = "Сохранить как...";
ApplicationCommands.Close.Text = "Выход";
//ApplicationCommands.Close.InputGestures+= new InputGesture();
for (int i = 0; i < count; i++)
{
Ellipse ellipse = new Ellipse();
ellipse.Width = ellipse.Height = (100) * rand.NextDouble();
ellipse.Fill = Brushes.Silver;
ellipse.Stroke = Brushes.Black;
ellipse.MouseDown += Ellipse_MouseDown;
stack_panel.Children.Add(ellipse);
}
/*
// Построение начальнойтриангуляции для полосы.
double r = 100000;
ellipses.Add(new Circle(r, 0, 400 + r));
ellipses.Add(new Circle(r, -r, 0));
ellipses.Add(new Circle(r, 0, 200 - r));
triple = new Triple<Circle, DeloneCircle>(ellipses[0], ellipses[1], ellipses[2]);
triple.CalculateDeloneCircle();
vd = new VD<Circle, DeloneCircle>(triple, null);
BuildTriples(vd.triples, visual_triples.Data as GeometryGroup, true);
*/
//lv.DataContext = moves;
}