/// <summary> /// 重绘前景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void OnPaintBackground(CPaint paint, RECT clipRect) { int width = Width; int height = Height; RECT rect = new RECT(0, 0, width, height - 1); long foreColor = CDraw.PCOLORS_WINDOWFORECOLOR; int captionHeight = CaptionHeight; RECT contentRect = rect; contentRect.top += captionHeight; contentRect.bottom -= 6; contentRect.left += 6; contentRect.right -= 6; paint.BeginPath(); paint.AddRect(contentRect); paint.ExcludeClipPath(); paint.ClosePath(); paint.FillGradientRect(CDraw.PCOLORS_BACKCOLOR2, CDraw.PCOLORS_BACKCOLOR2, rect, 6, 0); paint.SetClip(clipRect); paint.FillGradientRect(CDraw.PCOLORS_BACKCOLOR, CDraw.PCOLORS_BACKCOLOR2, new RECT(0, 0, width, captionHeight), 6, 90); paint.DrawRoundRect(COLOR.CONTROLBORDER, 1, 0, rect, 6); if (contentRect.right - contentRect.left > 0 && contentRect.bottom - contentRect.top > 0) { contentRect.top -= 1; contentRect.left -= 1; contentRect.right += 1; contentRect.bottom += 1; paint.FillGradientRect(CDraw.PCOLORS_BACKCOLOR2, CDraw.PCOLORS_BACKCOLOR2, contentRect, 6, 0); //paint.FillRect(CDraw.PCOLORS_WINDOWCONTENTBACKCOLOR, contentRect); } paint.DrawLine(COLOR.CONTROLBORDER, 1, 0, 0, captionHeight - 1, width, captionHeight - 1); CDraw.DrawText(paint, Text, foreColor, Font, 10, 4); }
/// <summary> /// 重绘前景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void OnPaintBackground(CPaint paint, RECT clipRect) { int width = Width; int height = Height; RECT rect = new RECT(0, 0, width, height); long backColor = CDraw.PCOLORS_WINDOWBACKCOLOR; long foreColor = CDraw.PCOLORS_WINDOWFORECOLOR; if (paint.SupportTransparent()) { backColor = CDraw.PCOLORS_WINDOWBACKCOLOR2; } int captionHeight = CaptionHeight; RECT contentRect = rect; contentRect.top += captionHeight; contentRect.bottom -= 6; contentRect.left += 6; contentRect.right -= 6; paint.BeginPath(); paint.AddRect(contentRect); paint.ExcludeClipPath(); paint.ClosePath(); paint.FillRoundRect(backColor, rect, 6); paint.SetClip(clipRect); if (contentRect.right - contentRect.left > 0 && contentRect.bottom - contentRect.top > 0) { contentRect.top -= 1; contentRect.left -= 1; contentRect.right += 1; contentRect.bottom += 1; paint.FillRect(CDraw.PCOLORS_WINDOWCONTENTBACKCOLOR, contentRect); } CDraw.DrawText(paint, Text, foreColor, Font, 5, 3); }