liushuangq05 发表于 2011-8-30 13:05:52

鼠标轨迹框的显示问题(求助)

我想在鼠标拉动的过程中,其框选的范围的边界能实时显示出来,不知道调用哪些参数?
例如在toolbar里面的zoom in,选上后(见图中的灰色边框),在原图圈划个范围,这个范围就将扩大成原图片大.我想把圈划的范围实时显示,没找到它里面的具体方法.
waitforbuttonpress用的不是太好,而且没修饰方法.

qibbxxt 发表于 2011-8-30 14:28:22

本帖最后由 qibbxxt 于 2011-8-30 14:32 编辑

doc dragrectdoc rbbox这两个函数中有例子,尤其是后者,估计是你要的效果吧k = waitforbuttonpress;
point1 = get(gca,'CurrentPoint');    % button down detected
finalRect = rbbox;                   % return figure units
point2 = get(gca,'CurrentPoint');    % button up detected
point1 = point1(1,1:2);            % extract x and y
point2 = point2(1,1:2);
p1 = min(point1,point2);             % calculate locati**
offset = abs(point1-point2);         % and dimensi**
x = ;
y = ;
hold on
axis manual
plot(x,y)

liushuangq05 发表于 2011-8-30 16:21:15

本帖最后由 liushuangq05 于 2011-8-30 16:22 编辑

谢谢斑竹。不过我想要的是,waitforbuttonpress执行过程中,矩形框就在实时显示的方式。上面的那个程序是在鼠标松开后,才完成的。
toolbar里面的放大镜功能,就是在拖拉鼠标进行显示局部图片的过程中,就出来了的矩形指示框。
页: [1]
查看完整版本: 鼠标轨迹框的显示问题(求助)