VC++ mfc画坐标图

更新时间:2023-07-29 19:54:53 阅读: 评论:0

int width=1000;
int height=300;
int m_rowX=0;
int i;
//确定坐标图四周预留的空白大小息母
const int mytop=10;
const int mybottom=40;
const int myleft=60;
const int myright=10;
const int x_distance=15;
//确定X,Y轴每单位显示宽度鸭子炖什么好吃
float m_x_num=60,m_y_num=10,m_potY1=5,m_potY2=100;
float intervalX=(width-myleft-myright)/(m_x_num);
float intervalY=(height-mybottom-mytop)/(m_y_num);
//确定显示刻度个数
float bottomY=0;
float leftX=0;
const int count_x=m_x_num/2;
const int count_y=m_y_num;
//确定每个显示刻度之间的宽度   
float spaceX=(float)(width-myleft-myright)/count_x;   
float spaceY=(float)(height-mybottom-mytop)/count_y;
float m_x_x=spaceX+7;
//x轴
pDC->MoveTo(int(myleft),int(height-(mybottom+(bottomY)*intervalY)));
pDC->LineTo(int(width-myright),int(height-(mybottom+(bottomY)*intervalY)));
//Y轴    从图形区域最底端到最顶端
//电流坐标轴 兰
m_rowX = int(myleft+(leftX)*intervalX);
怎样炖牛肉
CPen pen1(PS_SOLID,1,RGB(0,200,0));
CPen *pOldPen1=pDC->SelectObject(&pen1);
pDC->MoveTo(m_rowX,int(height-mybottom));
pDC->LineTo(m_rowX,int(mytop));
pDC->SelectObject(pOldPen1);
//电流坐标轴 红
CPen pen2(PS_SOLID,1,RGB(255,0,0));
CPen *pOldPen2=pDC->SelectObject(&pen2);
pDC->MoveTo(m_rowX-m_x_x,int(height-mybottom));   
pDC->LineTo(m_rowX-m_x_x,int(mytop));
pDC->SelectObject(pOldPen2);
//绘制刻度和刻度值
CString str;
//选择字体
CFont font;
font.CreateFont(14,4,0,0,FW_REGULAR,FALSE,FALSE,0,ANSI_CHARSET,OUT_STROKE_PRECIS,
CLIP_DEFAULT_PRECIS,PROOF_QUALITY,FIXED_PITCH | FF_MODERN,_T("Arial"));
CFont* def_font=pDC->SelectObject(&font);拔萝卜故事
梦有多远
//X轴
for(int i=0;i<=count_x;i++)
{           
pDC->MoveTo(int(myleft+spaceX*i),int(height-(mybottom+(bottomY)*intervalY)));
pDC->LineTo(int(myleft+spaceX*i),int(height-(mybottom+(bottomY)*intervalY+5)));
}
int m_initx=0;
for( i=0;i<=count_x;i++)
{   
str.Format(_T("%d"),m_initx+i*2);
//  pDC->TextOut(int(myleft+spaceX*i-3), int(height-(mybottom+(bottomY)*intervalY-5)),str);   
}
//Y轴兰
CPen pen3(PS_SOLID,1,RGB(0,200,0));
CPen *pOldPen3=pDC->SelectObject(&pen3);
for(i=0;i<=count_y;i++)   
{
str.Format(_T("%.1f"),i*(m_potY1/count_y));   
//  pDC->MoveTo(m_rowX,int(height-(mybottom+spaceY*i)));   
pDC->LineTo(m_rowX+5,int(height-(mybottom+spaceY*i)));   
pDC->TextOut(m_rowX-x_distance,     
int(height-(mybottom+spaceY*i+8)),str);
}
pDC->SelectObject(pOldPen3);
pDC->MoveTo(m_rowX,int(height-(mybottom+spaceY*5)));
pDC->LineTo(m_rowX+10,int(height-(mybottom+spaceY*5)));
pDC->MoveTo(m_rowX,int(height-(mybottom+spaceY*8.4)));
pDC->LineTo(m_rowX+10,int(height-(mybottom+spaceY*8.4)));
str.Format(_T("%.1f"),4.2);
pDC->TextOut(int(myleft+(leftX)*intervalX-x_distance),
int(height-(mybottom+spaceY*8.4+8)),str);    //Y轴红
CPen pen5(PS_SOLID,1,RGB(255,0,0));
CPen *pOldPen5
=pDC->SelectObject(&pen5);
for(i=0;i<=count_y;i++)   
{
str.Format(_T("%.f"),i*(m_potY2/count_y));   
pDC->MoveTo(m_rowX-m_x_x,int(height-(mybottom+spaceY*i)));   
pDC->LineTo(m_rowX+5-m_x_x,int(height-(mybottom+spaceY*i)));   
pDC->TextOut(m_rowX-m_x_x-x_distance,
不私自离园教案int(height-(mybottom+spaceY*i+8)),str);
领导小组工作职责
}
pDC->SelectObject(pOldPen5);
//绘制网格
CPen pen6(PS_DOT,1,RGB(200,240,240));
CPen *pOldPen6=pDC->SelectObject(&pen6);
for(i=1;i<=count_y;i++)
{   
pDC->MoveTo(m_rowX+10,int(height-mybottom-i*spaceY));
pDC->LineTo(width,int(height-mybottom-i*spaceY));
}
for(i=1;i<count_x;i++)
{
pDC->MoveTo(int(m_rowX+i*spaceX),int(height-mybottom));
pDC->LineTo(int(m_rowX+i*spaceX),mytop);
}
pDC->SelectObject(pOldPen6);
//绘制虚线
CPen pen4(PS_DASHDOT,1,RGB(0,200,0));
CPen *pOldPen4=pDC->SelectObject(&pen4);
pDC->MoveTo(m_rowX+10,int(height-(mybottom+spaceY*5)));
pDC->LineTo(width,int(height-(mybottom+spaceY*5)));
pDC->MoveTo(m_rowX+10,int(height-(mybottom+spaceY*8.4)));
pDC->LineTo(int(width),int(height-(mybottom+spaceY*8.4)));
pDC->SelectObject(pOldPen4);
//绘制X,Y轴的变量名
CFont font1;
font1.CreateFont(15,6,0,0,FW_REGULAR,FALSE,FALSE,0,ANSI_CHARSET,OUT_STROKE_PRECIS,
CLIP_DEFAULT_PRECIS,PROOF_QUALITY,FIXED_PITCH | FF_SWISS,_T("Arial"));
CFont* def_font1=pDC->SelectObject(&font1);
pDC->TextOut(width/2,height-20,_T("时间(h)"));
pDC->TextOut(m_rowX-m_x_x-8,height-22,_T("(A)"));
pDC->TextOut(m_rowX-8,height-22,_T("(V)"));
pDC->SelectObject(def_font1);
数的认识
加性噪声一般指热噪声、散弹噪声等,它们与信号的关系是相加,不管有没有信号,噪声都存在。而乘性噪声一般由信道不理想引起,它们与信号的关系是相乘,信号在它在,信号不在他也就不在。一般通信中把加性随机性看成是系统的背景噪声; 而乘性随机性看成系统的时变性(如衰落或者多普勒)或者非线性所造成的。

本文发布于:2023-07-29 19:54:53,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1122971.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:刻度   信号   显示   噪声   确定   系统   看成   乘性
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图