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


C# PdnRegion.GetRegionReadOnly方法代码示例

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


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

示例1: DrawGradient


//.........这里部分代码省略.........
                        }

                        g.DrawImage(ra.Bitmap, gradientRect, ra.Bounds, GraphicsUnit.Pixel);
                    }
                    else if (Orientation == Orientation.Vertical)
                    {
                        // TODO
                    }
                    else
                    {
                        throw new InvalidEnumArgumentException();
                    }
                }

                gradientSurface.Dispose();
            }
            else
            {
                using (LinearGradientBrush lgb = new LinearGradientBrush(this.ClientRectangle,
                           maxColor, minColor, gradientAngle, false))
                {
                    g.FillRectangle(lgb, gradientRect);
                }
            }

            // fill background
            using (PdnRegion nonGradientRegion = new PdnRegion())
            {
                nonGradientRegion.MakeInfinite();
                nonGradientRegion.Exclude(gradientRect);

                using (SolidBrush sb = new SolidBrush(this.BackColor))
                {
                    g.FillRegion(sb, nonGradientRegion.GetRegionReadOnly());
                }
            }

            // draw value triangles
            for (int i = 0; i < this.vals.Length; i++)
            {
                int pos = ValueToPosition(vals[i]);
                Brush brush;
                Pen pen;

                if (i == highlight) 
                {
                    brush = Brushes.Blue;
                    pen = (Pen)Pens.White.Clone();
                } 
                else 
                {
                    brush = Brushes.Black;
                    pen = (Pen)Pens.Gray.Clone();
                }

                g.SmoothingMode = SmoothingMode.AntiAlias;

                Point a1;
                Point b1;
                Point c1;

                Point a2;
                Point b2;
                Point c2;

                switch (this.orientation)
开发者ID:metadeta96,项目名称:openpdn,代码行数:67,代码来源:ColorGradientControl.cs

示例2: DrawShadow

        private void DrawShadow(Graphics g, Rectangle clipRect)
        {
            if (this.occludingControl != null)
            {
                // Draw the outline rectangle
                Rectangle outlineRect = new Rectangle(new Point(0, 0), this.occludingControl.Size);

                outlineRect = occludingControl.RectangleToScreen(outlineRect);
                outlineRect = RectangleToClient(outlineRect);
                outlineRect.X -= 1;
                outlineRect.Y -= 1;
                outlineRect.Width += 2;
                outlineRect.Height += 2;

                g.DrawLines(
                    Pens.Black,
                    new Point[]
                    {
                        new Point(outlineRect.Left, outlineRect.Top),
                        new Point(outlineRect.Right, outlineRect.Top),
                        new Point(outlineRect.Right, outlineRect.Bottom),
                        new Point(outlineRect.Left, outlineRect.Bottom),
                        new Point(outlineRect.Left, outlineRect.Top)
                    }); 
                
                using (PdnRegion backRegion = new PdnRegion(clipRect))
                {
                    Rectangle occludingRect = new Rectangle(0, 0, this.occludingControl.Width, this.occludingControl.Height);
                    occludingRect = this.occludingControl.RectangleToScreen(occludingRect);
                    occludingRect = RectangleToClient(occludingRect);
                    backRegion.Exclude(occludingRect);
                    backRegion.Exclude(outlineRect);

                    using (Brush backBrush = new SolidBrush(this.BackColor))
                    {
                        g.FillRegion(backBrush, backRegion.GetRegionReadOnly());
                    }
                }
                
                Rectangle edgeRect = new Rectangle(0, 0, this.roundedEdgeUL.Width, this.roundedEdgeUR.Height);

                Rectangle ulEdgeRect = new Rectangle(outlineRect.Left - 3, outlineRect.Top - 3, this.roundedEdgeUL.Width, this.roundedEdgeUL.Height);
                Rectangle urEdgeRect = new Rectangle(outlineRect.Right - 3, outlineRect.Top - 3, this.roundedEdgeUR.Width, this.roundedEdgeUR.Height);
                Rectangle llEdgeRect = new Rectangle(outlineRect.Left - 3, outlineRect.Bottom - 3, this.roundedEdgeLL.Width, this.roundedEdgeLL.Height);
                Rectangle lrEdgeRect = new Rectangle(outlineRect.Right - 3, outlineRect.Bottom - 3, this.roundedEdgeLR.Width, this.roundedEdgeLR.Height);

                g.DrawImage(this.roundedEdgeUL, ulEdgeRect, edgeRect, GraphicsUnit.Pixel);
                g.DrawImage(this.roundedEdgeUR, urEdgeRect, edgeRect, GraphicsUnit.Pixel);
                g.DrawImage(this.roundedEdgeLL, llEdgeRect, edgeRect, GraphicsUnit.Pixel);
                g.DrawImage(this.roundedEdgeLR, lrEdgeRect, edgeRect, GraphicsUnit.Pixel);

                Color c1 = Color.FromArgb(95, Color.Black);
                Color c2 = Color.FromArgb(47, Color.Black);
                Color c3 = Color.FromArgb(15, Color.Black);

                Pen p1 = new Pen(c1);
                Pen p2 = new Pen(c2);
                Pen p3 = new Pen(c3);

                // Draw top soft edge
                g.DrawLine(p1, ulEdgeRect.Right, outlineRect.Top - 1, urEdgeRect.Left - 1, outlineRect.Top - 1);
                g.DrawLine(p2, ulEdgeRect.Right, outlineRect.Top - 2, urEdgeRect.Left - 1, outlineRect.Top - 2);
                g.DrawLine(p3, ulEdgeRect.Right, outlineRect.Top - 3, urEdgeRect.Left - 1, outlineRect.Top - 3);

                // Draw bottom soft edge
                g.DrawLine(p1, llEdgeRect.Right, outlineRect.Bottom + 0, lrEdgeRect.Left - 1, outlineRect.Bottom + 0);
                g.DrawLine(p2, llEdgeRect.Right, outlineRect.Bottom + 1, lrEdgeRect.Left - 1, outlineRect.Bottom + 1);
                g.DrawLine(p3, llEdgeRect.Right, outlineRect.Bottom + 2, lrEdgeRect.Left - 1, outlineRect.Bottom + 2);

                // Draw left soft edge
                g.DrawLine(p1, outlineRect.Left - 1, ulEdgeRect.Bottom, outlineRect.Left - 1, llEdgeRect.Top - 1);
                g.DrawLine(p2, outlineRect.Left - 2, ulEdgeRect.Bottom, outlineRect.Left - 2, llEdgeRect.Top - 1);
                g.DrawLine(p3, outlineRect.Left - 3, ulEdgeRect.Bottom, outlineRect.Left - 3, llEdgeRect.Top - 1);

                // Draw right soft edge
                g.DrawLine(p1, outlineRect.Right + 0, urEdgeRect.Bottom, outlineRect.Right + 0, lrEdgeRect.Top - 1);
                g.DrawLine(p2, outlineRect.Right + 1, urEdgeRect.Bottom, outlineRect.Right + 1, lrEdgeRect.Top - 1);
                g.DrawLine(p3, outlineRect.Right + 2, urEdgeRect.Bottom, outlineRect.Right + 2, lrEdgeRect.Top - 1);

                p1.Dispose();
                p1 = null;

                p2.Dispose();
                p2 = null;

                p3.Dispose();
                p3 = null;
            }

            if (this.betaTagString != null)
            {
                Color betaTagColor = Color.FromArgb(this.betaTagOpacity, SystemColors.WindowText);
                Brush betaTagBrush = new SolidBrush(betaTagColor);
                StringFormat sf = (StringFormat)StringFormat.GenericTypographic.Clone();

                sf.Alignment = StringAlignment.Center;
                sf.LineAlignment = StringAlignment.Near;

                g.DrawString(
                    this.betaTagString,
//.........这里部分代码省略.........
开发者ID:metadeta96,项目名称:openpdn,代码行数:101,代码来源:ControlShadow.cs


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