本文整理汇总了C#中System.Windows.Shapes.Ellipse.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Ellipse.SetValue方法的具体用法?C# Ellipse.SetValue怎么用?C# Ellipse.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Shapes.Ellipse
的用法示例。
在下文中一共展示了Ellipse.SetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRotationHandle
private void AddRotationHandle(Canvas element)
{
if (!registeredObjects.Contains(element))
{
registeredObjects.Add(element);
Ellipse ellipse = new Ellipse();
ellipse.Tag = RotationElementTag;
ellipse.Width = ellipse.Height = RotationElementRadius * 2;
ellipse.Fill = new SolidColorBrush(Colors.Blue);
ellipse.SetValue(Canvas.TopProperty, -RotationElementRadius);
ellipse.SetValue(Canvas.LeftProperty, -RotationElementRadius);
ellipse.SetValue(Canvas.ZIndexProperty, (int)short.MaxValue);
ellipse.MouseLeftButtonDown += MouseDown;
ellipse.MouseLeftButtonUp += MouseUp;
ellipse.MouseMove += MouseMoving;
if (!(element.RenderTransform is RotateTransform))
{
element.RenderTransform = new RotateTransform()
{
CenterX = element.Width / 2,
CenterY = element.Height / 2
};
}
element.Children.Add(ellipse);
}
}
示例2: DrawAnnotations
public void DrawAnnotations()
{
RemoveAllAnnotations();
var xAxis = Chart.XAxis as DateTimeAxis;
if (xAxis == null || xAxis.ActualRange == null) return;
foreach (var sensor in _viewModel.SensorsToCheckMethodsAgainst)
{
foreach (var calibration in sensor.Calibrations.Where(calibration => calibration.TimeStamp >= xAxis.ActualRange.EffectiveMinimum && calibration.TimeStamp <= xAxis.ActualRange.EffectiveMaximum))
{
var ellipse = new Ellipse
{
Width = 10,
Height = 10,
ToolTip =
string.Format(
"[{0}] {1}",
sensor.Name, calibration),
Stroke = Brushes.Chartreuse,
Fill = new SolidColorBrush(sensor.Colour)
};
ellipse.SetValue(Canvas.TopProperty, 0d);
ellipse.SetValue(Canvas.LeftProperty, xAxis.GetDataValueAsRenderPositionWithoutZoom(calibration.TimeStamp) - ellipse.Width / 2);
_annotations.Add(ellipse);
}
}
foreach (var annotation in _annotations)
{
_canvas.Children.Add(annotation);
}
}
示例3: drawPoint
private void drawPoint(Point p, Canvas testCanvas)
{
//create shape
System.Diagnostics.Debug.WriteLine("Creating shape");
Shape userShape;
Shape shape = new Ellipse();
shape.SetValue(Canvas.LeftProperty, p.X);
shape.SetValue(Canvas.TopProperty, p.Y);
//shape.HorizontalAlignment = HorizontalAlignment.Left;
//shape.VerticalAlignment = VerticalAlignment.Center;
shape.Width = 4;
shape.Height = 4;
shape.Stroke = new SolidColorBrush(Colors.Black);
shape.StrokeThickness = 3.0;
GradientBrush gb = new LinearGradientBrush();
gb.GradientStops = new GradientStopCollection();
GradientStop g1 = new GradientStop();
g1.Color = Colors.Red;
gb.GradientStops.Add(g1);
g1 = new GradientStop();
g1.Color = Colors.Blue;
g1.Offset = 2;
gb.GradientStops.Add(g1);
shape.Fill = gb;
shape.Visibility = System.Windows.Visibility.Visible;
shape.Opacity = 0.5;
testCanvas.Children.Add(shape);
}
示例4: MainPage
public MainPage()
{
InitializeComponent();
_manager = new ShapeManager(ThePanel);
_num = 10;
_dot = new Ellipse[_num];
_x = new double[_num];
_y = new double[_num];
_dx = new double[_num];
_dy = new double[_num];
for (int i = 0; i < _num; i++)
{
Ellipse z = new Ellipse();
if( i==0 || i==_num-1 )
z.Fill = new SolidColorBrush(Colors.Red);
else
z.Fill = new SolidColorBrush(Colors.Green);
z.Width = 20;
z.Height = 20;
_dot[i] = z;
double x = (i+1) * ThePanel.Width / (_num+2);
double y = ThePanel.Height / 2;
_x[i] = x;
_y[i] = y;
z.SetValue(Canvas.TopProperty, y);
z.SetValue(Canvas.LeftProperty, x);
ThePanel.Children.Add(z);
_manager.Add(z);
}
_timer = new DispatcherTimer();
_timer.Interval = new TimeSpan(0, 0, 0, 0, 100);
_timer.Tick += new EventHandler(_timer_Tick);
_timer.Start();
}
示例5: Draw
public void Draw(UIElementCollection children)
{
if (!isAlive)
return;
DateTime cur = DateTime.Now;
foreach (var segment in segments)
{
PlayerUtils.Segment seg = segment.Value.GetEstimatedSegment(cur);
if (seg.IsCircle())
{
var circle = new Ellipse();
circle.Width = seg.radius * 2;
circle.Height = seg.radius * 2;
circle.SetValue(Canvas.LeftProperty, seg.x1 - seg.radius);
circle.SetValue(Canvas.TopProperty, seg.y1 - seg.radius);
circle.Stroke = brJoints;
circle.StrokeThickness = 1;
circle.Fill = brBones;
children.Add(circle);
}
}
// Remove unused players after 1/2 second.
if (DateTime.Now.Subtract(lastUpdated).TotalMilliseconds > 500)
isAlive = false;
}
示例6: CreateCircles
private void CreateCircles()
{
var centerX = MainCanvas.ActualWidth/2.0;
var centerY = MainCanvas.ActualHeight/2.0;
Color[] colors = {Colors.White, Colors.Green, Colors.Green, Colors.Lime};
for (var i = 0; i < 24; ++i)
{
var e = new Ellipse();
var alpha = (byte) _rand.Next(96, 192);
var colorIndex = _rand.Next(4);
e.Stroke =
new SolidColorBrush(Color.FromArgb(alpha, colors[colorIndex].R, colors[colorIndex].G,
colors[colorIndex].B));
e.StrokeThickness = _rand.Next(1, 4);
e.Width = 0.0;
e.Height = 0.0;
double offsetX = 16 - _rand.Next(32);
double offsetY = 16 - _rand.Next(32);
MainCanvas.Children.Add(e);
e.SetValue(Canvas.LeftProperty, centerX + offsetX);
e.SetValue(Canvas.TopProperty, centerY + offsetY);
var duration = 6.0 + 10.0*_rand.NextDouble();
var delay = 16.0*_rand.NextDouble();
var offsetTransform = new TranslateTransform();
var offsetXAnimation = new DoubleAnimation(0.0, -256.0, new Duration(TimeSpan.FromSeconds(duration)))
{
RepeatBehavior = RepeatBehavior.Forever,
BeginTime = TimeSpan.FromSeconds(delay)
};
offsetTransform.BeginAnimation(TranslateTransform.XProperty, offsetXAnimation);
offsetTransform.BeginAnimation(TranslateTransform.YProperty, offsetXAnimation);
e.RenderTransform = offsetTransform;
var sizeAnimation = new DoubleAnimation(0.0, 512.0, new Duration(TimeSpan.FromSeconds(duration)))
{
RepeatBehavior = RepeatBehavior.Forever,
BeginTime = TimeSpan.FromSeconds(delay)
};
e.BeginAnimation(WidthProperty, sizeAnimation);
e.BeginAnimation(HeightProperty, sizeAnimation);
var opacityAnimation = new DoubleAnimation(duration - 1.0, 0.0,
new Duration(TimeSpan.FromSeconds(duration)))
{
BeginTime = TimeSpan.FromSeconds(delay),
RepeatBehavior = RepeatBehavior.Forever
};
e.BeginAnimation(OpacityProperty, opacityAnimation);
}
}
示例7: SetPosition
private void SetPosition(Ellipse ellipse, double offset, double posOffSet, double step)
{
ellipse.SetValue(Canvas.LeftProperty, 50.0
+ Math.Sin(offset + posOffSet * step) * 50.0);
ellipse.SetValue(Canvas.TopProperty, 50
+ Math.Cos(offset + posOffSet * step) * 50.0);
}
示例8: DrawDot
public void DrawDot(int x, int y, int radius, Color color)
{
Ellipse dot = new Ellipse();
dot.Width = 2 * radius;
dot.Height = 2 * radius;
dot.SetValue(Canvas.LeftProperty, (double)(x - radius));
dot.SetValue(Canvas.TopProperty, (double)(y - radius));
dot.Fill = new SolidColorBrush(color);
Canvas.Children.Add(dot);
}
示例9: SetPosition
private void SetPosition(Ellipse ellipse, double offset, double posOffSet, double step)
{
var rotation = (double)(2.5M * BallSize);
ellipse.SetValue(Canvas.LeftProperty, rotation
+ Math.Sin(offset + posOffSet * step) * rotation);
ellipse.SetValue(Canvas.TopProperty, rotation
+ Math.Cos(offset + posOffSet * step) * rotation);
}
示例10: Add
//http://cespage.com/silverlight/tutorials/wp7tut7.html
private void Add(Grid grid, int row, int column)
{
Ellipse _dot = new Ellipse();
_dot.Width = 20;
_dot.Height = 20;
_dot.Fill = new SolidColorBrush(Colors.Black);
_dot.SetValue(Grid.ColumnProperty, column);
_dot.SetValue(Grid.RowProperty, row);
grid.Children.Add(_dot);
}
示例11: SetPosition
private static void SetPosition(Ellipse ellipse, double offset,
double posOffSet, double step)
{
const double diff = 20.0;
ellipse.SetValue(Canvas.LeftProperty, diff
+ Math.Sin(offset + posOffSet * step) * diff);
ellipse.SetValue(Canvas.TopProperty, diff
+ Math.Cos(offset + posOffSet * step) * diff);
}
示例12: DrawRectangle
private void DrawRectangle()
{
Ellipse e = new Ellipse();
e.Width = 30;
e.Height = 30;
e.Fill = Brushes.Black;
e.Stroke = Brushes.Red;
e.SetValue(Canvas.LeftProperty, 100.0);
e.SetValue(Canvas.TopProperty, 100.0);
// myCanvass.Children.Add(e);
}
示例13: CreateCircles
private void CreateCircles()
{
double centerX = this.MainCanvas.ActualWidth / 2.0;
double centerY = this.MainCanvas.ActualHeight / 2.0;
Color[] colors = new Color[] { Colors.White, Colors.Green, Colors.Green, Colors.Lime };
for (int i = 0; i < 24; ++i)
{
Ellipse e = new Ellipse();
byte alpha = (byte)rand.Next(96, 192);
int colorIndex = rand.Next(4);
e.Stroke = new SolidColorBrush(Color.FromArgb(alpha, colors[colorIndex].R, colors[colorIndex].G, colors[colorIndex].B));
e.StrokeThickness = rand.Next(1, 4);
e.Width = 0.0;
e.Height = 0.0;
double offsetX = 16 - rand.Next(32);
double offsetY = 16 - rand.Next(32);
this.MainCanvas.Children.Add(e);
e.SetValue(Canvas.LeftProperty, centerX + offsetX);
e.SetValue(Canvas.TopProperty, centerY + offsetY);
double duration = 6.0 + 10.0 * rand.NextDouble();
double delay = 16.0 * rand.NextDouble();
TranslateTransform offsetTransform = new TranslateTransform();
DoubleAnimation offsetXAnimation = new DoubleAnimation(0.0, -256.0, new Duration(TimeSpan.FromSeconds(duration)));
offsetXAnimation.RepeatBehavior = RepeatBehavior.Forever;
offsetXAnimation.BeginTime = TimeSpan.FromSeconds(delay);
offsetTransform.BeginAnimation(TranslateTransform.XProperty, offsetXAnimation);
offsetTransform.BeginAnimation(TranslateTransform.YProperty, offsetXAnimation);
e.RenderTransform = offsetTransform;
DoubleAnimation sizeAnimation = new DoubleAnimation(0.0, 512.0, new Duration(TimeSpan.FromSeconds(duration)));
sizeAnimation.RepeatBehavior = RepeatBehavior.Forever;
sizeAnimation.BeginTime = TimeSpan.FromSeconds(delay);
e.BeginAnimation(Ellipse.WidthProperty, sizeAnimation);
e.BeginAnimation(Ellipse.HeightProperty, sizeAnimation);
DoubleAnimation opacityAnimation = new DoubleAnimation(duration - 1.0, 0.0, new Duration(TimeSpan.FromSeconds(duration)));
opacityAnimation.BeginTime = TimeSpan.FromSeconds(delay);
opacityAnimation.RepeatBehavior = RepeatBehavior.Forever;
e.BeginAnimation(Ellipse.OpacityProperty, opacityAnimation);
}
}
示例14: Activate
private void Activate(Point2D item)
{
if (Map == null || Map.Layers == null)
{
return;
}
ellipse = new Ellipse();
#region 所有风格的控制
ellipse.Stroke = Stroke;
ellipse.StrokeThickness = StrokeThickness;
ellipse.Fill = Fill;
ellipse.StrokeMiterLimit = StrokeMiterLimit;
ellipse.StrokeDashOffset = StrokeDashOffset;
ellipse.StrokeDashArray = StrokeDashArray;
ellipse.StrokeDashCap = StrokeDashCap;
ellipse.StrokeEndLineCap = StrokeEndLineCap;
ellipse.StrokeLineJoin = StrokeLineJoin;
ellipse.StrokeStartLineCap = StrokeStartLineCap;
ellipse.Opacity = Opacity;
#endregion
DrawLayer = new ElementsLayer();
Map.Layers.Add(DrawLayer);
ellipse.SetValue(ElementsLayer.BBoxProperty, new Rectangle2D(item, item));
DrawLayer.Children.Add(ellipse);
isActivated = true;
isDrawing = true;
}
示例15: SetPosition
private void SetPosition(Ellipse ellipse, double offset,
double posOffSet, double step, double ew, double eh, double w, double h,
double r)
{
double t = 2 * Math.PI * posOffSet / 10;
ellipse.Width = ew;
ellipse.Height = eh;
ellipse.SetValue(Canvas.LeftProperty, w + r * Math.Cos(t));
ellipse.SetValue(Canvas.TopProperty, h + r * Math.Sin(t));
//ellipse.SetValue(Canvas.LeftProperty,w
// + Math.Sin(offset + posOffSet * step) * w);
//ellipse.SetValue(Canvas.TopProperty, h
// + Math.Cos(offset + posOffSet * step) * h);
}