VC获取鼠标坐标 高手请进 高分

来源:百度知道 编辑:UC知道 时间:2024/06/24 11:53:24
我在获取当前鼠标所指屏幕位置的坐标时出现了怪现象,横坐标显示没有问题,纵坐标有问题,当我的鼠标慢慢向上移动时,纵坐标减小(正常),当减小到100时,再向上移动,就变为4位数了,成几千了,真的很不解,我的代码如下:
void CMy_FIRView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CString st;
st.Format(("%d, %d"), point.x, point.y);
CDC *pDC=GetDC();
pDC->TextOut(400,20,st);
ReleaseDC(pDC);
SetCursor(LoadCursor(NULL,IDC_CROSS));

CView::OnMouseMove(nFlags, point);
}
请高手指点,在线等......

MATLAB如何动态显示鼠标的坐标值和图像像素值

对于动态显示鼠标的坐标值和像素值,在其他语言如vc,vb中都比较方便,有直接的着方面的函数,那么在matlab图像处理里面又如何实现呢?
具体的实现方法很多,但归结起来就是获取坐标轴的current point 属性值,我这里给出的一个函数是从mathworks 获取柄稍作修改后的结果,相信对做图像处理的朋友有一定的作用。另一个就是自带的pixval函数。谁有不同的实现方法,请多多共享啊!

function dynpoint(arg,h)
% Show the coordinates of a plot dynamically
%
% To start use:
% dynpoint(h)
% where h is a handle to a figure, axes or e.g. line.
%
% To delete use:
% dynpoint('delete',h)
% where h is a handle to a figure, axes or e.g. line.
% (you may also use: dynpoint delete)
%
% There can only be one dynamic plotter in a figure at a time.
%
% Example:
% subplot(211), hline = plot(sin(1:10))
% subplot(212), plot(sin(1:100))
% dynpoint(hline)

% 2002,6.29

if ~exist('arg','var')
arg = gcf;
end

if ~isstr(arg)
handle = arg;
arg = 'init';