/// <summary> /// 重绘边线方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public virtual void onPaintBorder(FCPaint paint, FCRect clipRect) { long borderColor = getPaintingBorderColor(); paint.drawLine(borderColor, 1, 0, m_bounds.left, m_bounds.bottom - 1, m_bounds.right - 1, m_bounds.bottom - 1); paint.drawLine(borderColor, 1, 0, m_bounds.right - 1, m_bounds.top, m_bounds.right - 1, m_bounds.bottom - 1); }
/// <summary> /// 获取反色 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="originalColor">原始色</param> /// <returns>反色</returns> public static long reverse(FCPaint paint, long originalColor) { int a = 0, r = 0, g = 0, b = 0; toArgb(paint, originalColor, ref a, ref r, ref g, ref b); return(argb(a, 255 - r, 255 - g, 255 - b)); }
/// <summary> /// 绘制有下划线的数字 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="value">值</param> /// <param name="digit">保留小数位数</param> /// <param name="font">字体</param> /// <param name="fontColor">文字颜色</param> /// <param name="zeroAsEmpty">0是否为空</param> /// <param name="x">横坐标</param> /// <param name="y">纵坐标</param> /// <returns>绘制的横坐标</returns> public static int drawUnderLineNum(FCPaint paint, double value, int digit, FCFont font, long fontColor, bool zeroAsEmpty, int x, int y) { if (zeroAsEmpty && value == 0) { String text = "-"; FCSize size = paint.textSize(text, font); FCDraw.drawText(paint, text, fontColor, font, x, y); return(size.cx); } else { String[] nbs = FCStr.getValueByDigit(value, digit).Split(new String[] { "." }, StringSplitOptions.RemoveEmptyEntries); if (nbs.Length == 1) { FCSize size = paint.textSize(nbs[0], font); FCDraw.drawText(paint, nbs[0], fontColor, font, x, y); return(size.cx); } else { FCSize decimalSize = paint.textSize(nbs[0], font); FCSize size = paint.textSize(nbs[1], font); FCDraw.drawText(paint, nbs[0], fontColor, font, x, y); FCDraw.drawText(paint, nbs[1], fontColor, font, x + decimalSize.cx + 1, y); paint.drawLine(fontColor, 1, 0, x + decimalSize.cx + 1, y + decimalSize.cy, x + decimalSize.cx + size.cx, y + decimalSize.cy); return(decimalSize.cx + size.cx); } } }
/// <summary> /// 重绘方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public virtual void onPaint(FCPaint paint, FCRect clipRect) { int yearButtonsSize = m_yearButtons.size(); for (int i = 0; i < yearButtonsSize; i++) { YearButton yearButton = m_yearButtons.get(i); if (yearButton.Visible) { FCRect bounds = yearButton.Bounds; yearButton.onPaintBackGround(paint, bounds); yearButton.onPaintForeground(paint, bounds); yearButton.onPaintBorder(paint, bounds); } } int yearButtonAmSize = m_yearButtons_am.size(); for (int i = 0; i < yearButtonAmSize; i++) { YearButton yearButton = m_yearButtons_am.get(i); if (yearButton.Visible) { FCRect bounds = yearButton.Bounds; yearButton.onPaintBackGround(paint, bounds); yearButton.onPaintForeground(paint, bounds); yearButton.onPaintBorder(paint, bounds); } } }
/// <summary> /// 重绘方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public virtual void onPaint(FCPaint paint, FCRect clipRect) { int width = m_calendar.Width, height = m_calendar.Height; int top = height - m_height; FCRect rect = new FCRect(0, height - m_height, width, height); paint.fillRect(getPaintingBackColor(), rect); if (m_height > 0) { long textColor = getPaintingTextColor(); FCFont font = m_calendar.Font; FCSize tSize = paint.textSize("时", font); FCRect tRect = new FCRect(); tRect.left = width / 3 - tSize.cx; tRect.top = top + m_height / 2 - tSize.cy / 2; tRect.right = tRect.left + tSize.cx; tRect.bottom = tRect.top + tSize.cy; paint.drawText("时", textColor, font, tRect); tSize = paint.textSize("分", font); tRect.left = width * 2 / 3 - tSize.cx; tRect.top = top + m_height / 2 - tSize.cy / 2; tRect.right = tRect.left + tSize.cx; tRect.bottom = tRect.top + tSize.cy; paint.drawText("分", textColor, font, tRect); tSize = paint.textSize("秒", font); tRect.left = width - tSize.cx - 5; tRect.top = top + m_height / 2 - tSize.cy / 2; tRect.right = tRect.left + tSize.cx; tRect.bottom = tRect.top + tSize.cy; paint.drawText("秒", textColor, font, tRect); } }
/// <summary> /// 重绘前景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintForeground(FCPaint paint, FCRect clipRect) { base.onPaintForeground(paint, clipRect); if (Native != null && m_grid != null) { FCRect rect = new FCRect(0, 0, Width, Height); int tLeft = rect.right - 15; int midTop = rect.top + (rect.bottom - rect.top) / 2; long textColor = getPaintingTextColor(); //升序 if (m_sortMode == FCGridColumnSortMode.Asc) { FCPoint[] points = new FCPoint[3] { new FCPoint(tLeft + 5, midTop - 5), new FCPoint(tLeft, midTop + 5), new FCPoint(tLeft + 10, midTop + 5) }; paint.fillPolygon(textColor, points); } //降序 else if (m_sortMode == FCGridColumnSortMode.Desc) { FCPoint[] points = new FCPoint[3] { new FCPoint(tLeft + 5, midTop + 5), new FCPoint(tLeft, midTop - 5), new FCPoint(tLeft + 10, midTop - 5) }; paint.fillPolygon(textColor, points); } } }
/// <summary> /// 绘制背景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintBackground(FCPaint paint, FCRect clipRect) { base.onPaintBackground(paint, clipRect); if (paint.supportTransparent()) { ArrayList <FCView> controls = m_controls; int controlsSize = controls.size(); for (int i = 0; i < controlsSize; i++) { FCWindow window = controls.get(i) as FCWindow; if (window != null) { long shadowColor = window.ShadowColor; int shadowSize = window.ShadowSize; if (shadowColor != FCColor.None && shadowSize > 0 && window.IsDialog && window.Frame == this) { FCRect bounds = window.Bounds; FCRect leftShadow = new FCRect(bounds.left - shadowSize, bounds.top - shadowSize, bounds.left, bounds.bottom + shadowSize); paint.fillRect(shadowColor, leftShadow); FCRect rightShadow = new FCRect(bounds.right, bounds.top - shadowSize, bounds.right + shadowSize, bounds.bottom + shadowSize); paint.fillRect(shadowColor, rightShadow); FCRect topShadow = new FCRect(bounds.left, bounds.top - shadowSize, bounds.right, bounds.top); paint.fillRect(shadowColor, topShadow); FCRect bottomShadow = new FCRect(bounds.left, bounds.bottom, bounds.right, bounds.bottom + shadowSize); paint.fillRect(shadowColor, bottomShadow); break; } } } } }
/// <summary> /// 绘制文字 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="text">文字</param> /// <param name="dwPenColor">颜色</param> /// <param name="font">字体</param> /// <param name="x">横坐标</param> /// <param name="y">纵坐标</param> public static void drawText(FCPaint paint, String text, long dwPenColor, FCFont font, int x, int y) { FCSize tSize = paint.textSize(text, font); FCRect tRect = new FCRect(x, y, x + tSize.cx, y + tSize.cy); paint.drawText(text, dwPenColor, font, tRect); }
/// <summary> /// Öػ汳¾°·½·¨ /// </summary> /// <param name="paint">»æͼ¶ÔÏó</param> /// <param name="clipRect">²Ã¼ôÇøÓò</param> public override void onPaintBackground(FCPaint paint, FCRect clipRect) { int width = Width - 1, height = Height - 1; FCRect drawRect = new FCRect(0, 0, width, height); paint.fillRoundRect(getPaintingBackColor(), drawRect, 4); }
/// <summary> /// 重绘背景方法 /// </summary> /// <param name="paint">绘图区域</param> /// <param name="clipRect">裁剪对象</param> public override void onPaintBackground(FCPaint paint, FCRect clipRect) { int width = Width, height = Height; FCRect drawRect = new FCRect(0, 0, width, height); paint.fillGradientRect(FCDraw.FCCOLORS_BACKCOLOR, FCDraw.FCCOLORS_BACKCOLOR2, drawRect, 0, 90); }
/// <summary> /// 绘制复选框 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="rect">区域</param> public virtual void onPaintCheckBox(FCPaint paint, FCRect rect) { if (m_checked) { if (m_tree.CheckedImage != null && m_tree.CheckedImage.Length > 0) { paint.drawImage(m_tree.CheckedImage, rect); } else { paint.fillRect(FCColor.argb(0, 0, 0), rect); } } else { if (m_tree.UnCheckedImage != null && m_tree.UnCheckedImage.Length > 0) { paint.drawImage(m_tree.UnCheckedImage, rect); } else { paint.drawRect(FCColor.argb(0, 0, 0), 1, 0, rect); } } }
/// <summary> /// 重绘方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public virtual void onPaint(FCPaint paint, FCRect clipRect) { int dayButtonsSize = m_dayButtons.size(); for (int i = 0; i < dayButtonsSize; i++) { DayButton dayButton = m_dayButtons.get(i); if (dayButton.Visible) { FCRect bounds = dayButton.Bounds; dayButton.onPaintBackGround(paint, bounds); dayButton.onPaintForeground(paint, bounds); dayButton.onPaintBorder(paint, bounds); } } int dayButtonAmSize = m_dayButtons_am.size(); for (int i = 0; i < dayButtonAmSize; i++) { DayButton dayButton = m_dayButtons_am.get(i); if (dayButton.Visible) { FCRect bounds = dayButton.Bounds; dayButton.onPaintBackGround(paint, bounds); dayButton.onPaintForeground(paint, bounds); dayButton.onPaintBorder(paint, bounds); } } }
/// <summary> /// 重绘背景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintBackground(FCPaint paint, FCRect clipRect) { int width = Width, height = Height; FCRect rect = new FCRect(0, 0, width, height); paint.fillRoundRect(getPaintingBackColor(), rect, m_cornerRadius); }
/// <summary> /// 绘制编辑文本框 /// </summary> /// <param name="cell">单元格</param> /// <param name="paint">绘图对象</param> /// <param name="rect">区域</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintEditTextBox(FCGridCell cell, FCPaint paint, FCRect rect, FCRect clipRect) { FCTextBox editTextBox = EditTextBox; if (editTextBox != null) { FCTreeNode node = cell as FCTreeNode; if (node != null) { int indent = node.Indent; rect.left += indent; if (rect.right < rect.left) { rect.right = rect.left; } editTextBox.Bounds = rect; editTextBox.DisplayOffset = false; editTextBox.bringToFront(); } else { base.onPaintEditTextBox(cell, paint, rect, clipRect); } } }
/// <summary> /// 重绘前景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintForeground(FCPaint paint, FCRect clipRect) { if (m_calendar != null) { int width = Width, height = Height; FCFont font = Font; String text = ""; FCCalendarMode mode = m_calendar.Mode; //日 if (mode == FCCalendarMode.Day) { CMonth month = m_calendar.Month; text = month.Year.ToString() + "年" + month.Month.ToString() + "月"; } //月 else if (mode == FCCalendarMode.Month) { text = m_calendar.MonthDiv.Year.ToString() + "年"; } //年 else if (mode == FCCalendarMode.Year) { int startYear = m_calendar.YearDiv.StartYear; text = startYear.ToString() + "年 - " + (startYear + 12).ToString() + "年"; } FCSize tSize = paint.textSize(text, font); FCRect tRect = new FCRect(); tRect.left = (width - tSize.cx) / 2; tRect.top = (height - tSize.cy) / 2; tRect.right = tRect.left + tSize.cx + 1; tRect.bottom = tRect.top + tSize.cy + 1; paint.drawText(text, getPaintingTextColor(), font, tRect); } }
/// <summary> /// 重绘方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public virtual void onPaint(FCPaint paint, FCRect clipRect) { int monthButtonsSize = m_monthButtons.size(); for (int i = 0; i < monthButtonsSize; i++) { MonthButton monthButton = m_monthButtons.get(i); if (monthButton.Visible) { FCRect bounds = monthButton.Bounds; monthButton.onPaintBackGround(paint, bounds); monthButton.onPaintForeground(paint, bounds); monthButton.onPaintBorder(paint, bounds); } } int monthButtonAmSize = m_monthButtons_am.size(); for (int i = 0; i < monthButtonAmSize; i++) { MonthButton monthButton = m_monthButtons_am.get(i); if (monthButton.Visible) { FCRect bounds = monthButton.Bounds; monthButton.onPaintBackGround(paint, bounds); monthButton.onPaintForeground(paint, bounds); monthButton.onPaintBorder(paint, bounds); } } }
/// <summary> /// 重绘边线方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintBorder(FCPaint paint, FCRect clipRect) { FCFont font = Font; int width = Width, height = Height; String text = Text; FCSize tSize = new FCSize(); if (text.Length > 0) { tSize = paint.textSize(text, font); } else { tSize = paint.textSize("0", font); tSize.cx = 0; } //绘制边线 FCPoint[] points = new FCPoint[6]; int tMid = tSize.cy / 2; int padding = 2; points[0] = new FCPoint(10, tMid); points[1] = new FCPoint(padding, tMid); points[2] = new FCPoint(padding, height - padding); points[3] = new FCPoint(width - padding, height - padding); points[4] = new FCPoint(width - padding, tMid); points[5] = new FCPoint(14 + tSize.cx, tMid); paint.drawPolyline(getPaintingBorderColor(), 1, 0, points); callPaintEvents(FCEventID.PAINTBORDER, paint, clipRect); }
/// <summary> /// 重绘背景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintForeground(FCPaint paint, FCRect clipRect) { int width = Width, height = Height; FCPoint p1 = new FCPoint(), p2 = new FCPoint(), p3 = new FCPoint(); //计算三个点的位置 if (m_toLast) { p1.x = 0; p1.y = height / 2; p2.x = width; p2.y = 0; p3.x = width; p3.y = height; } else { p1.x = 0; p1.y = 0; p2.x = 0; p2.y = height; p3.x = width; p3.y = height / 2; } FCPoint[] points = new FCPoint[3]; points[0] = p1; points[1] = p2; points[2] = p3; paint.fillPolygon(getPaintingTextColor(), points); }
/// <summary> /// 重绘背景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintBackground(FCPaint paint, FCRect clipRect) { FCRect rect = new FCRect(0, 0, Width, Height); //绘制背景色 paint.fillRoundRect(getPaintingBackColor(), rect, m_cornerRadius); }
/// <summary> /// 绘制前景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintForeground(FCPaint paint, FCRect clipRect) { FCRect bounds = Bounds; int width = bounds.right - bounds.left; int height = bounds.bottom - bounds.top; if (width > 0 && height > 0) { if (m_ssLatestData != null && m_szLatestData != null && m_cyLatestData != null) { long titleColor = FCColor.argb(255, 255, 80); FCFont font = new FCFont("SimSun", 16, false, false, false); FCFont indexFont = new FCFont("Arial", 14, true, false, false); long grayColor = FCColor.Border; //上证指数 long indexColor = FCDraw.getPriceColor(m_ssLatestData.m_close, m_ssLatestData.m_lastClose); int left = 1; FCDraw.drawText(paint, "上证", titleColor, font, left, 3); left += 40; paint.drawLine(grayColor, 1, 0, left, 0, left, height); String amount = (m_ssLatestData.m_amount / 100000000).ToString("0.0") + "亿"; FCSize amountSize = paint.textSize(amount, indexFont); FCDraw.drawText(paint, amount, titleColor, indexFont, width / 3 - amountSize.cx, 3); left += (width / 3 - 40 - amountSize.cx) / 4; int length = FCDraw.drawUnderLineNum(paint, m_ssLatestData.m_close, 2, indexFont, indexColor, false, left, 3); left += length + (width / 3 - 40 - amountSize.cx) / 4; length = FCDraw.drawUnderLineNum(paint, m_ssLatestData.m_close - m_ssLatestData.m_lastClose, 2, indexFont, indexColor, false, left, 3); //深证指数 left = width / 3; paint.drawLine(grayColor, 1, 0, left, 0, left, height); indexColor = FCDraw.getPriceColor(m_szLatestData.m_close, m_szLatestData.m_lastClose); FCDraw.drawText(paint, "深证", titleColor, font, left, 3); left += 40; paint.drawLine(grayColor, 1, 0, left, 0, left, height); amount = (m_szLatestData.m_amount / 100000000).ToString("0.0") + "亿"; amountSize = paint.textSize(amount, indexFont); FCDraw.drawText(paint, amount, titleColor, indexFont, width * 2 / 3 - amountSize.cx, 3); left += (width / 3 - 40 - amountSize.cx) / 4; length = FCDraw.drawUnderLineNum(paint, m_szLatestData.m_close, 2, indexFont, indexColor, false, left, 3); left += length + (width / 3 - 40 - amountSize.cx) / 4; length = FCDraw.drawUnderLineNum(paint, m_szLatestData.m_close - m_szLatestData.m_lastClose, 2, indexFont, indexColor, false, left, 3); //创业指数 left = width * 2 / 3; paint.drawLine(grayColor, 1, 0, left, 0, left, height); indexColor = FCDraw.getPriceColor(m_cyLatestData.m_close, m_cyLatestData.m_lastClose); FCDraw.drawText(paint, "创业", titleColor, font, left, 3); left += 40; paint.drawLine(grayColor, 1, 0, left, 0, left, height); amount = (m_cyLatestData.m_amount / 100000000).ToString("0.0") + "亿"; amountSize = paint.textSize(amount, indexFont); FCDraw.drawText(paint, amount, titleColor, indexFont, width - amountSize.cx, 3); left += (width / 3 - 40 - amountSize.cx) / 4; length = FCDraw.drawUnderLineNum(paint, m_cyLatestData.m_close, 2, indexFont, indexColor, false, left, 3); left += (width / 3 - 40 - amountSize.cx) / 4 + length; length = FCDraw.drawUnderLineNum(paint, m_cyLatestData.m_close - m_cyLatestData.m_lastClose, 2, indexFont, indexColor, false, left, 3); paint.drawRect(grayColor, 1, 0, new FCRect(0, 0, width - 1, height - 1)); } } }
/// <summary> /// 绘制背景 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintBackground(FCPaint paint, FCRect clipRect) { int width = Width, height = Height; float xRate = (float)width / 200; float yRate = (float)height / 200; FCRect drawRect = new FCRect(0, 0, width - 1, height - 1); if (m_isEllipse) { paint.fillEllipse(getPaintingBackColor(), drawRect); } else { paint.fillRect(getPaintingBackColor(), drawRect); } long textColor = getPaintingTextColor(); float lineWidth = 10 * xRate; if (m_style == WindowButtonStyle.Close) { paint.setLineCap(2, 2); paint.drawLine(textColor, lineWidth, 0, (int)(135 * xRate), (int)(70 * yRate), (int)(70 * xRate), (int)(135 * yRate)); paint.drawLine(textColor, lineWidth, 0, (int)(70 * xRate), (int)(70 * yRate), (int)(135 * xRate), (int)(135 * yRate)); } else if (m_style == WindowButtonStyle.Max) { paint.setLineCap(2, 2); paint.drawLine(textColor, lineWidth, 0, (int)(80 * xRate), (int)(80 * yRate), (int)(60 * xRate), (int)(60 * yRate)); paint.drawLine(textColor, lineWidth, 0, (int)(125 * xRate), (int)(145 * yRate), (int)(145 * xRate), (int)(145 * yRate)); paint.drawLine(textColor, lineWidth, 0, (int)(145 * xRate), (int)(125 * yRate), (int)(145 * xRate), (int)(145 * yRate)); paint.drawLine(textColor, lineWidth, 0, (int)(125 * xRate), (int)(125 * yRate), (int)(145 * xRate), (int)(145 * yRate)); paint.drawLine(textColor, lineWidth, 0, (int)(60 * xRate), (int)(80 * yRate), (int)(60 * xRate), (int)(60 * yRate)); paint.drawLine(textColor, lineWidth, 0, (int)(80 * xRate), (int)(60 * yRate), (int)(60 * xRate), (int)(60 * yRate)); paint.drawLine(textColor, lineWidth, 0, (int)(125 * xRate), (int)(80 * yRate), (int)(145 * xRate), (int)(60 * yRate)); paint.drawLine(textColor, lineWidth, 0, (int)(145 * xRate), (int)(80 * yRate), (int)(145 * xRate), (int)(60 * yRate)); paint.drawLine(textColor, lineWidth, 0, (int)(125 * xRate), (int)(60 * yRate), (int)(145 * xRate), (int)(60 * yRate)); paint.drawLine(textColor, lineWidth, 0, (int)(80 * xRate), (int)(125 * yRate), (int)(60 * xRate), (int)(145 * yRate)); paint.drawLine(textColor, lineWidth, 0, (int)(60 * xRate), (int)(125 * yRate), (int)(60 * xRate), (int)(145 * yRate)); paint.drawLine(textColor, lineWidth, 0, (int)(80 * xRate), (int)(145 * yRate), (int)(60 * xRate), (int)(145 * yRate)); } else if (m_style == WindowButtonStyle.Min) { paint.setLineCap(2, 2); paint.drawLine(textColor, lineWidth, (int)(0 * xRate), (int)(60 * yRate), (int)(105 * xRate), (int)(135 * xRate), (int)(105 * yRate)); } else if (m_style == WindowButtonStyle.Restore) { paint.setLineCap(2, 2); paint.drawLine(textColor, lineWidth, (int)(0 * xRate), (int)(90 * yRate), (int)(90 * xRate), (int)(70 * xRate), (int)(70 * yRate)); paint.drawLine(textColor, lineWidth, (int)(0 * xRate), (int)(90 * yRate), (int)(90 * xRate), (int)(70 * xRate), (int)(90 * yRate)); paint.drawLine(textColor, lineWidth, (int)(0 * xRate), (int)(90 * yRate), (int)(90 * xRate), (int)(90 * xRate), (int)(70 * yRate)); paint.drawLine(textColor, lineWidth, (int)(0 * xRate), (int)(115 * yRate), (int)(115 * xRate), (int)(135 * xRate), (int)(135 * yRate)); paint.drawLine(textColor, lineWidth, (int)(0 * xRate), (int)(115 * yRate), (int)(115 * xRate), (int)(135 * xRate), (int)(115 * yRate)); paint.drawLine(textColor, lineWidth, (int)(0 * xRate), (int)(115 * yRate), (int)(115 * xRate), (int)(115 * xRate), (int)(135 * yRate)); } paint.setLineCap(0, 0); }
/// <summary> /// 重绘前景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintForeground(FCPaint paint, FCRect clipRect) { String text = Text; int width = Width, height = Height; if (width > 0 && height > 0) { FCRect buttonRect = new FCRect(5, (height - m_buttonSize.cy) / 2, 5 + m_buttonSize.cx, (height + m_buttonSize.cy) / 2); FCPoint tLocation = new FCPoint(); FCSize tSize = new FCSize(); FCFont font = Font; if (text != null && text.Length > 0) { tSize = paint.textSize(text, font); tLocation.x = buttonRect.right + 5; tLocation.y = (height - tSize.cy) / 2; } //居中 if (m_buttonAlign == FCHorizontalAlign.Center) { buttonRect.left = (width - m_buttonSize.cx) / 2; buttonRect.right = (width + m_buttonSize.cx) / 2; tLocation.x = buttonRect.right + 5; } //远离 else if (m_buttonAlign == FCHorizontalAlign.Right) { buttonRect.left = width - m_buttonSize.cx - 5; buttonRect.right = width - 5; tLocation.x = buttonRect.left - tSize.cx - 5; } //绘制背景图 onPaintCheckButton(paint, buttonRect); //绘制文字 if (text != null && text.Length > 0) { FCRect tRect = new FCRect(tLocation.x, tLocation.y, tLocation.x + tSize.cx + 1, tLocation.y + tSize.cy); long textColor = getPaintingTextColor(); if (AutoEllipsis && (tRect.right > clipRect.right || tRect.bottom > clipRect.bottom)) { if (tRect.right > clipRect.right) { tRect.right = clipRect.right; } if (tRect.bottom > clipRect.bottom) { tRect.bottom = clipRect.bottom; } paint.drawTextAutoEllipsis(text, textColor, font, tRect); } else { paint.drawText(text, textColor, font, tRect); } } } }
/// <summary> /// Öػ汳¾° /// </summary> /// <param name="paint">»æͼ¶ÔÏó</param> /// <param name="clipRect">²Ã¼ôÇøÓò</param> public override void onPaintBackground(FCPaint paint, FCRect clipRect) { int width = Width; int height = Height; String text = Text; FCFont font = Font; FCSize tSize = paint.textSize(text, font); int drawWidth = tSize.cx + 20; FCRect drawRect = new FCRect(0, 0, width, height); FCNative native = Native; //»æÖƱ³¾° if (this == native.HoveredControl) { paint.fillGradientRect(FCDraw.FCCOLORS_BACKCOLOR5, FCDraw.FCCOLORS_BACKCOLOR6, drawRect, 2, 90); } //»æÖÆͼ±ê String backImage = getPaintingBackImage(); FCRect imageRect = new FCRect(2, (height - 16) / 2, 18, (height + 16) / 2); if (backImage != null && backImage.Length > 0) { paint.fillRect(getPaintingBackColor(), imageRect); paint.drawImage(getPaintingBackImage(), imageRect); } //»æÖÆÎÄ×Ö FCRect tRect = new FCRect(); tRect.left = imageRect.right + 4; tRect.top = (height - tSize.cy) / 2; tRect.right = tRect.left + tSize.cx; tRect.bottom = tRect.top + tSize.cy; paint.drawText(text, getPaintingTextColor(), font, tRect); //»æÖƱßÏß if (this == native.HoveredControl) { paint.drawRoundRect(getPaintingBorderColor(), 1, 0, drawRect, 2); } if (Enabled) { if (this == native.PushedControl) { paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR4, drawRect); } else if (this == native.HoveredControl) { paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR3, drawRect); } } else { paint.fillRect(FCDraw.FCCOLORS_BACKCOLOR7, drawRect); } }
/// <summary> /// 重绘前景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintForeground(FCPaint paint, FCRect clipRect) { String text = Text; if (text.Length > 0) { FCFont font = Font; FCSize tSize = paint.textSize(text, font); FCRect tRect = new FCRect(12, 0, 12 + tSize.cx, tSize.cy); paint.drawText(text, getPaintingTextColor(), font, tRect); } }
/// <summary> /// 绘制控件方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="rect">区域</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintControl(FCPaint paint, FCRect rect, FCRect clipRect) { if (m_control != null) { m_control.Text = "A"; m_control.BorderColor = FCColor.Border; int buttonWidth = 30; FCRect bounds = new FCRect(rect.right - 1 - buttonWidth, rect.top + 1, rect.right - 2, rect.bottom - 1); m_control.Bounds = bounds; m_control.Region = new FCRect(0, 0, bounds.right - bounds.left, bounds.bottom - bounds.top); } }
/// <summary> /// 重绘方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="rect">矩形</param> /// <param name="clipRect">裁剪矩形</param> public virtual void onPaintControl(FCPaint paint, FCRect rect, FCRect clipRect) { if (m_control != null) { FCRect bounds = new FCRect(rect.left + 1, rect.top + 1, rect.right - 1, rect.bottom - 1); m_control.Bounds = bounds; clipRect.left -= rect.left; clipRect.top -= rect.top; clipRect.right -= rect.left; clipRect.bottom -= rect.top; m_control.Region = clipRect; } }
/// <summary> /// 重绘前景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintForeground(FCPaint paint, FCRect clipRect) { base.onPaintForeground(paint, clipRect); //绘制移动的节点 if (m_movingNode != null) { FCFont font = Font; FCPoint mp = TouchPoint; FCSize tSize = paint.textSize(m_movingNode.Text, font); FCRect tRect = new FCRect(mp.x, mp.y, mp.x + tSize.cx, mp.y + tSize.cy); paint.drawText(m_movingNode.Text, TextColor, font, tRect); } }
/// <summary> /// 绘制边线方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintBorder(FCPaint paint, FCRect clipRect) { int width = Width, height = Height; FCRect drawRect = new FCRect(0, 0, width, height); if (m_isEllipse) { paint.drawEllipse(getPaintingBorderColor(), 1, 0, drawRect); } else { paint.drawRect(getPaintingBorderColor(), 1, 0, drawRect); } }
/// <summary> /// 绘制前景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintForeground(FCPaint paint, FCRect clipRect) { String text = Text; if (text != null && text.Length > 0) { int width = Width; FCFont font = Font; FCSize tSize = paint.textSize(text, font); FCPoint strPoint = new FCPoint(); strPoint.x = 5; strPoint.y = (m_captionHeight - tSize.cy) / 2; FCRect tRect = new FCRect(strPoint.x, strPoint.y, strPoint.x + tSize.cx, strPoint.y + tSize.cy); paint.drawText(text, getPaintingTextColor(), font, tRect); } }
/// <summary> /// 重绘前景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public virtual void onPaintForeground(FCPaint paint, FCRect clipRect) { int width = m_bounds.right - m_bounds.left; int height = m_bounds.bottom - m_bounds.top; String yearStr = m_year.ToString(); FCFont font = m_calendar.Font; FCSize textSize = paint.textSize(yearStr, font); //创建渐变刷 FCRect tRect = new FCRect(); tRect.left = m_bounds.left + (width - textSize.cx) / 2; tRect.top = m_bounds.top + (height - textSize.cy) / 2; tRect.right = tRect.left + textSize.cx; tRect.bottom = tRect.top + textSize.cy; paint.drawText(yearStr, getPaintingTextColor(), font, tRect); }