/// <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="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 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="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 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 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) { 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="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="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 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 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> /// <returns>矩形集合</returns> private FCRect[] getResizePoints() { int width = Width - 1; int height = Height - 1; FCRect[] points = new FCRect[9]; int size = RESIZEPOINT_SIZE; //左 points[0] = new FCRect(0, height / 2 - size, size, height / 2 + size); //上 points[1] = new FCRect(width / 2 - size, 0, width / 2 + size, size); //右 points[2] = new FCRect(width - size, height / 2 - size, width, height / 2 + size); //下 points[3] = new FCRect(width / 2 - size, height - size, width / 2 + size, height); //左上 points[4] = new FCRect(0, 0, size, size); //左下 points[5] = new FCRect(0, height - size, size, height); //右上 points[6] = new FCRect(width - size, 0, width, size); //右下 points[7] = new FCRect(width - size, height - size, width, height); return(points); }
/// <summary> /// 重绘方法 /// </summary> /// <param name="clipRect">裁剪区域</param> public void onPaint(FCRect clipRect) { lock (this) { if (m_container != null) { FCSize displaySize = m_native.DisplaySize; double scaleFactorX = 1, scaleFactorY = 1; FCSize clientSize = getClientSize(); if (m_native.AllowScaleSize) { if (clientSize.cx > 0 && clientSize.cy > 0) { FCSize scaleSize = m_native.ScaleSize; scaleFactorX = (double)(clientSize.cx) / scaleSize.cx; scaleFactorY = (double)(clientSize.cy) / scaleSize.cy; } } Graphics g = m_container.CreateGraphics(); m_native.Paint.setScaleFactor(scaleFactorX, scaleFactorY); m_native.Paint.beginPaint(g.GetHdc(), new FCRect(0, 0, clientSize.cx, clientSize.cy), clipRect); m_native.onPaint(clipRect); m_native.Paint.endPaint(); g.Dispose(); } } }
/// <summary> /// 触摸点击方法 /// </summary> /// <param name="touchInfo">触摸信息</param> public void onClick(FCTouchInfo touchInfo) { FCPoint mp = touchInfo.m_firstPoint; 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; if (mp.x >= bounds.left && mp.x <= bounds.right && mp.y >= bounds.top && mp.y <= bounds.bottom) { monthButton.onClick(touchInfo); return; } } } 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; if (mp.x >= bounds.left && mp.x <= bounds.right && mp.y >= bounds.top && mp.y <= bounds.bottom) { monthButton.onClick(touchInfo); return; } } } }
/// <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 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 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 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="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 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 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 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, 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="mp">坐标</param> /// <returns>调整尺寸的点</returns> private int getResizePoint(FCPoint mp) { FCRect[] pRects = getResizePoints(); int rsize = pRects.Length; for (int i = rsize - 1; i >= 0; i--) { FCRect rect = pRects[i]; if (mp.x >= rect.left && mp.x <= rect.right && mp.y >= rect.top && mp.y <= rect.bottom) { return(i); } } int targetsSize = m_targets.Count; if (targetsSize > 0) { int width = Width, height = Height; if (mp.x >= 0 && mp.x <= width && mp.y >= 0 && mp.y <= height) { bool inBorder = false; int size = RESIZEPOINT_SIZE; if (mp.x <= size || mp.x >= width - size || mp.y <= size || mp.y >= height - size) { inBorder = true; } if (targetsSize == 1) { if (m_xml.isContainer(m_targets[0])) { if (inBorder) { return(8); } } else { return(8); } } else { if (inBorder) { return(8); } } } } return(-1); }
/// <summary> /// 重置列头布局 /// </summary> public virtual void resetHeaderLayout() { int bandsSize = m_bands.size(); FCRect bounds = Bounds; int left = bounds.left; int width = Width; if (bandsSize == 0) { int scrollH = 0; FCHScrollBar hScrollBar = Grid.HScrollBar; if (hScrollBar != null && hScrollBar.Visible) { scrollH = -hScrollBar.Pos; } int columnsSize = m_columns.size(); for (int i = 0; i < columnsSize; i++) { FCBandedFCGridColumn column = m_columns.get(i); if (column.Visible) { int columnWidth = column.Width; if (i == columnsSize - 1 || left + columnWidth > width + bounds.left) { columnWidth = width + bounds.left - left; } FCRect cellRect = new FCRect(left, bounds.bottom, left + columnWidth, bounds.bottom + column.Height); column.Bounds = cellRect; cellRect.left -= scrollH; cellRect.right -= scrollH; column.HeaderRect = cellRect; left += columnWidth; } } } else { for (int i = 0; i < bandsSize; i++) { FCGridBand band = m_bands.get(i); if (band.Visible) { int bandWidth = band.Width; if (i == bandsSize - 1 || left + bandWidth > width + bounds.left) { bandWidth = width + bounds.left - left; } FCRect cellRect = new FCRect(left, bounds.bottom, left + bandWidth, bounds.bottom + band.Height); band.Bounds = cellRect; band.resetHeaderLayout(); left += bandWidth; } } } }
/// <summary> /// 单元格触摸按下方法 /// </summary> /// <param name="cell">单元格</param> /// <param name="touchInfo">触摸信息</param> public override void onCellTouchDown(FCGridCell cell, FCTouchInfo touchInfo) { base.onCellTouchDown(cell, touchInfo); FCPoint mp = touchInfo.m_firstPoint; FCTreeNode node = cell as FCTreeNode; if (node != null) { int scrollH = 0; FCHScrollBar hscrollBar = HScrollBar; if (hscrollBar != null && hscrollBar.Visible) { scrollH = hscrollBar.Pos; } FCRect headerRect = node.TargetColumn.Bounds; headerRect.left += HorizontalOffset - scrollH; headerRect.top += VerticalOffset - scrollH; int left = headerRect.left; //复选框 if (m_checkBoxes) { int cw = m_checkBoxSize.cx; if (mp.x >= left && mp.x <= left + cw) { node.Checked = !node.Checked; return; } left += cw + 10; } //折叠节点 ArrayList <FCTreeNode> childNodes = node.getChildNodes(); if (childNodes != null && childNodes.size() > 0) { int nw = m_nodeSize.cx; if (mp.x >= left && mp.x <= left + nw) { if (node.Expended) { node.collapse(); } else { node.expend(); } update(); return; } } //移动 if (node.AllowDragOut) { m_movingNode = node; } } }
/// <summary> /// 绘制区域转换为区域 /// </summary> /// <param name="pRect">绘制区域</param> /// <returns>区域</returns> public FCRect convertPRectToBounds(FCRect pRect) { FCRect bounds = pRect; int nSize = 3; bounds.left -= nSize; bounds.top -= nSize; bounds.right += nSize; bounds.bottom += nSize; return(bounds); }
/// <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); } }