Source/ShadowPainter.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace DevComponents.DotNetBar
{
	/// <summary>
	/// Represents class that provides shadows to elements.
	/// </summary>
	public class ShadowPainter
	{
		/// <summary>
		/// Creates new instance of shadow painter.
		/// </summary>
		public ShadowPainter()
		{
		}

		private static System.Drawing.Drawing2D.GraphicsPath GetPath(Rectangle r)
		{
			System.Drawing.Drawing2D.GraphicsPath path=new System.Drawing.Drawing2D.GraphicsPath();
			path.AddLine(r.Left+1,r.Y,r.Right-1,r.Y);
			path.AddLine(r.Right-1,r.Y,r.Right-1,r.Y+1);
			path.AddLine(r.Right-1,r.Y+1,r.Right,r.Y+1);
			path.AddLine(r.Right,r.Y+1,r.Right,r.Bottom-1);
			path.AddLine(r.Right,r.Bottom-1,r.Right-1,r.Bottom-1);
			path.AddLine(r.Right-1,r.Bottom-1,r.Right-1,r.Bottom);
			path.AddLine(r.Right-1,r.Bottom,r.Left+1,r.Bottom);
			path.AddLine(r.Left+1,r.Bottom,r.Left+1,r.Bottom-1);
			path.AddLine(r.Left+1,r.Bottom-1,r.Left,r.Bottom-1);
			path.AddLine(r.Left,r.Bottom-1,r.Left,r.Top+1);
			return path;
		}

		public static void Paint(ShadowPaintInfo info)
		{
			Graphics g=info.Graphics;
			Region oldClip=g.Clip;
            if(info.ClipRectangle.IsEmpty)
			    g.SetClip(info.Rectangle,CombineMode.Exclude);
            else
                g.SetClip(info.ClipRectangle, CombineMode.Exclude);
			Color[] clr=new Color[]{
									   Color.FromArgb(14,Color.Black),
									   Color.FromArgb(43,Color.Black),
									   Color.FromArgb(84,Color.Black),
									   Color.FromArgb(113,Color.Black),
									   Color.FromArgb(128,Color.Black)};

			
			Rectangle r=info.Rectangle;
			r.Width--;
			r.Height--;
			int offset=info.Size/2;
			r.Offset(offset,offset);
			r.Width+=(info.Size-offset);
			r.Height+=(info.Size-offset);
			
			for(int i=0;i<info.Size;i++)
			{
后面还有 76 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。