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


C# GraphicsPath.AddRoundedRectangleBottomRight方法代码示例

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


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

示例1: OnDrawSlider

        /// <summary>
        /// Draws the slider itself in client coordinates
        /// </summary>
        /// <param name="g"></param>
        /// <param name="clipRectangle"></param>
        protected virtual void OnDrawSlider(Graphics g, Rectangle clipRectangle)
        {
            Color light = _sliderColor.Lighter(.3F);
            Color dark = _sliderColor.Darker(.3F);
            Point tl = new Point();
            Point br = new Point();
            double val = (Value - Minimum) / (Maximum - Minimum);
            int x, y, w, h;

            if (_orientation == Orientation.Horizontal)
            {
                w = 10;
                int span = Width - w - 1;
                float vSpan = _rampRectangle.Height - _rampRadius * 2;
                y = _rampRectangle.Top;
                if (_flipRamp)
                {
                    x = (int)(span * (1 - val));
                    // h = (int)(_rampRadius * 2 + vSpan * (1 - val));
                }
                else
                {
                    x = (int)(val * span);
                }
                h = (int)(_rampRadius * 2 + vSpan * val);
                if (h < 10) h = 10;
                if (_invertRamp == false)
                {
                    y = _rampRectangle.Bottom - h;
                }
            }
            else
            {
                h = 10;
                int span = Height - h - 1;
                x = _rampRectangle.Left;
                float hSpan = _rampRectangle.Width - _rampRadius * 2;
                if (_flipRamp)
                {
                    y = (int)(span * val);
                    //w = (int)(_rampRadius * 2 + hSpan * (1 - val));
                }
                else
                {
                    y = (int)(span * (1 - val));
                }
                w = (int)(_rampRadius * 2 + hSpan * val);
                if (w < 10) w = 10;
                if (_invertRamp == false)
                {
                    x = _rampRectangle.Right - w;
                }
            }
            if (x > _rampRectangle.Width) x = _rampRectangle.Width;
            if (x < 0) x = 0;
            if (y > _rampRectangle.Height) y = _rampRectangle.Height;
            if (y < 0) y = 0;
            tl.X = x;
            tl.Y = y;
            br.X = x + w;
            br.Y = y + h;
            try
            {
                LinearGradientBrush lgb = new LinearGradientBrush(tl, br, light, dark);
                Rectangle bounds = new Rectangle(x, y, w, h);
                _sliderRectangle = bounds;
                GraphicsPath gp = new GraphicsPath();
                gp.AddRoundedRectangle(bounds, (int)Math.Round(_sliderRadius));
                g.FillPath(lgb, gp);
                g.DrawPath(Pens.Gray, gp);
                gp.Dispose();
                GraphicsPath bottomRight = new GraphicsPath();
                bottomRight.AddRoundedRectangleBottomRight(bounds, (int)Math.Round(_sliderRadius));
                g.DrawPath(Pens.DarkGray, bottomRight);
                bottomRight.Dispose();
                lgb.Dispose();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:87,代码来源:RampSlider.cs


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