⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 基于visual c++的gdi常用坐标系统及应用_1.htm

📁 GDI编程的参考资料
💻 HTM
📖 第 1 页 / 共 4 页
字号:
            <DIV><B>  二、默认的坐标系统<BR> </B></DIV>
            <P>  当在<A class=akey href="http://www.microsoft.com/china" 
            target=_blank>微软</A>的窗口中进行绘图时,绘图的坐标原点在屏幕的左上角,任何物体在屏幕上定位都要参考这个坐标原点。在笛卡尔坐标系统中这个点被定义为坐标原点(0,0),水平坐标轴的正方向是从该点出发向右延伸,垂直坐标轴的正方向是从该点出发向下延伸。<BR><BR>
            <TABLE width="90%" align=center border=0>
              <TBODY>
              <TR>
                <TD>
                  <DIV align=center><B><IMG alt=基于VisualC++的GDI常用坐标系统及应用 
                  src="基于Visual C++的GDI常用坐标系统及应用_1.files/3234150871.gif" 
                  border=1><BR>图一、笛卡尔坐标系</B></DIV></TD></TR></TBODY></TABLE><BR>  这个坐标原点只是<A 
            class=akey 
            href="http://tech.sina.com.cn/introduction/focus/pcos.shtml" 
            target=_blank>操作系统</A>默认的坐标原点,所以如果你调用Ellipse(-100, -100, 100, 100)函数来绘制图形的话,你将得到一个圆,它的圆心位于屏幕的左上角,仅仅只有圆的四分之一部分(270度到360度的部分)显示在屏幕上。代码及效果图如下  
            </P>
            <DIV><BR>
            <TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf 
            border=1>
              <TBODY>
              <TR>
                <TD>
                  <DIV>void CExoDraw1View::OnPaint() </DIV>
                  <DIV>{</DIV>
                  <DIV> CPaintDC dc(this); // 绘图的设备厂上下文</DIV>
                  <DIV> CPen PenBlue;</DIV>
                  <DIV> // 兰色画笔</DIV>
                  <DIV> PenBlue.CreatePen(PS_SOLID, 1, RGB(0, 12, 255));</DIV>
                  <DIV> dc.SelectObject(&amp;pPen);</DIV>
                  <DIV> dc.Ellipse(-100, -100, 100, 100);</DIV>
                  <DIV>}</DIV></TD></TR></TBODY></TABLE><BR></DIV>
            <P>
            <TABLE width="90%" align=center border=0>
              <TBODY>
              <TR>
                <TD>
                  <DIV align=center><IMG alt=基于VisualC++的GDI常用坐标系统及应用 
                  src="基于Visual C++的GDI常用坐标系统及应用_1.files/375035875.gif" 
                  border=1><BR>  <B>图二、代码效果图</B>  </DIV></TD></TR></TBODY></TABLE></P>
            <DIV><BR>  按照同样的原理,你可以使用CpaintDC的方法或按照你的要求创建函数来绘制任何几何或非几何图形。例如,下面的代码绘制了两条相互垂直的直线,垂点位与窗口的中心:<BR> <BR>
            <TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf 
            border=1>
              <TBODY>
              <TR>
                <TD>
                  <DIV>void CExoDraw1View::OnPaint()   </DIV>
                  <DIV>{</DIV>
                  <DIV> CPaintDC dc(this); // 绘图的设备上下文</DIV>
                  <DIV> CRect Recto;</DIV>
                  <DIV> CPen PenBlue;</DIV>
                  <DIV> PenBlue.CreatePen(PS_SOLID, 1, RGB(0, 12, 255));</DIV>
                  <DIV> dc.SelectObject(&amp;PenBlue);</DIV>
                  <DIV> dc.Ellipse(-100, -100, 100, 100);</DIV>
                  <DIV> CPen PenBlack;</DIV>
                  <DIV> PenBlack.CreatePen(PS_SOLID, 1, BLACK_PEN);</DIV>
                  <DIV> dc.SelectObject(&amp;PenBlack);</DIV>
                  <DIV> // 得到客户区域的尺寸;</DIV>
                  <DIV> GetClientRect(&amp;Recto);</DIV>
                  <DIV> dc.MoveTo(Recto.Width() / 2, 0);</DIV>
                  <DIV> dc.LineTo(Recto.Width() / 2, Recto.Height());</DIV>
                  <DIV> dc.MoveTo(0, Recto.Height() / 2);</DIV>
                  <DIV> dc.LineTo(Recto.Width(), Recto.Height() / 2);</DIV>
                  <DIV>}</DIV></TD></TR></TBODY></TABLE><BR></DIV>
            <DIV>
            <TABLE width="90%" align=center border=0>
              <TBODY>
              <TR>
                <TD>
                  <DIV align=center>
                  <DIV><IMG alt=基于VisualC++的GDI常用坐标系统及应用 
                  src="基于Visual C++的GDI常用坐标系统及应用_1.files/866386425.gif" 
                  border=1> </DIV> <B>图三、代码效果图</B></DIV></TD></TR></TBODY></TABLE></DIV><SPAN 
            id=_function_code_page>
            <P align=right> [1] <A 
            href="http://tech.sina.com.cn/s/2005-06-20/1143640456.shtml">[2]</A> <A 
            href="http://tech.sina.com.cn/s/2005-06-20/1143640457.shtml">[3]</A> <A 
            href="http://tech.sina.com.cn/s/2005-06-20/1143640458.shtml">[4]</A> <A 
            href="http://tech.sina.com.cn/s/2005-06-20/1143640459.shtml">[5]</A> <A 
            style="FONT-SIZE: 14px" 
            href="http://tech.sina.com.cn/s/2005-06-20/1143640456.shtml">[下一页]</A></P></SPAN>
            <TABLE width="90%" align=center border=0>
              <TBODY>
              <TR></TR></TBODY></TABLE><BR clear=all>
            <TABLE cellSpacing=0 cellPadding=0 width=565 border=0>
              <TBODY>
              <TR>
                <TD class=f14 vAlign=top height=30>  点击此处查询<A 
                  href="http://chanews.sina.com.cn/s.cgi?k=keyword&amp;c=2&amp;k=Visual" 
                  target=_blank C>全部<FONT color=red>Visual C</FONT>新闻</A> 
              </TD></TR></TBODY></TABLE></FONT></TD></TR></TBODY></TABLE></DIV><BR>
      <TABLE cellSpacing=0 cellPadding=0 width=580 border=0>
        <TBODY>
        <TR>
          <TD>
            <TABLE cellSpacing=0 cellPadding=0 width=580 border=0>
              <TBODY>
              <TR>
                <TD>
                  <FORM name=from_ 
                  action=http://mms.sina.com.cn/xmlmms/xmlmmsQue.php method=post 
                  target=_blank><INPUT type=hidden 
                  value=http://rss.sina.com.cn/mms/tech/52/80/6/2-1-640450.xml 
                  name=xmlCfg> <INPUT type=hidden value=100001 name=sourceFrom> 
                  <INPUT type=hidden value=442 name=from> </TD></FORM>
                <TD align=right>【<A 
                  href="http://comment.news.sina.com.cn/cgi-bin/comment/comment.cgi?channel=kj&amp;newsid=640450">评论</A>】【<A 
                  href="http://forum.tech.sina.com.cn/cgi-bin/tree.cgi?gid=23&amp;fid=288">应用软件论坛</A>】【<A 
                  title=收藏的网页将被永久的保存到ViVi收藏夹http://vivi.sina.com.cn 
                  href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(vivi=window.open('http://vivi.sina.com.cn/collect/icollect.php?pid=tech.sina.com.cn&amp;title='+escape(d.title)+'&amp;url='+escape(d.location.href)+'&amp;desc='+escape(t),'vivi','scrollbars=no,width=460,height=450,left=75,top=20,status=no,resizable=yes'));vivi.focus();">收藏此页</A>】【<A 
                  href="javascript:doZoom(16)">大</A> <A 
                  href="javascript:doZoom(14)">中</A> <A 
                  href="javascript:doZoom(12)">小</A>】【<A 
                  href="javascript:from_.submit()">多种方式看新闻</A>】【<A 
                  href="http://www.sina.com.cn/ddt/" target=_blank>下载点点通</A>】【<A 
                  href="javascript:doPrint()">打印</A>】【<A 
                  href="javascript:window.close()">关闭</A>】</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width=565 border=0>
        <TBODY>
        <TR>
          <TD height=19></TD></TR>
        <TR>
          <TD bgColor=#c6c9d1 height=1></TD></TR>
        <TR>
          <TD height=10></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=0 cellPadding=0 width=560 border=0>
        <TBODY>
        <TR>
          <TD><!-- 正文底部小通栏 -->
            <TABLE cellSpacing=0 cellPadding=0 width=585 align=center 
              border=0><TBODY>
              <TR>
                <TD><!--科技频道内页底部小通栏开始--><!--96086D89A9D3-->
                  <OBJECT 
                  codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0 
                  height=50 width=585 
                  classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME="movie" VALUE="http://ad4.sina.com.cn/200505/31/19724.swf"><PARAM NAME="quality" VALUE="high"><PARAM NAME="wmode" VALUE="opaque">
                     <EMBED src="http://ad4.sina.com.cn/200505/31/19724.swf" 
                  quality=high WIDTH="585" HEIGHT="50" 
                  TYPE="application/x-shockwave-flash" 
                  PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
                  </OBJECT><!--$$ weixing/2005-6-20 ~ 2005-6-22/B $--><!--科技频道内页底部小通栏结束--></TD></TR>
              <TR>
                <TD 
            height=5></TD></TR></TBODY></TABLE><!--Adforward Begin:测试勿删--><IFRAME 
            marginWidth=0 marginHeight=0 
            src="D:\Wang Yongfeng\GDI\基于Visual C++的GDI常用坐标系统及应用_1.files\adfshow(1).htm" 
            frameBorder=0 width=1 scrolling=no 
            height=1>
<SCRIPT LANGUAGE="JavaScript1.1" SRC="http://153.adsina.allyes.com/main/adfshow?user=AFP6_for_SINA|Tech|TechPIP&db=sina&local=yes&js=on"></SCRIPT>
<NOSCRIPT><A HREF="http://153.adsina.allyes.com/main/adfclick?user=AFP6_for_SINA|Tech|TechPIP&db=sina"><IMG SRC="http://153.adsina.allyes.com/main/adfshow?user=AFP6_for_SINA|Tech|TechPIP&db=sina" WIDTH=1 HEIGHT=1 BORDER=0></a></NOSCRIPT></IFRAME><!--Adforward End--></TD></TR></TBODY></TABLE><BR>
      <TABLE cellSpacing=0 cellPadding=0 width=560 border=0>
        <TBODY>
        <TR>
          <TD>
            <DIV id=PublicRelation1 style="DISPLAY: none" name="PublicRelation">
            <TABLE>
              <TBODY>
              <TR>
                <TD>&nbsp;&nbsp;&nbsp;&nbsp;</TD>
                <TD class=f14>
                  <P><!--要求文字在17字以内!--><!--科技新闻内页文字链01开始--><!--721C1770C53A--><A 
                  href="http://ad.cn.doubleclick.net/clk;17068092;11418269;i?http://www-900.ibm.com/cn/servers/eserver/bladecenter/index.shtml" 
                  target=_blank><FONT color=red>IBM刀片买六赠一,现在开刃</FONT></A><!--$$ weixing/2005-6-16 ~ 2005-6-16/B $--> 
<!--科技新闻内页文字链01结束-->&nbsp;&nbsp; <!--科技新闻内页文字链02开始--><!--32E1711D03D4--><A 
                  href="http://noshow.adsina.allyes.com/main/adfclick?db=sina&amp;bid=12405,33258,33298&amp;cid=0,0,0&amp;sid=33031&amp;advid=1924&amp;camid=6377&amp;show=ignore&amp;url=http://www.aigo.com/huodong/securitymoon/" 
                  target=_blank><FONT color=red>爱国者关注您数据安全!</FONT></A><!--$$ weixing/2005-6-20 ~ 2005-6-21/B $--> 
<!--科技新闻内页文字链02结束--></P></TD></TR></TBODY></TABLE></DIV>
            <SCRIPT>	 
//<!--广告发布-->
<!--
	if (checkPubTime(getPubTime()))
	{
		PublicRelation1.style.display="";
	}
-->
</SCRIPT>
              
            <DIV id=links>
            <TABLE cellSpacing=0 cellPadding=0 width=562 border=0>
              <TBODY>
              <TR>
                <TD width=562>
                  <TABLE cellSpacing=0 cellPadding=0 width=562 border=0>
                    <TBODY>
                    <TR>
                      <TD bgColor=#5550a2>
                        <TABLE cellSpacing=1 cellPadding=5 width="100%" 
border=0>
                          <TBODY>
                          <TR>
                            <TD bgColor=#edf0f5> 相关链接</TD></TR>
                          <TR>
                            <TD class=f14 bgColor=#edf0f5><A 
                              href="http://tech.sina.com.cn/s/2005-06-20/1116640374.shtml" 
                              target=_blank>用Visual C++打造自己的资源管理器</A><FONT 
                              color=gray>2005-06-20 11:16:35</FONT> <BR><A 
                              href="http://tech.sina.com.cn/s/2005-06-15/0937636126.shtml" 
                              target=_blank>Visual C下显示JPEG和GIF图像简便方法</A><FONT 
                              color=gray>2005-06-15 09:37:33</FONT> <BR><A 
                              href="http://tech.sina.com.cn/s/2005-06-14/0853634760.shtml" 
                              target=_blank>Visual C下揭开特洛伊木马的隐藏面纱</A><FONT 
                              color=gray>2005-06-14 08:53:45</FONT> <BR><A 
                              href="http://tech.sina.com.cn/s/2005-05-27/1005619509.shtml" 
                              target=_blank>Visual Basic用第三方控件制作资源管理器</A><FONT 
                              color=gray>2005-05-27 10:05:58</FONT> <BR><A 
                              href="http://tech.sina.com.cn/s/2005-05-12/0845605124.shtml" 
                              target=_blank>Visual Basic中轻松打造绚丽按钮</A><FONT 
                              color=gray>2005-05-12 08:45:18</FONT> <BR><A 
                              href="http://tech.sina.com.cn/s/2005-04-27/0841594841.shtml" 
                              target=_blank>Visual Basic 6.0网络编程的五大散手</A><FONT 
                              color=gray>2005-04-27 08:41:40</FONT> <BR><A 
                              href="http://tech.sina.com.cn/s/2005-04-18/0958585423.shtml" 
                              target=_blank>Visual C#编写3D游戏框架示例</A><FONT 
                              color=gray>2005-04-18 09:58:27</FONT> <BR><A 
                              href="http://tech.sina.com.cn/s/2005-04-13/0947580529.shtml" 
                              target=_blank>浅析Visual Basic.NET中的资源使用</A><FONT 
                              color=gray>2005-04-13 
                          09:47:36</FONT><BR></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE></TD>
    <TD width=1 bgColor=#747474 rowSpan=2></TD>
    <TD vAlign=top width=129></TD></TR></TBODY></TABLE><!-- 右侧功能条 begin -->
<DIV id=toolBar style="DISPLAY: none; POSITION: absolute">
<TABLE cellSpacing=0 cellPadding=0 width=129 border=0>
  <TBODY>
  <TR>
    <TD align=middle><!-- 搜索 begin-->
      <SCRIPT language=javascript>
	function NameTitle(fn)
	{   
	        _search.action = "http://chanews.sina.com.cn/s.cgi";
		search_form1 = fn;
		strName=fn._ss.value;                    
	        if(strName == "2"){
			search_form1.c.value=strName;
			search_form1.t.value="keyword";
		}else if(strName == "pic"){
			search_form1.c.value="all";
			search_form1.t.value="keyword";
			_search.action = "http://newspic.sina.com.cn/newspic.php";
		}else{	
			search_form1.c.value="all";
			search_form1.t.value=strName;
		}
	}
	</SCRIPT>
<!-- 搜索 end-->
      <TABLE cellSpacing=0 cellPadding=0 width=120 border=0>
        <TBODY>
        <TR height=2>
          <TD colSpan=2></TD></TR>
        <TR>
          <TD align=middle width=120 bgColor=#fdc903 colSpan=2 height=23>新 闻 查 
            询</TD></TR>
        <FORM name=_search action=http://chanews.sina.com.cn/s.cgi 
        method=get><INPUT type=hidden value=keyword name=t> <INPUT type=hidden 
        value=all name=c> 
        <TR>
          <TD colSpan=2 height=30>关键词 <INPUT class=t2 size=11 
name=k><BR></TD></TR>
        <TR>
          <TD width=85 height=30><SELECT class=t3 
            onchange=NameTitle(this.form) name=_ss> <OPTION 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -