Re: [問題] 請問要怎麼樣讓按鈕會移動
這個有二種解決方法 我講簡單這個,另一個是用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
08/23 00:08, 1F
推
08/23 07:26, , 2F
08/23 07:26, 2F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 2 之 3 篇):
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章