OnLButtonDown中点击一系列点,将这些点的坐标保存在一个点数组中,如何实现?

badbombaby 2008-12-30 03:27:57
如题
...全文
121 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
nickyoo 2009-01-08
  • 打赏
  • 举报
回复
关注!!!
badbombaby 2009-01-08
  • 打赏
  • 举报
回复
楼上的朋友,谢谢你的帮助,但是好像还解决不了,记录的点没数据
太乙 2009-01-07
  • 打赏
  • 举报
回复


在CTtView的类定义里面,定义一个成员数组:

CPoint cp[100];


void CTtView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
static int i = 0;
if (i < 100)
{
cp[i++] = point;
}

CView::OnLButtonDown(nFlags, point);
}



太乙 2009-01-07
  • 打赏
  • 举报
回复

myProjectName:Tt
重载CTtView的WM_LBUTTONDOWN消息



void CTtView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default

CView::OnLButtonDown(nFlags, point);
}



太乙 2009-01-07
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 badbombaby 的回复:]
楼上说的不是我想要的,我想要在客户区用鼠标左键点击一系列点,这些点的坐标信息用一个CPoint数组来记录起来
[/Quote]

很简单啊

CWnd::OnLButtonDown
afx_msg void OnLButtonDown( UINT nFlags, CPoint point );

Parameters

nFlags

Indicates whether various virtual keys are down. This parameter can be any combination of the following values:

MK_CONTROL Set if the CTRL key is down.


MK_LBUTTON Set if the left mouse button is down.


MK_MBUTTON Set if the middle mouse button is down.


MK_RBUTTON Set if the right mouse button is down.


MK_SHIFT Set if the SHIFT key is down.
point

Specifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window.

badbombaby 2009-01-07
  • 打赏
  • 举报
回复
楼上说的不是我想要的,我想要在客户区用鼠标左键点击一系列点,这些点的坐标信息用一个CPoint数组来记录起来
hityct1 2009-01-06
  • 打赏
  • 举报
回复
vector<CPoint> array;
array.push_back(point);
badbombaby 2009-01-04
  • 打赏
  • 举报
回复
我也知道第二个参数就是点击位置,问题是如何把这些点保存起来呢?
hityct1 2009-01-01
  • 打赏
  • 举报
回复
没看懂。保存一下就行了。
ltc_mouse 2009-01-01
  • 打赏
  • 举报
回复
afx_msg void OnLButtonDown(
UINT nFlags,
CPoint point
);

第二个参数就是鼠标点击的坐标位置~
sincor 2009-01-01
  • 打赏
  • 举报
回复
没看懂。

64,651

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧