昨天的,希望今天还可以。
procedure myinitialize_image(image_rain:timage;max:integer);stdcall;
var
j:integer;
arrow:array[0..2] of tpoint;
bitline:array[0..1] of tpoint;
unit_x,unit_y:double;
begin
with image_rain do
begin
//画纵横坐标
canvas.MoveTo(18,15);
canvas.LineTo(18,height-15);
canvas.LineTo(width-15,height-15);
//画纵横箭头,箭头高为8个像素,宽为10个像素
canvas.Brush.Color:=clgreen;
arrow[0]:=point(13,15);
arrow[1]:=point(23,15);
arrow[2]:=point(18,5);
canvas.Polygon(arrow);
arrow[0]:=point(width-15,height-20);
arrow[1]:=point(width-15,height-10);
arrow[2]:=point(width-5,height-15);
canvas.Polygon(arrow);
canvas.Brush.Color:=clwhite;
//为横坐标注释,24小时*13=312;
//横坐标单位长度为unit_x。
unit_x:=(width-40)/24;
canvas.TextOut(10,height-14,'8:00');
canvas.TextOut(10+trunc(4*unit_x),height-14,'12:00');
bitline[0]:=point(18+trunc(4*unit_x),height-15);
bitline[1]:=point(18+trunc(4*unit_x),height-18);
canvas.Polygon(bitline);
canvas.TextOut(10+trunc(8*unit_x),height-14,'16:00');
bitline[0]:=point(18+trunc(8*unit_x),height-15);
bitline[1]:=point(18+trunc(8*unit_x),height-18);
canvas.Polygon(bitline);
canvas.TextOut(10+trunc(12*unit_x),height-14,'20:00');
bitline[0]:=point(18+trunc(12*unit_x),height-15);
bitline[1]:=point(18+trunc(12*unit_x),height-18);
canvas.Polygon(bitline);
canvas.TextOut(10+trunc(16*unit_x),height-14,'00:00');
bitline[0]:=point(18+trunc(16*unit_x),height-15);
bitline[1]:=point(18+trunc(16*unit_x),height-18);
canvas.Polygon(bitline);
canvas.TextOut(10+trunc(20*unit_x),height-14,'4:00');
bitline[0]:=point(18+trunc(20*unit_x),height-15);
bitline[1]:=point(18+trunc(20*unit_x),height-18);
canvas.Polygon(bitline);
canvas.TextOut(10+trunc(24*unit_x),height-14,'8:00');
bitline[0]:=point(18+trunc(24*unit_x),height-15);
bitline[1]:=point(18+trunc(24*unit_x),height-18);
canvas.Polygon(bitline);
//为纵坐标注释。雨量最大值:330.1mm
//纵坐标单位长度为unit_y。
unit_y:=(height-40)/max;//strtoint(trim(f_rainstat.cbbx_ymax.text));
for j:=1 to round(max/20) do //strtoint(trim(f_rainstat.cbbx_ymax.text))/20) do
begin
canvas.TextOut(0,height-trunc(unit_y*20*j)-20,inttostr(20*j));
bitline[0]:=point(18,height-trunc(20*j*unit_y)-15);
bitline[1]:=point(21,height-trunc(20*j*unit_y)-15);
canvas.Polygon(bitline);
end;
end;
end;