Angel_Zhl 2016-04-20 11:24 采纳率: 33.3%
浏览 1636
已采纳

Delphi实现图片滚动切换的代码中move函数报错说variable required?为什么?

procedure TMainForm.startClick(Sender: TObject);
var
W, H, I, J, LineBytes: Integer;
Line: PByteArray; //定义指针类型变量
Bmp: Tbitmap;
R: TRect;
begin
if Image1.Picture.Bitmap.PixelFormat=pfDevice then //当没有打开图片时
begin
MessageDlg ('没有打开图片!', mtInFormation, [mbOk], 0);//给出出错提示
exit; //退出
end
else
fCancel := False;
start.Enabled := False; //改变两个按钮的属性
stop.Enabled := True;
Bmp := Image1.Picture.Bitmap; //获取BMP 图像并定义图像尺寸
W := Bmp.Width;
H := Bmp.Height;
LineBytes := Abs (Integer (Bmp.ScanLine [1]) -Integer (Bmp.ScanLine [0]));
Line := AllocMem (LineBytes);
for I := 0 to H - 1 do
begin
if fCancel then //在每一次循环前均检查中断标志(即确定停止按钮是否按下)
Break; //单击“停止”按钮则停止滚动图像
Move ((Bmp.ScanLine [0]), Line, LineBytes); //复制图像的第一行
for J := 1 to H - 1 do
begin
Move((Bmp.ScanLine [J]),(Bmp.ScanLine [J-1]),LineBytes);
if (J mod nLines = 0) then
begin
R := Rect (0, Panel1.Height + J-nLines,W, Panel1.Height + J);
InvalidateRect (Handle, @R, False);
UpdateWindow (Handle);
end;
end;
Move(Line,(Bmp.ScanLine [Bmp.Height - 1]), LineBytes);
R := Rect (0, Panel1.Height + H - nLines,W, Panel1.Height + H);
InvalidateRect (Handle, @R, False);
UpdateWindow (Handle); Application.ProcessMessages; //允许立即停止循环使程序处于初始状态
end;
start.Enabled := True; //激活“开始”按钮
stop.Enabled := False; // 停止“按钮”失效
end;图片说明

  • 写回答

1条回答

  • threenewbee 2016-04-20 11:44
    关注
     Move ((Bmp.ScanLine [0])^, Line^, LineBytes); //复制图像的第一行
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥15 画两个图 python或R
  • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法
  • ¥15 八路抢答器设计出现故障
  • ¥15 请教一下c语言的代码里有一个地方不懂
  • ¥15 opencv 无法读取视频
  • ¥15 用matlab 实现通信仿真
  • ¥15 按键修改电子时钟,C51单片机
  • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))
  • ¥20 5037端口被adb自己占了