当前位置:主页>销售管理软件> 列表

在一幅图上画等距离网格,当图像放大或者缩小时结果就不对了, 找酒店管理软件

仓库管理软件版1楼: 一幅图,要实现图像缩放,同时又在上面画等距离网格。
编好了,但是当图像缩放时网格就不对了,图像原始大小
时是可以的,怎么办啊?高手给个原程序吧。
谢谢。

2楼: 是一些线条消失了吗 ? 可以 作一下反锯齿处理 如酒店管理软件

3楼: 并不是一些线条消失了,而是完全不对了。
我单步执行过了,看到每一点moveto和lineto的都对,但是画出来
的就是错,好诡异的呀。
哎不知道怎么搞了。
我的函数如下,当我先选择图像缩小后在执行下面函数操作时就
画图就不对了,如果图像没有缩放时是可以的
procedure ShowLonLat1(var mLonLat : boolean;Viewimage1:TImage);
var
i,j,x_s,y_s:integer;
begin
ViewImage1.Stretch :=true;

if mLonLat then
with ViewImage1 do begin
begin
begin
Canvas.Pen.Color:= clYellow;
for i:=1 to 7 do
begin
x_s:=round((i*ViewImage1.Width)/8);
Canvas.MoveTo(x_s,0);
y_s:= round(ViewImage1.Height);
Canvas.lineTo(x_s,y_s);

end;

for j:=1 to 5 do
begin
y_s:=round((j*ViewImage1.height)/6);
Canvas.MoveTo(0 ,y_s);
x_s:= round(ViewImage1.width);
Canvas.lineTo(x_s,y_s);
end;

end;
end;
end
else
exit;
end;

4楼: ViewImage1.Width 改为 ViewImage1.picture.Width 试试
Height也是

5楼: 试过的,也是的。

还有什么叫反锯齿处理啊?有源程序否?谢谢。

6楼: 反锯齿将斜线出现的锯齿平滑化,算法也有多种,不过好像在这里用处不大

可以不用ViewImage1.Stretch :=true; 在Image Resize的时候重新画,我刚试过,没有问题了

仓库管理软件版7楼: 嗯 你把相关的程序贴给我瞅瞅吧,我试了还是不行呢,谢谢。

8楼: procedure ShowLonLat1(var mLonLat : boolean;Viewimage1:TImage);
var
i,j,x_s,y_s:integer;
begin
if mLonLat then
with ViewImage1 do begin
Canvas.Pen.Color:= clYellow;
for i:=1 to 7 do
begin
x_s:=round((i*ViewImage1.Width)/8);
Canvas.MoveTo(x_s,0);
y_s:= round(ViewImage1.Height);


Canvas.lineTo(x_s,y_s);
end;
for j:=1 to 5 do
begin
y_s:=round((j*ViewImage1.Height)/6);
Canvas.MoveTo(0 ,y_s);
x_s:= round(ViewImage1.Width);
Canvas.lineTo(x_s,y_s);
end;
end
else
exit;
end;

procedure TForm1.FormResize(Sender: TObject);
var
b: Boolean;
begin
b := True;
with Image1 do begin
Picture.Bitmap.Width := Width;
Picture.Bitmap.Height := Height;
Canvas.FillRect(Canvas.ClipRect);
end;
ShowLonLat1(b, Image1);
end;

如果觉得太闪,就加上
procedure TForm1.FormCreate(Sender: TObject);
begin
DoubleBuffered := True;
end;

9楼: 谢谢 虽然你说的方法还是不适合于我这边的程序。也不是我想要的效果