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


C# OxyColor.IsInvisible方法代码示例

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


在下文中一共展示了OxyColor.IsInvisible方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetStroke

        /// <summary>
        /// Sets the stroke properties of the specified shape.
        /// </summary>
        /// <param name="shape">The shape.</param>
        /// <param name="stroke">The stroke.</param>
        /// <param name="thickness">The thickness.</param>
        /// <param name="lineJoin">The line join.</param>
        /// <param name="dashArray">The dash array.</param>
        /// <param name="aliased">The aliased.</param>
        // ReSharper disable UnusedParameter.Local
        private void SetStroke(
            Shape shape,
            OxyColor stroke,
            double thickness,
            OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter,
            double[] dashArray = null,
            bool aliased = false)
        {
            if (stroke.IsInvisible() || thickness <= 0)
            {
                return;
            }

            shape.Stroke = this.GetCachedBrush(stroke);

            switch (lineJoin)
            {
                case OxyPenLineJoin.Round:
                    shape.StrokeLineJoin = PenLineJoin.Round;
                    break;
                case OxyPenLineJoin.Bevel:
                    shape.StrokeLineJoin = PenLineJoin.Bevel;
                    break;

                // The default StrokeLineJoin is Miter
            }

            if (!thickness.Equals(1.0))
            {
                // default values is 1
                shape.StrokeThickness = thickness;
            }

            if (dashArray != null)
            {
                shape.StrokeDashArray = CreateDashArrayCollection(dashArray);
            }

            // shape.UseLayoutRounding = aliased;
        }
开发者ID:Cheesebaron,项目名称:oxyplot,代码行数:50,代码来源:MetroRenderContext.cs

示例2: DrawLine

        /// <summary>
        /// Draws the polyline from the specified points.
        /// </summary>
        /// <param name="points">The points.</param>
        /// <param name="stroke">The stroke color.</param>
        /// <param name="thickness">The stroke thickness.</param>
        /// <param name="dashArray">The dash array.</param>
        /// <param name="lineJoin">The line join type.</param>
        /// <param name="aliased">if set to <c>true</c> the shape will be aliased.</param>
        public override void DrawLine(
            IList<ScreenPoint> points,
            OxyColor stroke,
            double thickness,
            double[] dashArray,
            LineJoin lineJoin,
            bool aliased)
        {
            if (stroke.IsInvisible() || thickness <= 0)
            {
                return;
            }

            this.g.SmoothingMode = aliased ? XSmoothingMode.None : XSmoothingMode.HighQuality;
            var pen = new XPen(ToColor(stroke), (float)thickness);

            if (dashArray != null)
            {
                pen.DashPattern = dashArray;
            }

            switch (lineJoin)
            {
                case LineJoin.Round:
                    pen.LineJoin = XLineJoin.Round;
                    break;
                case LineJoin.Bevel:
                    pen.LineJoin = XLineJoin.Bevel;
                    break;

                // The default LineJoin is Miter
            }

            this.g.DrawLines(pen, ToPoints(points));
        }
开发者ID:benjaminrupp,项目名称:oxyplot,代码行数:44,代码来源:PdfRenderContext.cs

示例3: DrawText

        /// <summary>
        /// The draw text.
        /// </summary>
        /// <param name="p">The p.</param>
        /// <param name="text">The text.</param>
        /// <param name="fill">The fill.</param>
        /// <param name="fontFamily">The font family.</param>
        /// <param name="fontSize">The font size.</param>
        /// <param name="fontWeight">The font weight.</param>
        /// <param name="rotate">The rotate.</param>
        /// <param name="halign">The horizontal alignment.</param>
        /// <param name="valign">The vertical alignment.</param>
        /// <param name="maxSize">The maximum size of the text.</param>
        public void DrawText(
            ScreenPoint p,
            string text,
            OxyColor fill,
            string fontFamily,
            double fontSize,
            double fontWeight,
            double rotate,
            OxyPlot.HorizontalAlignment halign,
            OxyPlot.VerticalAlignment valign,
            OxySize? maxSize)
        {
            if (fill.IsInvisible() || string.IsNullOrEmpty(text))
            {
                return;
            }

            var tb = new TextBlock { Text = text, Foreground = fill.ToBrush() };

            // tb.SetValue(TextOptions.TextHintingModeProperty, TextHintingMode.Animated);
            if (fontFamily != null)
            {
                tb.FontFamily = new FontFamily(fontFamily);
            }

            if (fontSize > 0)
            {
                tb.FontSize = fontSize;
            }

            tb.FontWeight = GetFontWeight(fontWeight);

            tb.Measure(new Size(1000, 1000));

            double dx = 0;
            if (halign == OxyPlot.HorizontalAlignment.Center)
            {
                dx = -tb.ActualWidth / 2;
            }

            if (halign == OxyPlot.HorizontalAlignment.Right)
            {
                dx = -tb.ActualWidth;
            }

            double dy = 0;
            if (valign == OxyPlot.VerticalAlignment.Middle)
            {
                dy = -tb.ActualHeight / 2;
            }

            if (valign == OxyPlot.VerticalAlignment.Bottom)
            {
                dy = -tb.ActualHeight;
            }

            var transform = new TransformGroup();
            transform.Children.Add(new TranslateTransform { X = (int)dx, Y = (int)dy });
            if (!rotate.Equals(0.0))
            {
                transform.Children.Add(new RotateTransform { Angle = rotate });
            }

            transform.Children.Add(new TranslateTransform { X = (int)p.X, Y = (int)p.Y });
            tb.RenderTransform = transform;

            if (this.clip.HasValue)
            {
                // add a clipping container that is not rotated
                var c = new Canvas();
                c.Children.Add(tb);
                this.Add(c);
            }
            else
            {
                this.Add(tb);
            }
        }
开发者ID:Cheesebaron,项目名称:oxyplot,代码行数:91,代码来源:MetroRenderContext.cs


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