Re: [討論] Matlab GUI自動換Pan的寫法

看板MATLAB作者 (郝渴連)時間11年前 (2013/11/07 18:43), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串2/3 (看更多)
※ 引述《InoueToro (InoueToro)》之銘言: : 請問板友高手 : 如果要讓鼠標移動進入一繪圖區時, 就自動切換成pan工具, : 而移出該繪圖區時, 就換回原本的箭頭, : 這樣的事件可以在matlab實現嗎? : 謝謝! : : -- : ※ 發信站: 批踢踢實業坊(ptt.cc) : ◆ From: 59.125.200.66 : → jatj:可以 google mouseoverfcn 11/07 08:20 to jatj大: mouseoverfcn是啥啊??? 我在matlab的help中都找不到耶! to 原PO: 您可以用以下的程式來修改 step 1 產生出一張圖 hFig = figure; step 2 建立滑鼠移動時要呼叫的函數 move = @(x, y) disp(get(x, 'CurrentPoint')); step 3 把滑鼠移動要呼叫的函數指定給一開始產生的圖 set(hFig, 'WindowButtonMotionFcn', move); 此時您的滑鼠在圖上移動時, command window 就會把滑鼠的位置顯示出來。 總結: figure 內有兩個參數, 您可以用 inspect(hFig) 來觀察, 一個是 CurrentPoint 一個是 WindowButtonMotionFcn, CurrentPoint 會自己更新我們動不了他, WindowButtonMotionFcn是滑鼠在移動的時候 matlab 會自己呼叫他。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 111.67.50.208

11/08 00:40, , 1F
sorry, it's windowbuttonmotionfcn 就像你說的一樣
11/08 00:40, 1F
文章代碼(AID): #1IUsxKkr (MATLAB)
文章代碼(AID): #1IUsxKkr (MATLAB)