English 中文(简体)
关于静态控制中绘制椭圆( MFC)
原标题:About Draw Ellipse in Static Control ( MFC)

When I doubleclick in Static Control, I will draw ellipse in Static Control in the position of mouse.(MFC); But, It apears that: suprised

我的代码是:

无效的 CTree showLabel:: OnLButtonDblClk (Unt nFlags, Cpoint 点)

{ { {

//______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

COLORREF 黑 = RGB(255,0,0,0);

CPen 笔(PS_SOLID, 1, 黑色);

CCLentDC Dc( GetDlgIot( IDC_ TREESTATIC) ) ; (GetDlgIot( IDC_ TREESTATIC) ) ;

Dc. 选择对象( pen) ;

//在鼠标处画图
CPoint curPos;
GetCursorPos(&curPos);

CPoint point1(0,0);
point1.x = curPos.x - 50;
point1.y = curPos.y - 50;

CPoint point2(0,0);
point2.x = curPos.x + 50;
point2.y = curPos.y + 50;

    //画圆
Dc.Ellipse(CRect(point1, point2));
CStatic::OnLButtonDblClk(nFlags, point);

时 时

环环是可怕的。

最佳回答

在 OnLButtonDblClk 事件抓捕器中绘制椭圆似乎不是一个好主意。 您应该创建您自己的类, 由 CStatic 生成, 并覆盖 OnPaint 方法 。

然后从事件捕捉器中告诉静态,它必须绘制椭圆,以及在哪里(例如两个成员变量:布尔 m_bDraw/Cpoint m_DrawPoint)和在静态中调用无效。

问题回答

暂无回答




相关问题
Problem statically linking MFC libraries

I have a Visual Studio 6 workspace I m trying to convert to a Visual Studio 2008 solution. The output of said solution is a .dll. It has to be a .dll and it needs to statically link MFC as I can t ...

Switching to WPF. Is it time?

I m considering switching from MFC to WPF. My first concern is that there are too many users who don t have .NET with WPF installed yet. Can anybody point to a source containing the WPF penetration ...

Crash within CString

I am observing a crash within my application and the call stack shows below mfc42u!CString::AllocBeforeWrite+5 mfc42u!CString::operator=+22 No idea why this occuring. This does not occur ...

C# for UI, c++ for library

I have a numerical library coded in C++. I am going to make a UI for the library. I know some MFC. So one solution is to use MFC and make a native application. The alternative is C#. I know nothing ...

Search by using the keyboard in a list/grid - algorithm

I need to implement a custom search in a grid and I would like to find some user interface guidelines that explain the standard way to implement it. I mean this kind of search that is initiated by ...

MFC List Control

In MFC, I can edit the text of items in the list control but only for the first column by setting the Edit Labels to true. Now when I click the first column item to change its text, I m able to change ...

热门标签