Re: [問題] 請問要怎麼樣讓按鈕會移動

看板C_and_CPP (C/C++)作者 (楓霧)時間16年前 (2009/08/22 23:28), 編輯推噓2(200)
留言2則, 2人參與, 最新討論串2/3 (看更多)
這個有二種解決方法 我講簡單這個,另一個是用DragDrop和DragOver Button是動態產生也可以用 程式碼 void __fastcall TForm1::Button1MouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { int WIDTH = ((TButton*)Sender)->Width; int HEIGHT = ((TButton*)Sender)->Height; ((TButton*)Sender)->Left = ((TButton*)Sender)->Left+X-WIDTH/2; ((TButton*)Sender)->Top = ((TButton*)Sender)->Top+Y-HEIGHT/2; } 試試看吧 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.118.207.32 ※ 編輯: maplefog 來自: 140.118.207.32 (08/22 23:30) ※ 編輯: maplefog 來自: 140.118.207.32 (08/22 23:32)

08/23 00:08, , 1F
請問TButton* 以及Sender是什麼東西呢?
08/23 00:08, 1F

08/23 07:26, , 2F
Sender就是那個按鈕 TButton*是該按鈕的Class 這邊用來轉型
08/23 07:26, 2F
文章代碼(AID): #1Aa0wpTL (C_and_CPP)
文章代碼(AID): #1Aa0wpTL (C_and_CPP)