本文整理汇总了C#中System.Windows.Shapes.Shape类的典型用法代码示例。如果您正苦于以下问题:C# Shape类的具体用法?C# Shape怎么用?C# Shape使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Shape类属于System.Windows.Shapes命名空间,在下文中一共展示了Shape类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnApplyTemplate
/// <summary>
/// This gets called when the template has been applied and we have our visual tree
/// </summary>
public override void OnApplyTemplate()
{
m_paintArea = Template.FindName("PART_PaintArea", this) as Shape;
m_mainContent = Template.FindName("PART_MainContent", this) as ContentPresenter;
base.OnApplyTemplate();
}
示例2: removeFromBoard
internal void removeFromBoard(Shape shape)
{
if (plane.Children.Contains(shape))
{
plane.Children.Remove(shape);
}
}
示例3: rect1_MouseDown
private void rect1_MouseDown(object sender, MouseButtonEventArgs e)
{
Shape s = (Shape)sender;
startx = Canvas.GetLeft(s);
starty = Canvas.GetTop(s);
s.MouseMove += rect1_MouseMove;
s.CaptureMouse();
e.Handled = true;
Point p = e.GetPosition((IInputElement)canvas1);
deltax = p.X - Canvas.GetLeft(s);
deltay = p.Y - Canvas.GetTop(s);
if (last != null)
{
if (last.Effect != null)
{
last.Effect = null;
Canvas.SetZIndex(last, 0);
}
}
last = s;
DropShadowEffect ef = new DropShadowEffect();
ef.Color = Colors.Red;
ef.BlurRadius = 30;
ef.ShadowDepth = 0;
s.Effect = ef;
Canvas.SetZIndex(last, 10);
}
示例4: setOnBoard
internal void setOnBoard(Shape shape, Point position)
{
removeFromBoard(shape);
Canvas.SetLeft(shape, position.X);
Canvas.SetTop(shape, position.Y);
plane.Children.Add(shape);
}
示例5: Control_MouseDown
private void Control_MouseDown(object sender, MouseButtonEventArgs e)
{
var shape = (sender as Shape);
if (shape.Name.Contains("Play"))
{
mouseUpBrush = elPlay.Fill;
mouseUpEllipse = elPlay;
elPlay.OpacityMask = pathPlay.OpacityMask = Brushes.Black;
elPlay.Fill = Brushes.Blue;
}
if (shape.Name.Contains("Stop"))
{
mouseUpBrush = elStop.Fill;
mouseUpEllipse = elStop;
elStop.OpacityMask = pathStop.OpacityMask = Brushes.Black;
elStop.Fill = Brushes.Blue;
}
if (shape.Name.Contains("Pause"))
{
mouseUpBrush = elPause.Fill;
mouseUpEllipse = elPause;
elPause.OpacityMask = pathPause.OpacityMask = Brushes.Black;
elPause.Fill = Brushes.Blue;
}
}
示例6: Stand
public Stand(int _ID, String _Name, String _Info, Shape _Shape)
{
ST_ID = _ID;
ST_Name = _Name;
ST_Info = _Info;
ST_Shape = _Shape;
}
示例7: Add
public void Add(Shape Bob)
{
Bob.MouseLeftButtonDown += new MouseButtonEventHandler(Bob_MouseLeftButtonDown);
Bob.MouseLeftButtonUp += new MouseButtonEventHandler(Bob_MouseLeftButtonUp);
Bob.MouseMove += new MouseEventHandler(Bob_MouseMove);
_shapes.Add(Bob);
}
示例8: ReceiveObject
public virtual void ReceiveObject(object obj)
{
if (obj is Shape)
{
_symbolShape = obj as Shape;
UpdateSymbolShape();
}
}
示例9: Rondje
public Rondje(double x, double y, double width, double height, Shape Rondje)
{
this.height = height;
this.x = x;
this.y = y;
this.width = width;
this.Graphics = Rondje;
}
示例10: SetStyle
public static void SetStyle(Shape shape, ElementBase element)
{
shape.Fill = new SolidColorBrush(element.BackgroundColor);
shape.Stroke = new SolidColorBrush(element.BorderColor);
shape.StrokeThickness = element.BorderThickness;
if (element.BackgroundPixels != null)
shape.Fill = PainterHelper.CreateBrush(element.BackgroundPixels);
}
示例11: OnApplyTemplate
public override void OnApplyTemplate()
{
stateIndicator = GetTemplateChild("PART_StateIndicator") as Shape;
if (stateIndicator != null)
{
stateIndicator.SetBinding(Shape.FillProperty, new Binding("State") { Converter = StateConverter, Source = this });
}
}
示例12: ConfiguraComponenteVisualArticulacao
private void ConfiguraComponenteVisualArticulacao(Shape forma, int diametroArticulacao, int larguraDesenho, Brush corDesenho)
{
forma.Height = diametroArticulacao;
forma.Width = diametroArticulacao;
forma.StrokeThickness = larguraDesenho;
forma.Stroke = corDesenho;
}
示例13: Vierkant
public Vierkant(double x, double y, double width, double height, Shape rectangle)
{
this.height = height;
this.x = x;
this.y = y;
this.width = width;
this.Graphics = rectangle;
}
示例14: ConfigurarComponenteVisualArticulacao
private void ConfigurarComponenteVisualArticulacao(Shape pForma, int pDiametroArticulacao,
int pLarguraDesenho, Brush pCorDesenho, bool pPreencheComGradiente, bool pColorirGradienteMesmaCorDoPincel)
{
pForma.Height = pDiametroArticulacao;
pForma.Width = pDiametroArticulacao;
pForma.StrokeThickness = pLarguraDesenho;
if (pPreencheComGradiente)
{
pForma.Stroke = Brushes.Black;
RadialGradientBrush lGradiente = new RadialGradientBrush();
lGradiente.GradientOrigin = new Point(0.5, 0.5);
lGradiente.Center = new Point(0.5, 0.5);
lGradiente.RadiusX = 0.5;
lGradiente.RadiusY = 0.5;
Color lCor1;
Color lCor2;
if (pColorirGradienteMesmaCorDoPincel)
{
if (pCorDesenho == Brushes.Green)
{
lCor1 = Colors.Lime;
lCor2 = Colors.DarkGreen;
}
else if (pCorDesenho == Brushes.Blue)
{
lCor1 = Colors.RoyalBlue;
lCor2 = Colors.DarkBlue;
}
else
{
lCor1 = Colors.OrangeRed;
lCor2 = Colors.DarkRed;
}
}
else
{
lCor1 = Colors.OrangeRed;
lCor2 = Colors.DarkRed;
}
//lCor1 = Colors.Lime;
//lCor2 = Colors.DarkGreen;
lGradiente.GradientStops.Add(new GradientStop(lCor1, 0.5));
lGradiente.GradientStops.Add(new GradientStop(lCor2, 1));
pForma.Fill = lGradiente;
}
else
{
pForma.Stroke = pCorDesenho;
}
}
示例15: areColliding
public bool areColliding(Shape shape1, Point position1, Shape shape2, Point position2)
{
if (Math.Pow(position1.X - position2.X, 2) + Math.Pow(position1.Y - position2.Y, 2)
<= Math.Pow((shape1.Width + shape2.Width) / 2, 2))
{
return true;
}
return false;
}