/// <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 onPaintBackground(FCPaint paint, FCRect clipRect) { int width = Width; int height = Height; FCRect rect = new FCRect(0, 0, width, height); long backColor = FCDraw.FCCOLORS_WINDOWBACKCOLOR; long textColor = FCDraw.FCCOLORS_WINDOWTEXTCOLOR; if (paint.supportTransparent()) { backColor = FCDraw.FCCOLORS_WINDOWBACKCOLOR2; } long borderColor = FCDraw.FCCOLORS_BACKCOLOR8; FCPoint[] points1 = new FCPoint[6]; int dw1 = 30; int dw2 = 50; int dSize = 10; int dSize2 = 20; points1[0] = new FCPoint(dSize, dw1 + dSize); points1[1] = new FCPoint(dSize + dw1, dSize); points1[2] = new FCPoint(width - dSize, dSize); points1[3] = new FCPoint(width - dSize, height - dw2 - dSize2); points1[4] = new FCPoint(width - dSize - dw2, height - dSize2); points1[5] = new FCPoint(dSize, height - dSize2); if (FCDraw.m_style == 0) { paint.fillGradientPolygon(FCDraw.FCCOLORS_BACKCOLOR, FCDraw.FCCOLORS_BACKCOLOR2, points1, 45); } paint.fillPolygon(backColor, points1); paint.drawPolygon(borderColor, 3, 0, points1); paint.drawLine(borderColor, 2, 0, width - dSize - 30, 1, width - 1, 1); paint.drawLine(borderColor, 2, 0, width - 1, 1, width - 1, dSize * 2); paint.drawLine(borderColor, 2, 0, width - dSize - 20, dSize + 5, width - dSize - 5, dSize + 5); paint.drawLine(borderColor, 2, 0, width - dSize - 5, dSize + 5, width - dSize - 5, dSize + 20); FCPoint[] points2 = new FCPoint[4]; points2[0] = new FCPoint(dSize + 10, dSize + dw1 + 30); points2[1] = new FCPoint(dSize + 10, dSize + dw1 + 2); points2[2] = new FCPoint(dSize + dw1 + 2, dSize + 10); points2[3] = new FCPoint(dSize + dw1 + 30, dSize + 10); paint.drawPolyline(borderColor, 2, 0, points2); paint.drawLine(borderColor, 2, 0, dSize + dw1 + 31, dSize + 10, dSize + dw1 + 50, dSize + 10); paint.drawLine(borderColor, 2, 0, dSize + dw1 + 10, dSize + 18, dSize + dw1 + 40, dSize + 18); paint.drawLine(borderColor, 2, 0, dSize + 10, height - dSize * 2 - 8, dSize + 60, height - dSize * 2 - 8); FCPoint[] points3 = new FCPoint[4]; points3[0] = new FCPoint(dSize + 14, height - dSize2 - 8); points3[1] = new FCPoint(dSize + 18, height - dSize2 - 12); points3[2] = new FCPoint(dSize + 30, height - dSize2 - 12); points3[3] = new FCPoint(dSize + 34, height - dSize2 - 8); paint.fillPolygon(borderColor, points3); FCPoint[] points4 = new FCPoint[6]; points4[0] = new FCPoint(dSize, height - dSize2 - 20); points4[1] = new FCPoint(dSize - 8, height - dSize2 - 10); points4[2] = new FCPoint(dSize - 8, height - 4 - dSize); points4[3] = new FCPoint(dSize + 16, height - 4 - dSize); points4[4] = new FCPoint(dSize + 20, height - dSize2); points4[5] = new FCPoint(dSize, height - dSize2); paint.fillPolygon(borderColor, points4); FCPoint[] points5 = new FCPoint[4]; points5[0] = new FCPoint(width - dSize, height - dSize2 - dw2 - 20); points5[1] = new FCPoint(width - dSize - 4, height - dSize2 - dw2 - 16); points5[2] = new FCPoint(width - dSize - 4, height - dSize2 - dw2); points5[3] = new FCPoint(width - dSize, height - dSize2 - dw2); paint.fillPolygon(borderColor, points5); FCPoint[] points6 = new FCPoint[4]; points6[0] = new FCPoint(width - dSize, height - dSize2 - dw2); points6[1] = new FCPoint(width - dSize - 4, height - dSize2 - dw2 - 2); points6[2] = new FCPoint(width - dSize - 22, height - dSize2 - dw2 + 16); points6[3] = new FCPoint(width - dSize - 20, height - dSize2 - dw2 + 22); paint.fillPolygon(borderColor, points6); FCPoint[] points7 = new FCPoint[3]; points7[0] = new FCPoint(width - 1, height - dSize2 - dw2 - 30); points7[1] = new FCPoint(width - 1, height - dSize2 - dw2 + 3); points7[2] = new FCPoint(width - 1 - dw2 + 20, height - dSize2 - 16); paint.drawPolyline(borderColor, 2, 0, points7); FCPoint[] points8 = new FCPoint[3]; points8[0] = new FCPoint(width - 1 - dw2 + 19, height - dSize2 - 15); points8[1] = new FCPoint(width - dSize - dw2 + 1, height - dSize + 3); points8[2] = new FCPoint(width - dSize - dw2 - 25, height - dSize + 3); paint.drawPolyline(borderColor, 2, 0, points8); FCPoint[] points9 = new FCPoint[6]; points9[0] = new FCPoint(width - dSize - dw2 + 1, height - dSize + 3); points9[1] = new FCPoint(width - dSize - dw2 - 14, height - dSize + 3); points9[2] = new FCPoint(width - dSize - dw2 - 10, height - dSize + 8); points9[3] = new FCPoint(width - dSize - dw2 + 3, height - dSize + 8); points9[4] = new FCPoint(width - dSize - dw2 + 16, height - dSize - 6); points9[5] = new FCPoint(width - dSize - dw2 + 16, height - dSize - 14); paint.fillPolygon(borderColor, points9); int rwidth = width * 3 / 5; if (rwidth > width - dSize * 2 - dw2) { rwidth = width - dSize2 * 2 - dw2; } FCPoint[] points10 = new FCPoint[4]; points10[0] = new FCPoint(rwidth - 8, height - dSize2 - 6); points10[1] = new FCPoint(rwidth - 12, height - dSize2); points10[2] = new FCPoint(rwidth + 12, height - dSize2); points10[3] = new FCPoint(rwidth + 8, height - dSize2 - 6); paint.fillPolygon(borderColor, points10); rwidth = width * 7 / 10; if (rwidth > width - 30) { rwidth = width - 30; } FCPoint[] points11 = new FCPoint[4]; points11[0] = new FCPoint(rwidth - 16, dSize - 6); points11[1] = new FCPoint(rwidth - 20, dSize); points11[2] = new FCPoint(rwidth + 20, dSize); points11[3] = new FCPoint(rwidth + 16, dSize - 6); paint.fillPolygon(borderColor, points11); FCDraw.drawText(paint, Text, textColor, Font, 100, 15); }
/// <summary> /// 重绘前景方法 /// </summary> /// <param name="paint">绘图对象</param> /// <param name="clipRect">裁剪区域</param> public override void onPaintBackground(FCPaint paint, FCRect clipRect) { int width = Width; int height = Height; FCRect rect = new FCRect(0, 0, width, height); long backColor = FCDraw.FCCOLORS_WINDOWBACKCOLOR; long foreColor = FCColor.argb(255, 255, 255); if (paint.supportTransparent()) { backColor = FCDraw.FCCOLORS_WINDOWBACKCOLOR2; } long borderColor = FCColor.argb(50, 105, 217); if (m_tick >= 200) { borderColor = FCColor.argb(255 - (m_tick - 200) * 2, 50, 105, 217); foreColor = FCColor.argb(255 - (m_tick - 200) * 2, 255, 255, 255); } int dw1 = 30; int dw2 = 50; int dSize = 10; int dSize2 = 20; if (m_tick >= 200) { dw1 += (m_tick - 200) / 6; dw2 += (m_tick - 200) / 6; dSize += (m_tick - 200) / 6; dSize2 += (m_tick - 200) / 6; } FCPoint[] points1 = new FCPoint[6]; points1[0] = new FCPoint(dSize, dw1 + dSize); points1[1] = new FCPoint(dSize + dw1, dSize); points1[2] = new FCPoint(width - dSize, dSize); points1[3] = new FCPoint(width - dSize, height - dw2 - dSize2); points1[4] = new FCPoint(width - dSize - dw2, height - dSize2); points1[5] = new FCPoint(dSize, height - dSize2); paint.fillGradientPolygon(FCColor.argb(255, 9, 30, 42), FCColor.argb(200, 9, 30, 42), points1, m_tick); //paint.fillPolygon(backColor, points1); paint.drawPolygon(borderColor, 3, 0, points1); paint.drawLine(borderColor, 2, 0, width - dSize - 30, 1, width - 1, 1); paint.drawLine(borderColor, 2, 0, width - 1, 1, width - 1, dSize * 2); paint.drawLine(borderColor, 2, 0, width - dSize - 20, dSize + 5, width - dSize - 5, dSize + 5); paint.drawLine(borderColor, 2, 0, width - dSize - 5, dSize + 5, width - dSize - 5, dSize + 20); FCPoint[] points2 = new FCPoint[4]; points2[0] = new FCPoint(dSize + 10, dSize + dw1 + 30); points2[1] = new FCPoint(dSize + 10, dSize + dw1 + 2); points2[2] = new FCPoint(dSize + dw1 + 2, dSize + 10); points2[3] = new FCPoint(dSize + dw1 + 30, dSize + 10); paint.drawPolyline(borderColor, 2, 0, points2); paint.drawLine(borderColor, 2, 0, dSize + dw1 + 31, dSize + 10, dSize + dw1 + 50, dSize + 10); paint.drawLine(borderColor, 2, 0, dSize + dw1 + 10, dSize + 18, dSize + dw1 + 40, dSize + 18); paint.drawLine(borderColor, 2, 0, dSize + 10, height - dSize * 2 - 8, dSize + 60, height - dSize * 2 - 8); FCPoint[] points3 = new FCPoint[4]; points3[0] = new FCPoint(dSize + 14, height - dSize2 - 8); points3[1] = new FCPoint(dSize + 18, height - dSize2 - 12); points3[2] = new FCPoint(dSize + 30, height - dSize2 - 12); points3[3] = new FCPoint(dSize + 34, height - dSize2 - 8); paint.fillPolygon(borderColor, points3); FCPoint[] points4 = new FCPoint[6]; points4[0] = new FCPoint(dSize, height - dSize2 - 20); points4[1] = new FCPoint(dSize - 8, height - dSize2 - 10); points4[2] = new FCPoint(dSize - 8, height - 4 - dSize); points4[3] = new FCPoint(dSize + 16, height - 4 - dSize); points4[4] = new FCPoint(dSize + 20, height - dSize2); points4[5] = new FCPoint(dSize, height - dSize2); paint.fillPolygon(borderColor, points4); FCPoint[] points5 = new FCPoint[4]; points5[0] = new FCPoint(width - dSize, height - dSize2 - dw2 - 20); points5[1] = new FCPoint(width - dSize - 4, height - dSize2 - dw2 - 16); points5[2] = new FCPoint(width - dSize - 4, height - dSize2 - dw2); points5[3] = new FCPoint(width - dSize, height - dSize2 - dw2); paint.fillPolygon(borderColor, points5); FCPoint[] points6 = new FCPoint[4]; points6[0] = new FCPoint(width - dSize, height - dSize2 - dw2); points6[1] = new FCPoint(width - dSize - 4, height - dSize2 - dw2 - 2); points6[2] = new FCPoint(width - dSize - 22, height - dSize2 - dw2 + 16); points6[3] = new FCPoint(width - dSize - 20, height - dSize2 - dw2 + 22); paint.fillPolygon(borderColor, points6); FCPoint[] points7 = new FCPoint[3]; points7[0] = new FCPoint(width - 1, height - dSize2 - dw2 - 30); points7[1] = new FCPoint(width - 1, height - dSize2 - dw2 + 3); points7[2] = new FCPoint(width - 1 - dw2 + 20, height - dSize2 - 16); paint.drawPolyline(borderColor, 2, 0, points7); FCPoint[] points8 = new FCPoint[3]; points8[0] = new FCPoint(width - 1 - dw2 + 19, height - dSize2 - 15); points8[1] = new FCPoint(width - dSize - dw2 + 1, height - dSize + 3); points8[2] = new FCPoint(width - dSize - dw2 - 25, height - dSize + 3); paint.drawPolyline(borderColor, 2, 0, points8); FCPoint[] points9 = new FCPoint[6]; points9[0] = new FCPoint(width - dSize - dw2 + 1, height - dSize + 3); points9[1] = new FCPoint(width - dSize - dw2 - 14, height - dSize + 3); points9[2] = new FCPoint(width - dSize - dw2 - 10, height - dSize + 8); points9[3] = new FCPoint(width - dSize - dw2 + 3, height - dSize + 8); points9[4] = new FCPoint(width - dSize - dw2 + 16, height - dSize - 6); points9[5] = new FCPoint(width - dSize - dw2 + 16, height - dSize - 14); paint.fillPolygon(borderColor, points9); int rwidth = width * 3 / 5; if (rwidth > width - dSize * 2 - dw2) { rwidth = width - dSize2 * 2 - dw2; } FCPoint[] points10 = new FCPoint[4]; points10[0] = new FCPoint(rwidth - 8, height - dSize2 - 6); points10[1] = new FCPoint(rwidth - 12, height - dSize2); points10[2] = new FCPoint(rwidth + 12, height - dSize2); points10[3] = new FCPoint(rwidth + 8, height - dSize2 - 6); paint.fillPolygon(borderColor, points10); rwidth = width * 7 / 10; if (rwidth > width - 30) { rwidth = width - 30; } FCPoint[] points11 = new FCPoint[4]; points11[0] = new FCPoint(rwidth - 16, dSize - 6); points11[1] = new FCPoint(rwidth - 20, dSize); points11[2] = new FCPoint(rwidth + 20, dSize); points11[3] = new FCPoint(rwidth + 16, dSize - 6); paint.fillPolygon(borderColor, points11); FCDraw.drawText(paint, Text, foreColor, Font, 100, 15); if (m_tick > 200) { int count = (m_tick - 200) / 8 + 1; int left = 80; for (int i = 0; i < count; i++) { FCRect pRect = new FCRect(left, height - 10, left + 8, height - 6); paint.fillRect(borderColor, pRect); left += 10; } left = 15; int top = 80; count = (m_tick - 200) / 10 + 1; for (int i = 0; i < count; i++) { FCRect pRect = new FCRect(left, top, left + 8, top + 6); paint.fillRect(borderColor, pRect); top += 10; } } }