当前位置: 首页>>代码示例>>C#>>正文


C# Contact.GetEllipse方法代码示例

本文整理汇总了C#中Contact.GetEllipse方法的典型用法代码示例。如果您正苦于以下问题:C# Contact.GetEllipse方法的具体用法?C# Contact.GetEllipse怎么用?C# Contact.GetEllipse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contact的用法示例。


在下文中一共展示了Contact.GetEllipse方法的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);
            }
        }
开发者ID:blender,项目名称:Codeine,代码行数:39,代码来源:ContactDiagram.xaml.cs


注:本文中的Contact.GetEllipse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。