本文整理汇总了C#中Contact.UpdateEllipse方法的典型用法代码示例。如果您正苦于以下问题:C# Contact.UpdateEllipse方法的具体用法?C# Contact.UpdateEllipse怎么用?C# Contact.UpdateEllipse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contact
的用法示例。
在下文中一共展示了Contact.UpdateEllipse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateEllipse
/// <summary>
/// Update ellipse with the most recent contact data. If an ellipse has not
/// been created yet, create one.
/// </summary>
/// <param name="contact">the contact to diagram</param>
private void UpdateEllipse(Contact contact)
{
UIElement relativeTo = this;
// Create an ellipse if one does not exist already.
if (twoToneEllipse == null)
{
// Request an ellipse with the proper dimensions and RenderTransform.
twoToneEllipse = contact.GetEllipse(relativeTo);
// Give the ellipse a two color fill.
LinearGradientBrush twoToneBrush = new LinearGradientBrush();
twoToneBrush.StartPoint = new Point(1.0, 0.5);
twoToneBrush.EndPoint = new Point(0.0, 0.5);
GradientStopCollection gradientStops = new GradientStopCollection();
gradientStops.Add(new GradientStop(Colors.Green, 0.49));
gradientStops.Add(new GradientStop(Colors.LimeGreen, 0.51));
twoToneBrush.GradientStops = gradientStops;
twoToneEllipse.Fill = twoToneBrush;
// Add the ellipse to the MainCanvas.
MainCanvas.Children.Add(twoToneEllipse);
// Give the Ellipse a lower ZIndex than the ConnectingLine and Description
// so it is not drawn on top of them.
Canvas.SetZIndex(twoToneEllipse, -1);
}
else
{
// This diagram already has an ellipse. Update the existing ellipse
// dimensions and RenderTransform so the shape will match the contact.
contact.UpdateEllipse(twoToneEllipse, relativeTo);
}
}