Re: [討論] Matlab GUI自動換Pan的寫法
※ 引述《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
11/08 00:40, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 3 篇):