帮我看看代码,当我缩小或者放大图象以后,为什么总是闪烁,怎么能消除闪烁??????(icehill)

icehill 2001-11-22 01:22:16
{--------------------------------Move the picture------------------------------------------}
procedure TForm_3011.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
MouseDown.x:=x;
MouseDown.y:=y;
Capture:=true;
end;
{--------------------------------Move the picture----------------------------------------}
procedure TForm_3011.Image1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
if Capture then
begin
so.HorzScrollBar.Position := so.HorzScrollBar.Position+trunc((X-MouseDown.x)/20);
so.VertScrollBar.Position := so.VertScrollBar.Position+trunc((Y-MouseDown.y)/20);
end;
end;
{-------------------------------Move the picture-----------------------------------------}
procedure TForm_3011.Image1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Capture then
begin
Capture:=false;
so.HorzScrollBar.Position := so.HorzScrollBar.Position+trunc((X-MouseDown.x)/20);
so.VertScrollBar.Position := so.VertScrollBar.Position+trunc((Y-MouseDown.y)/20);
end;
end;

procedure TForm_3011.BitBtn1Click(Sender: TObject);//缩小图象
begin
Image1.AutoSize:=false;
Image1.Stretch:=true;
Image1.Height:=trunc(Image1.Height*2/3);
Image1.Width:=trunc(Image1.Width*2/3);
end;

procedure TForm_3011.BitBtn2Click(Sender: TObject);//放大图象
begin
Image1.AutoSize:=false;
Image1.Stretch:=true;
Image1.Height:=trunc(Image1.Height*3/2);
Image1.Width:=trunc(Image1.Width*3/2);
end;
...全文
225 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
icehill 2001-11-23
  • 打赏
  • 举报
回复
~~~~~~~~~~~~~
cobi 2001-11-22
  • 打赏
  • 举报
回复
如果不行的话,到大富翁上面搜寻以下闪烁吧,我刚才在上面查了以下,有不少的帖子解释了这个问题
ChocoboY 2001-11-22
  • 打赏
  • 举报
回复
你的图是jpg还是bmp位图,
如果是jpg可能要
image.picture.bitmap.assign(JpgImage);
cobi 2001-11-22
  • 打赏
  • 举报
回复
重点关注
icehill 2001-11-22
  • 打赏
  • 举报
回复
我觉得这里肯定有蹊跷~~
我把图片缩小,然后放大到原来的大小,也不能象原来那样平滑的拖动,问题到底出在哪里
yuso 2001-11-22
  • 打赏
  • 举报
回复
我開始和你一樣﹐這是因為ScrollBox造成的﹐把它換成panel就行了﹐沒有滾動條﹐可以直接用鼠標拖動圖像﹐就象ADSEE一樣。
wisenowa 2001-11-22
  • 打赏
  • 举报
回复
网速问题
发了两边
icehill 2001-11-22
  • 打赏
  • 举报
回复
老大,你确定了吗 ?
wisenowa 2001-11-22
  • 打赏
  • 举报
回复
procedure TForm_3011.BitBtn2Click(Sender: TObject);//放大图象
begin
SendMessage(Image1.Handle,WM_SETREDRAW,0,0);
Image1.AutoSize:=false;
Image1.Stretch:=true;
Image1.Height:=trunc(Image1.Height*3/2);
Image1.Width:=trunc(Image1.Width*3/2);
SendMessage(Image1.Handle,WM_SETREDRAW,-1,0);
end;
wisenowa 2001-11-22
  • 打赏
  • 举报
回复
procedure TForm_3011.BitBtn2Click(Sender: TObject);//放大图象
begin
SendMessage(Image1.Handle,WM_SETREDRAW,0,0);
Image1.AutoSize:=false;
Image1.Stretch:=true;
Image1.Height:=trunc(Image1.Height*3/2);
Image1.Width:=trunc(Image1.Width*3/2);
SendMessage(Image1.Handle,WM_SETREDRAW,-1,0);
end;
icehill 2001-11-22
  • 打赏
  • 举报
回复
在不修改现有控件的基础上有好的解决方法吗????
等待~~~~~~
ChocoboY 2001-11-22
  • 打赏
  • 举报
回复
首先在image底补垫一层panel即把image 放进 panel 里;
再在image上铺一层label;label.align设为alclient;
通过label的mousedown 或mouseup 响应image的mousedown mouseup
你试试看,
icehill 2001-11-22
  • 打赏
  • 举报
回复
我是把image放在ScrollBox里面的,我把ScrollBox的DoubleBuffered属性设置成了true
是不闪烁了,可是我拖动图象的时候象拉粘皮糖
綏子 2001-11-22
  • 打赏
  • 举报
回复
把image的透明属性设为fALSE
綏子 2001-11-22
  • 打赏
  • 举报
回复
你可以把image放到一个Panel上,然后设panel.DoubleBuffered:=True;即可
icehill 2001-11-22
  • 打赏
  • 举报
回复
好像还是老样子啊,还有没有好点的方法???
綏子 2001-11-22
  • 打赏
  • 举报
回复
你把Image的Proportional属性设为True;
也可以把image.DoubleBuffered;属性设为True;是一个不显示的属性,直接在程序里头用
Miracle 2001-11-22
  • 打赏
  • 举报
回复
这个问题我也遇到过,把Form的DoubleBuffered属性设置为true即可

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧