我在画sin()函数,如何将座标设置在clentRect的中央啊? 我在画y=sin()函数图像,如何将座标设置在clentRect的中央啊? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CRect rect;GetClientRect(&rect);dc.SetMapMode(MM_ANISOTROPIC); //设置不同比例的坐标系dc.SetViewportOrg(rect.left,rect.bottom); //坐标原点 右下脚dc.SetViewportExt(rect.right,rect.bottom); //视窗浣范围 dc.SetWindowOrg(0,0); dc.SetWindowExt(rect.right,-rect.bottom); dc.SetViewportOrg(rect.left,rect.bottom);--->dc.SetViewportOrg(rect.Width()/2,rect.Height()/2); 还不行啊!我的代码如下:CClientDC dc(this); // device context for painting CRect rect; double y; int x; GetClientRect(&rect); dc.MoveTo(0,rect.Height() / 2); dc.LineTo (rect.Width(),rect.Height() / 2); dc.MoveTo(rect.Width()/2,0); dc.LineTo (rect.Width()/2,rect.Height()); dc.SetTextColor(RGB(0,0,255)); ClientToScreen(&rect); for (x=1;x<rect.Width()-10;) { y=sin(x); dc.TextOut (x,y+rect.Height() / 2,"*"); x=x+10; 』 CRect rect;GetClientRect(&rect);dc.SetMapMode(MM_ANISOTROPIC);//设置不同比例的坐标系dc.SetViewportOrg(rect.Width()/2,rect.Height()/2);//坐标原点 dc.SetViewportExt(rect.right,rect.bottom);//视窗浣范围dc.SetWindowOrg(0,0);dc.SetWindowExt(rect.right,-rect.bottom);dc.MoveTo(0,0);dc.LineTo(100,100);//看看效果 //接上上楼CClientDC dc(this); // device context for paintingCRect rect;GetClientRect(&rect);dc.SetMapMode(MM_ANISOTROPIC);//设置不同比例的坐标系dc.SetViewportOrg(rect.Width()/2,rect.Height()/2);//坐标原点 dc.SetViewportExt(rect.right,rect.bottom);//视窗浣范围dc.SetWindowOrg(0,0);dc.SetWindowExt(rect.right,-rect.bottom);dc.MoveTo(-rect.right / 2,0);dc.LineTo(rect.right / 2,0);dc.MoveTo(0,-rect.bottom / 2);dc.LineTo(0,rect.bottom / 2);double pi = 3.1415;double rate = rect.Width() / (2 * pi);for(double i = - pi; i < pi; i += 0.1){ if(i == -pi) dc.MoveTo(i * rate,sin(i) * rate); else dc.LineTo(i * rate,sin(i) * rate);} 求下载网页的软件,要带有url筛选的 新建工程,编译release报错 史上最奇怪的编程问题居然让我遇到了 如何在vs2005中制作makefile文件 关于控件加载问题!高分! 怎么使用程序级别的快捷键 问几个非常简单的问题 老大们,我再看别人的代码时发现如下问题 将已经存在的SQL语句参数化,急求! delphi 在拔掉网线后,使用Netbios为就何得不到网卡的MAC地址啦?? 可见数字水印
GetClientRect(&rect);
dc.SetMapMode(MM_ANISOTROPIC); //设置不同比例的坐标系
dc.SetViewportOrg(rect.left,rect.bottom); //坐标原点 右下脚
dc.SetViewportExt(rect.right,rect.bottom); //视窗浣范围
dc.SetWindowOrg(0,0);
dc.SetWindowExt(rect.right,-rect.bottom);
--->
dc.SetViewportOrg(rect.Width()/2,rect.Height()/2);
CClientDC dc(this); // device context for painting
CRect rect;
double y;
int x;
GetClientRect(&rect);
dc.MoveTo(0,rect.Height() / 2);
dc.LineTo (rect.Width(),rect.Height() / 2); dc.MoveTo(rect.Width()/2,0);
dc.LineTo (rect.Width()/2,rect.Height()); dc.SetTextColor(RGB(0,0,255)); ClientToScreen(&rect); for (x=1;x<rect.Width()-10;)
{
y=sin(x);
dc.TextOut (x,y+rect.Height() / 2,"*");
x=x+10;
』
GetClientRect(&rect);
dc.SetMapMode(MM_ANISOTROPIC);//设置不同比例的坐标系
dc.SetViewportOrg(rect.Width()/2,rect.Height()/2);//坐标原点
dc.SetViewportExt(rect.right,rect.bottom);//视窗浣范围
dc.SetWindowOrg(0,0);
dc.SetWindowExt(rect.right,-rect.bottom);dc.MoveTo(0,0);
dc.LineTo(100,100);//看看效果
CClientDC dc(this); // device context for painting
CRect rect;
GetClientRect(&rect);
dc.SetMapMode(MM_ANISOTROPIC);//设置不同比例的坐标系
dc.SetViewportOrg(rect.Width()/2,rect.Height()/2);//坐标原点
dc.SetViewportExt(rect.right,rect.bottom);//视窗浣范围
dc.SetWindowOrg(0,0);
dc.SetWindowExt(rect.right,-rect.bottom);dc.MoveTo(-rect.right / 2,0);
dc.LineTo(rect.right / 2,0);
dc.MoveTo(0,-rect.bottom / 2);
dc.LineTo(0,rect.bottom / 2);double pi = 3.1415;
double rate = rect.Width() / (2 * pi);
for(double i = - pi; i < pi; i += 0.1)
{
if(i == -pi)
dc.MoveTo(i * rate,sin(i) * rate);
else
dc.LineTo(i * rate,sin(i) * rate);
}