using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Drawing.Drawing2D;
|
using System.Drawing;
|
|
namespace TProduct.PumpGraph.Picture
|
{
|
public partial class ZlpFeatChart1 : ZlpFeatChart
|
{
|
public override Image CreateImage(int imageWidth, int imageHeight )
|
{
|
this._imageTotalWidth = imageWidth;
|
this._imageTotalHeight = imageHeight;
|
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(imageWidth, imageHeight);
|
_graphics = Graphics.FromImage(bitmap);//句柄
|
_graphics.Clear(BackgroundColor); //绘制背景色
|
|
//计算面板位置和尺寸
|
CalcDiagramSize(50, 100, 80, 50);
|
|
|
DrawAxisX();
|
|
DrawAxisY();
|
|
DrawAllCurves();
|
|
DrawSpecConstantLineH();
|
|
//水印
|
DrawWaterMark( );
|
|
_graphics.Dispose();
|
|
return bitmap;
|
}
|
|
protected override void CalcDiagramSize(int space_top = 20, int space_left = 100, int space_bottom = 60, int space_right = 100)
|
{
|
base.CalcDiagramSize(space_top, space_left, space_bottom, space_right);
|
|
using (SolidBrush brush = new SolidBrush(Color.FromArgb(75, Color.WhiteSmoke)))
|
{
|
_diagram_Cell_Height = _chartDiagram.Height / (_coordinateParas.AxisLabelH.Count-1);
|
var space_heigh = _diagram_Cell_Height;
|
var space_width = _chartDiagram.Width / (_coordinateParas.AxisLabelQ.Count - 1);
|
|
for (int x = 0; x < _coordinateParas.AxisLabelQ.Count-1; x = x + 1)
|
{
|
for (int y = x % 2; y < _coordinateParas.AxisLabelH.Count-1; y = y + 2)
|
{
|
var rect = new RectangleF(_chartDiagram.Left + space_width * x, _chartDiagram.Top + space_heigh * y, space_width, space_heigh);
|
|
System.Drawing.Region region = new Region(rect);
|
_graphics.FillRegion(brush, region);
|
}
|
}
|
}
|
}
|
}
|
}
|