在另一个内绘制一个sahpe并选择它. [英] Drawing one sahpe within another and selecting it.

查看:81
本文介绍了在另一个内绘制一个sahpe并选择它.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想使用MFC在屏幕上绘制另一种形状(例如矩形)内的一种形状(例如圆形).当我单击位于圆上的坐标时,圆被选中.与MS-Excel Shapes中发生的情况相同.

请尝试帮助我,但没有结果.

在此先感谢您.

解决方案

在本文中检查功能圈子 解决方案

Check the Function InCircle in this article VARIANT_BOOL CMyAxUICtrl::InCircle(CPoint& point); from which you can get information on how to determine whether a point lies in the circle or not.Call this function on OnLButtonDown(CPoint) event.


it depends upon your selection logic. what type of selection logic are you using ? selection on clicking boundary ? or will it select clicking inside of the shape too ?


Another option is to use a mouse picking technique borrowed from an OpenGL style.

In a off screen buffer, draw your shapes in solid colors with solid fills. You''ll want to make sure that antialising is turned off.

Each color gets mapped to an object.

Then when the user clicks on the screen, look up that (x, y) coordinate in your buffer to get the color. look up the color to see what object was selected.

You will need to take care to draw your objects back to front.

You may want to draw lines with a thicker pen, so that they are easier to select.


这篇关于在另一个内绘制一个sahpe并选择它.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆