OilImage.Top:= (fBottom - nInt);
在timer中定时运算
fBottom ,nInt的值都是对的结果只在第一次时是对的
以后都是错的晕死了

解决方案 »

  1.   

    看看你后面的代码fBottom nInt得值变没有还是fBottom nInt和OILIMAGE 有关。
      

  2.   

    根据fBottom - nInt算出来的值是对了(我算的)
    但赋给OilImage.Top的操作好像没用吗
      

  3.   

    fBottom:= Panel3.Top + Panel3.Height;
             OutPutDebugString(PChar('Panel3.Bottom:  '+IntToStr(panel3.Top + Panel3.Height)+#13#10));
             Case i of               //FloatToStr(FigureValue);
               1:begin
                   ValEdit1.Text:= Format(strFormatDecnum[i],[FigureValue]);
                   Label38.Caption:= ValEdit1.Text+'m';
                   OutputDebugString(Pchar('油高:  '+Label38.Caption+#13#10));
                   nValue:=ABS(FigureValue);
                   if nHeigh > 0.000001 then
                     nInt:=Round(nValue*panel3.Height/nHeigh)
                   else
                     nInt:= 0;              { if nInt<=0 then
                   begin
                     OilImage.Visible:=False;
                     Label38.Visible:=False;
                     OilEdit.Visible:=False;
                   end
                   else begin
                     OilImage.Visible:=True;
                     Label38.Visible:=True;
                     OilEdit.Visible:=True; }
                   if nInt = 0 then
                     OilImage.Height:= fBottom
                   else
                     OilImage.Height:=nInt;               OilImage.Top:= 0;
                   inta:= (380 - 75);
                   OilImage.Top:= 305;
                   OilEdit.Top:=OilImage.Top;
                   OutPutDebugString(PChar('OilImage.Top:  '+IntToStr(OilImage.Top)+#13#10));
                   Label38.Top:=OilEdit.Top-9;
                   //end;
                 end;
               2:begin
                   ValEdit2.Text:=Format(strFormatDecnum[i],[FigureValue]);
                   Label39.Caption:=Format(strFormatDecnum[i],[FigureValue])+'m';
                   OutputDebugString(Pchar('水高:  '+Label39.Caption+#13#10));
                   nValue:=ABS(FigureValue);
                   if nHeigh > 0.000001 then
                     nInt:=Round(nValue*panel3.Height/nHeigh)
                   else
                     nInt:= 0;              { outPutDebugString(PChar(''));               if nInt<=0 then
                   begin
                     WaterImage.Visible:=False;
                     Label39.Visible:=False;
                     WaterEdit.Visible:=False;
                   end
                   else begin
                     WaterImage.Visible:=True;
                     Label39.Visible:=True;
                     WaterEdit.Visible:=True; }
                   OutPutDebugString(PChar('nInt:  '+IntToStr(nInt)+#13#10));
                   if nInt = 0 then
                     WaterImage.Height:= fBottom
                   else
                     WaterImage.Height:=nInt;               WaterImage.Top:= 0;
                   inta:= 380 - 1;
                   WaterImage.Top:= 379;
                   OutPutDebugString(PChar('WaterImage.Top:  '+IntToStr(WaterImage.Top)+#13#10));
                   WaterEdit.Top:=WaterImage.Top;
                   Label39.Top:=WaterEdit.Top + 9;
                  // end;
                 end;
      

  4.   

    thank u all the same 
    我先回去了
    明天再说了
    谢谢了
    ;{}
      

  5.   

    我觉得你这段代码有点问题:
                  if nInt<=0 then
                   begin
                     OilImage.Visible:=False;
                     Label38.Visible:=False;
                     OilEdit.Visible:=False;
                   end
                   else 
                   begin
                     OilImage.Visible:=True;
                     Label38.Visible:=True;
                     OilEdit.Visible:=True; 
                   if nInt = 0 then
                     OilImage.Height:= fBottom
                   else
                     OilImage.Height:=nInt;               OilImage.Top:= 0;
                   inta:= (380 - 75);
                   OilImage.Top:= 305;
    如果是你说的复制没起作用的话,好像就这段的问题。
      

  6.   

    too long,我以copy下来了,看了在说