示例#1
0
		private void Internal_DrawButton (Graphics dc, Rectangle rect, int state, CPColor cpcolor, bool is_ColorControl, Color backcolor)
		{
			switch (state) {
			case 0: // normal or normal disabled button
				Pen pen = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight);
				dc.DrawLine (pen, rect.X, rect.Y, rect.X, rect.Bottom - 2);
				dc.DrawLine (pen, rect.X + 1, rect.Y, rect.Right - 2, rect.Y);
				
				pen = is_ColorControl ? SystemPens.Control : ResPool.GetPen (backcolor);
				dc.DrawLine (pen, rect.X + 1, rect.Y + 1, rect.X + 1, rect.Bottom - 3);
				dc.DrawLine (pen, rect.X + 2, rect.Y + 1, rect.Right - 3, rect.Y + 1);
				
				pen = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark);
				dc.DrawLine (pen, rect.X + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2);
				dc.DrawLine (pen, rect.Right - 2, rect.Y + 1, rect.Right - 2, rect.Bottom - 3);
				
				pen = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark);
				dc.DrawLine (pen, rect.X, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1);
				dc.DrawLine (pen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 2);
				break;
			case 1: // popup button normal (or pressed normal or popup button)
				pen = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark);
				dc.DrawRectangle (pen, rect.X, rect.Y, rect.Width - 1, rect.Height - 1);
				break;
			case 2: // popup button poped up
				pen = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight);
				dc.DrawLine (pen, rect.X, rect.Y, rect.X, rect.Bottom - 2);
				dc.DrawLine (pen, rect.X + 1, rect.Y, rect.Right - 2, rect.Y);
				
				pen = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark);
				dc.DrawLine (pen, rect.X, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1);
				dc.DrawLine (pen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 2);
				break;
			case 3: // flat button not entered
				pen = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark);
				dc.DrawRectangle (pen, rect.X, rect.Y, rect.Width - 1, rect.Height - 1);
				break;
			default:
				break;
			}
		}
示例#2
0
文件: Theme.cs 项目: Profit0004/mono
		public CPColor GetCPColor (Color color)
		{
			lock (cpcolors) {
				object tmp = cpcolors [color];
			
				if (tmp == null) {
					CPColor cpcolor = new CPColor ();
					cpcolor.Dark = ControlPaint.Dark (color);
					cpcolor.DarkDark = ControlPaint.DarkDark (color);
					cpcolor.Light = ControlPaint.Light (color);
					cpcolor.LightLight = ControlPaint.LightLight (color);
				
					cpcolors.Add (color, cpcolor);

					return cpcolor;
				}
			
				return (CPColor)tmp;
			}
		}