| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1116 人关注过本帖
标题:[求助]两个矩形的相交为外接巨型画椭圆问题
只看楼主 加入收藏
哈狄斯
Rank: 2
等 级:论坛游民
帖 子:45
专家分:16
注 册:2006-3-14
收藏
 问题点数:0 回复次数:4 
[求助]两个矩形的相交为外接巨型画椭圆问题

在视图类声明成员变量

public:
CRect m_rRect1;
cRect m_rRect2;

在构造函数初始化

CRecRecView::CRecRecView():m_rRect1(50,50,250,200),m_rRect2(100,120,300,400)


void CRecRecView::OnDraw(CDC* pDC)
{
CRecRecDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
int x1,y1;
int x2,y2;
if(m_rRect1.left<m_rRect2.left)
x1=m_rRect2.left;
else
x1=m_rRect1.left;
if(m_rRect1.top<m_rRect2.top)
y1=m_rRect2.top;
else
y1=m_rRect1.top;
if(m_rRect1.right<m_rRect2.right)
x2=m_rRect2.right;
else
x2=m_rRect1.right;
if(m_rRect1.bottom<m_rRect2.bottom)
y2=m_rRect2.bottom;
else
y2=m_rRect1.bottom;
pDC->Ellipse(x1,x2,y1,y2);
}

--------------------Configuration: RecRec - Win32 Debug--------------------
Compiling...
RecRec.cpp
d:\program files\microsoft visual studio\myprojects\recrec\recrecview.h(17) : error C2146: syntax error : missing ';' before identifier 'm_rRect2'
d:\program files\microsoft visual studio\myprojects\recrec\recrecview.h(17) : error C2501: 'cRect' : missing storage-class or type specifiers
d:\program files\microsoft visual studio\myprojects\recrec\recrecview.h(17) : error C2501: 'm_rRect2' : missing storage-class or type specifiers
RecRecView.cpp
d:\program files\microsoft visual studio\myprojects\recrec\recrecview.h(17) : error C2146: syntax error : missing ';' before identifier 'm_rRect2'
d:\program files\microsoft visual studio\myprojects\recrec\recrecview.h(17) : error C2501: 'cRect' : missing storage-class or type specifiers
d:\program files\microsoft visual studio\myprojects\recrec\recrecview.h(17) : error C2501: 'm_rRect2' : missing storage-class or type specifiers
D:\Program Files\Microsoft Visual Studio\MyProjects\RecRec\RecRecView.cpp(36) : error C2614: 'CRecRecView' : illegal member initialization: 'm_rRect2' is not a base or member
D:\Program Files\Microsoft Visual Studio\MyProjects\RecRec\RecRecView.cpp(63) : error C2065: 'm_rRect2' : undeclared identifier
D:\Program Files\Microsoft Visual Studio\MyProjects\RecRec\RecRecView.cpp(63) : error C2228: left of '.left' must have class/struct/union type
D:\Program Files\Microsoft Visual Studio\MyProjects\RecRec\RecRecView.cpp(64) : error C2228: left of '.left' must have class/struct/union type
D:\Program Files\Microsoft Visual Studio\MyProjects\RecRec\RecRecView.cpp(67) : error C2228: left of '.top' must have class/struct/union type
D:\Program Files\Microsoft Visual Studio\MyProjects\RecRec\RecRecView.cpp(68) : error C2228: left of '.top' must have class/struct/union type
D:\Program Files\Microsoft Visual Studio\MyProjects\RecRec\RecRecView.cpp(71) : error C2228: left of '.right' must have class/struct/union type
D:\Program Files\Microsoft Visual Studio\MyProjects\RecRec\RecRecView.cpp(72) : error C2228: left of '.right' must have class/struct/union type
D:\Program Files\Microsoft Visual Studio\MyProjects\RecRec\RecRecView.cpp(75) : error C2228: left of '.bottom' must have class/struct/union type
D:\Program Files\Microsoft Visual Studio\MyProjects\RecRec\RecRecView.cpp(76) : error C2228: left of '.bottom' must have class/struct/union type
Generating Code...
Error executing cl.exe.

RecRec.exe - 16 error(s), 0 warning(s)

不知道哪错了,谢谢 ,辛苦大家!!帮忙指点,谢谢了!!!

搜索更多相关主题的帖子: 椭圆 矩形 CRecRecView CDC int 
2006-03-27 22:00
踏魔狼
Rank: 6Rank: 6
等 级:贵宾
威 望:24
帖 子:1322
专家分:33
注 册:2005-9-22
收藏
得分:0 
如此初始化,不错才怪!

=×&D o I p R e E n C g T l X&×=
2006-03-27 22:06
踏魔狼
Rank: 6Rank: 6
等 级:贵宾
威 望:24
帖 子:1322
专家分:33
注 册:2005-9-22
收藏
得分:0 
CRecRecView::CRecRecView()

m_rRect1(50,50,250,200);m_rRect2(100,120,300,400);

=×&D o I p R e E n C g T l X&×=
2006-03-27 22:08
myajax95
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:30
帖 子:2978
专家分:0
注 册:2006-3-5
收藏
得分:0 

改掉红色的两处应该就没什么错了。

public:
CRect m_rRect1;
CRect m_rRect2;

CRecRecView::CRecRecView():m_rRect1(50,50,250,200),m_rRect2(100,120,300,400)

{}

void CRecRecView::OnDraw(CDC* pDC)
{
CRecRecDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
int x1,y1;
int x2,y2;
if(m_rRect1.left<m_rRect2.left)
x1=m_rRect2.left;
else
x1=m_rRect1.left;
if(m_rRect1.top<m_rRect2.top)
y1=m_rRect2.top;
else
y1=m_rRect1.top;
if(m_rRect1.right<m_rRect2.right)
x2=m_rRect2.right;
else
x2=m_rRect1.right;
if(m_rRect1.bottom<m_rRect2.bottom)
y2=m_rRect2.bottom;
else
y2=m_rRect1.bottom;
pDC->Ellipse(x1,x2,y1,y2);
}


http://myajax95./
2006-03-28 16:43
哈狄斯
Rank: 2
等 级:论坛游民
帖 子:45
专家分:16
注 册:2006-3-14
收藏
得分:0 

谢谢指教!!!!!

2006-03-30 12:25
快速回复:[求助]两个矩形的相交为外接巨型画椭圆问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017457 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved