Help!!關於圖形圖象控制項的重新整理問題

來源:互聯網
上載者:User
Help!!關於圖形圖象控制項的重新整理問題 Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiMultimedia/html/delphi_20061113195857151.html
小人前一個天在做一個交給老師的小圖形映像示範程式時遇到了點問題,表單Form1上面放了一個TPageControl1控制項,並產生了3個TabSheet,分別完成不同的功能,當做第二個Tabsheet2時出了麻煩,該頁的功能是單擊一按鈕時可在表單上劃線段,單擊另一按鈕時要求重新整理表單,使畫的線消失,該頁上我用了控制項Timage1,一個表示畫線開始的TButton1,另一個重新整理按鈕TButton2,但是重新整理功能怎麼也做不出來,但我在一新表單上測試不放pageControl控制項,在表單上劃線時則可以重新整理,部分代碼如下:請賜教!  
  implementation  
  var  
  start:boolean;  
  {$R   *.dfm}  
   
  procedure   TForm1.PageControl1Change(Sender:   TObject);  
  begin  
      if   pagecontrol1.ActivePage=tabsheet2   then  
      start:=false;  
  end;//當從別的頁切換到第二頁時,標誌位為假,非得單擊畫線按鈕才能在表單畫線    
   
  procedure   TForm1.DrawLineClick(Sender:   TObject);  
  begin  
      start:=true;//單擊畫線按鈕,標誌位賦為真,可以在表單上畫線  
  end;  
   
   
  procedure   TForm1.Image1MouseDown(Sender:   TObject;   Button:   TMouseButton;  
      Shift:   TShiftState;   X,   Y:   Integer);  
  begin  
      if   start=true   then  
      image1.Canvas.MoveTo(x,y);  
  end;   //滑鼠按下的時候確定線段的第一個座標  
   
   
  procedure   TForm1.Image1MouseUp(Sender:   TObject;   Button:   TMouseButton;  
      Shift:   TShiftState;   X,   Y:   Integer);  
  begin  
      if   start=true   then  
      image1.canvas.LineTo(x,y);  
  end;//滑鼠放開的時候確定線段的第二個座標,並畫出線段  
   
  {問題就在這裡????}  
  procedure   TForm1.RefreshClick(Sender:   TObject);  
  begin  
  ???{我不懂這裡用image1.refresh或image1.canvas.refresh或form1.refresh都不行}  
  end;//單擊重新整理按鈕,重新整理,該功能不知道咋個實現啊,試了多次,都出不來  
   
  end.

試試image1.Invalidate;

試過了,不行啊,有沒哪位高人曉滴???

是否在image1.refresh或image1.canvas.refresh之前要加"pageControl."來限定?  
  沒有具體試過.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.