當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。