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

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

📁 GDI编程的参考资料
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>基于Visual C++的GDI常用坐标系统及应用_技术_科技时代_新浪网</TITLE>
<META http-equiv=content-type content="text/html; charset=gb2312">
<STYLE type=text/css>H1 {
	FONT-SIZE: 24px; MARGIN: 0px
}
TD {
	FONT-SIZE: 12px
}
SELECT {
	FONT-SIZE: 12px
}
INPUT {
	FONT-SIZE: 12px
}
.l17 {
	LINE-HEIGHT: 170%
}
.l15 {
	LINE-HEIGHT: 150%
}
.f7 {
	FONT-SIZE: 7px
}
.f24 {
	FONT-SIZE: 24px
}
.f14 {
	FONT-SIZE: 14px; LINE-HEIGHT: 130%
}
.title12 {
	FONT-SIZE: 12px
}
.title14 {
	FONT-SIZE: 14px; LINE-HEIGHT: 130%
}
.tail12 {
	FONT-SIZE: 12px
}
A:link {
	COLOR: #0000ff
}
A:visited {
	COLOR: #800080
}
A:active {
	COLOR: #ff0000
}
A:hover {
	COLOR: #ff0000
}
A.a01:link {
	COLOR: #07015b; TEXT-DECORATION: none
}
A.a01:visited {
	COLOR: #07015b; TEXT-DECORATION: none
}
A.a01:active {
	COLOR: #ff0000; TEXT-DECORATION: none
}
A.a01:hover {
	COLOR: #ff0000; TEXT-DECORATION: none
}
A.a02:link {
	COLOR: #0000ff; TEXT-DECORATION: none
}
A.a02:visited {
	COLOR: #0000ff; TEXT-DECORATION: none
}
A.a02:active {
	COLOR: #ff0000; TEXT-DECORATION: none
}
A.a02:hover {
	COLOR: #ff0000; TEXT-DECORATION: none
}
</STYLE>

<STYLE>A.akey:link {
	COLOR: #0000ff; TEXT-DECORATION: none
}
A.akey:visited {
	COLOR: #800080; TEXT-DECORATION: none
}
A.akey:active {
	COLOR: #ff0000; TEXT-DECORATION: underline
}
A.akey:hover {
	COLOR: #ff0000; TEXT-DECORATION: underline
}
</STYLE>


<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=5 onload=setTailPosition() 

<TABLE cellSpacing=0 cellPadding=0 width=750 border=0>
  <TBODY>
  <TR>
    <TD width=150 height=34><A href="http://tech.sina.com.cn/"><IMG height=34 
      alt=科技时代 src="基于Visual C++的GDI常用坐标系统及应用_1.files/sina_kjsd.gif" width=144 
      border=0></A></TD>
    <TD vAlign=bottom width=440><FONT color=#0000ff><A class=a02 
      href="http://home.sina.com.cn/">新浪首页</A> &gt; <A class=a02 
      href="http://tech.sina.com.cn/">科技时代</A> &gt; <A class=a02 
      href="http://tech.sina.com.cn/introduction/">学园</A> &gt; 正文</FONT></TD>
    <TD vAlign=bottom align=right width=150><A href="http://www.yesky.com/" 
      target=_blank><IMG height=28 
      src="基于Visual C++的GDI常用坐标系统及应用_1.files/U1084P2T50D213F629DT20041213105743.gif" 
      border=0></A></TD>
    <TD width=10></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=750 border=0>
  <TBODY>
  <TR>
    <TD height=8></TD></TR>
  <TR>
    <TD bgColor=#747474 height=1><IMG height=1 
      src="基于Visual C++的GDI常用坐标系统及应用_1.files/c.gif" width=1></TD></TR></TBODY></TABLE>
<DIV id=outer style="WIDTH: 750px; POSITION: relative">
<TABLE cellSpacing=0 cellPadding=0 width=750 border=0>
  <TBODY>
  <TR>
    <TD vAlign=top align=middle width=620 bgColor=#edf0f5 rowSpan=2><BR>
      <DIV id=article>
      <TABLE cellSpacing=0 cellPadding=0 width=560 border=0>
        <TBODY>
        <TR>
          <TH class=f24><FONT color=#05006c>
            <H1>基于Visual C++的GDI常用坐标系统及应用</H1></FONT></TH></TR>
        <TR>
          <TD>
            <HR SIZE=1 bgcolor="#d9d9d9">
          </TD></TR>
        <TR>
          <TD align=middle height=20>http://www.sina.com.cn 
            2005年06月20日&nbsp;11:43 <FONT color=#a20010>天极yesky</FONT></TD></TR>
        <TR>
          <TD height=15></TD></TR>
        <TR>
          <TD class=l17><FONT class=f14 id=zoom><!-- 正文内部文字导航 : begin --><!-- 正文内部文字导航 : end -->
            <P>  作者: 刘涛 </P>
            <P>  在Windows应用程序中,只要进行绘图,就要使用GDI坐标系统。Windows提供了几种映射方式,每一种映射都对应着一种坐标系。例如,绘制图形时,必须给出图形各个点在客户区的位置,其位置用x 和y两个坐标表示,x 表示横坐标,y表示纵坐标。在所有的GDI绘制函数中,这些坐标使用的是一种“逻辑单位”。当GDI函数将结果输出送到某个物理设备上<!--NEWSZW_HZH_BEGIN-->
            <TABLE style="MARGIN: 10px 7px 3px 4px" cellSpacing=0 cellPadding=0 
            align=left border=0><!--
<table id="innerad" border=0 cellspacing=0 cellpadding=0 align=left style="display:none">
-->
              <TBODY>
              <TR>
                <TD><!--画中画广告开始-->
                  <TABLE cellSpacing=0 cellPadding=0 align=left border=0>
                    <TBODY>
                    <TR>
                      <TD><!--科技新闻内页画中画开始--><!--FDD6E78C4F0D--><!--Adforward Begin:--><IFRAME 
                        marginWidth=0 marginHeight=0 
                        src="基于Visual C++的GDI常用坐标系统及应用_1.files/adfshow.htm" 
                        frameBorder=0 width=360 scrolling=no 
                        height=300>
<SCRIPT LANGUAGE="JavaScript1.1" SRC="http://122.adsina.allyes.com/main/adfshow?user=AFP6_for_SINA|Tech|techpip&db=sina&local=yes&js=on"></SCRIPT>
<NOSCRIPT><A HREF="http://122.adsina.allyes.com/main/adfclick?user=AFP6_for_SINA|Tech|techpip&db=sina"><IMG SRC="http://122.adsina.allyes.com/main/adfshow?user=AFP6_for_SINA|Tech|techpip&db=sina" WIDTH=360 HEIGHT=300 BORDER=0></a></NOSCRIPT></IFRAME><!--Adforward End--><!--$$ nwy/2005-6-20 ~ 2005-6-21/B $--><!--科技新闻内页画中画结束--></TD></TR></TBODY></TABLE><!--画中画广告结束--></TD></TR>
              <TR>
                <TD><!-- 画中画下文字链广告(从上至下顺序为01,02,03,04文字,需加class=a01)-->
                  <TABLE cellSpacing=0 cellPadding=0 width=360 border=0>
                    <TBODY>
                    <TR>
                      <TD height=9></TD></TR>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width=360 
                        background="基于Visual C++的GDI常用坐标系统及应用_1.files/xfrd_02.gif" 
                        border=0>
                          <TBODY>
                          <TR>
                            <TD height=45 rowSpan=2><IMG height=45 
                              src="基于Visual C++的GDI常用坐标系统及应用_1.files/xfrd_01.gif" 
                              width=70 border=0></TD>
                            <TD style="PADDING-LEFT: 5px; PADDING-TOP: 4px" 
                            width=286><!--F70BB90BB6BA--><!--nwy/uc/A-->
                              <SCRIPT language=JavaScript>


ad1= "伊利未来充满希望";
link1= "http://noshow.adsina.allyes.com/main/adfclick?db=sina&bid=12254,33072,33112&cid=0,0,0&sid=32861&advid=2034&camid=6363&show=ignore&url=http://ad.sina.com.cn/minisite/200506yili/yili.html";
//左上

ad2= "打工不如当老板!";
link2= "http://noshow.adsina.allyes.com/main/adfclick?db=sina&bid=8178,28137,28179&cid=0,0,0&sid=28272&advid=1800&camid=5854&show=ignore&url=http://admin.biz178.com/dlz/sheke/weburl.php?id=1275";
//右上

ad3= "17'液晶PC触价格底限";
link3= "http://noshow.adsina.allyes.com/main/adfclick?db=sina&bid=12337,33175,33215&cid=0,0,0&sid=32959&advid=1917&camid=6368&show=ignore&url=http://ad4.sina.com.cn/wx/ads/tongfangnews/tongfangnews613.html";
//左下

ad4= "电通广告招聘广告精英";
link4= "http://noshow.adsina.allyes.com/main/adfclick?db=sina&bid=12546,33431,33471&cid=0,0,0&sid=33196&advid=1832&camid=6385&show=ignore&url=http://active.zol.com.cn/zds/marmot/diantong/";
//右下


//浏览器类型变量
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

//ie内容
function IEad(){
	adCode = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="280" HEIGHT="40" id="ad_note" ALIGN=""><PARAM NAME=movie VALUE="http://image2.sina.com.cn/dy/zwyhzh/ad_note.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=wmode VALUE=transparent> <PARAM NAME=bgcolor VALUE=#FFFFFF> <param name="swLiveConnect" value="true"> '
	+' <EMBED src="http://image2.sina.com.cn/dy/zwyhzh/ad_note.swf" quality=high wmode=transparent bgcolor=#FFFFFF  WIDTH="280" HEIGHT="40" NAME="ad_note" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" swLiveConnect="true"></EMBED></OBJECT>'

	document.write(adCode);
	
	document.getElementById('ad_note').SetVariable("ad1", ad1);
	document.getElementById('ad_note').SetVariable("ad2", ad2);
	document.getElementById('ad_note').SetVariable("ad3", ad3);
	document.getElementById('ad_note').SetVariable("ad4", ad4);
	
	document.getElementById('ad_note').SetVariable("link1", link1);
	document.getElementById('ad_note').SetVariable("link2", link2);
	document.getElementById('ad_note').SetVariable("link3", link3);
	document.getElementById('ad_note').SetVariable("link4", link4);

}
//ns内容
function NSad(){

adCode = '<table width=286 border=0 cellpadding=0 cellspacing=0>'
	+'<tr height=20><td width=143 style="padding-top:5px;padding-left:5px"> <img src=http://image2.sina.com.cn/dy/images/xfrd_04.gif width=7 height=7> '
	+'<a href='+ link1 +' class=a01 target=_blank>'+ ad1 +'</a>'
	+'</td><td width=143 style="padding-top:5px;"> <img src=http://image2.sina.com.cn/dy/images/xfrd_04.gif width=7 height=7> '
	+'<a href='+ link2 +' class=a01 target=_blank>'+ ad2 +'</a>'
	+'</td></tr>'
	+'<tr height=20><td style="padding-left:5px"> <img src=http://image2.sina.com.cn/dy/images/xfrd_04.gif width=7 height=7> '
	+'<a href='+ link3 +' class=a01 target=_blank>'+ ad3 +'</a>'
	+'</td><td> <img src=http://image2.sina.com.cn/dy/images/xfrd_04.gif width=7 height=7> '
	+'<a href='+ link4 +' class=a01 target=_blank><SPAN ID="oSpan" UNSELECTABLE="on" >'+ ad4 +'</span></a></td></tr></table>'

document.write(adCode);
}

//主过程
if(InternetExplorer == true){
	IEad();
}else{
	NSad();
}
</SCRIPT>
                            </TD>
                            <TD width=4 rowSpan=2><IMG height=45 
                              src="基于Visual C++的GDI常用坐标系统及应用_1.files/xfrd_03.gif" 
                              width=4></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><!--NEWSZW_HZH_END-->时,Windows将逻辑坐标转换成设备坐标(如屏幕或打印机的像素点)。本文讨论了图形环境中的各个映射模式,包括它们是什么,怎么工作的,以及它们真正的含义。<BR><BR>  <B>一、基础知识<BR> </B>  
            </P>
            <DIV></DIV>
            <DIV>  (一)逻辑坐标。逻辑坐标与设备无关,缺省地,一个逻辑单位等于设备中的一个象素。它是实现“所见即所得”的基础。例如,当程序员调用LineTo函数绘制25.4mm(1 英 寸) 长的直线时,他只要使用合适的映射模式,那么就并不需要考虑输出的是何种设备。若设备是VGA显示器,Windows自动将其转化为96个像素点;若设备是一个300dpi的激光打印机,Windows自动将其转化为300 个像素点。 </DIV>
            <P>  </P>
            <DIV>  (二)设备坐标。图形输出时,Windows将GDI函数中指定的逻辑坐标映射为设备坐标,在所有的设备坐标系统中,单位以像素点为准,水平值从左到右增大(正方向向右),垂直值从上到下增大(正方向向下)。Windows中包括以下3 种设备坐标,以满足各种不同需要: </DIV>
            <P>  </P>
            <DIV>  1、客户区域坐标,包括应用程序的客户区域,客户区域的左上角为(0, 0)。 </DIV>
            <P>  </P>
            <DIV>  2、屏幕坐标,包括整个屏幕,屏幕的左上角为(0, 0)。屏幕坐标用在WM_MOVE消息中(对于非子窗口)以及下面的Windows 函数中:CreateWindow 和MoveWindow(都对于非子窗口)、GetMessage、GetCursorPos、GetWindowRect、WindowFromPoint 和SetBrushOrg 中。 用函数ClientToScreen 和ScreenToClient可以将客户区域坐标转换成屏幕区域坐标,或反之。 <BR> <BR>  3、全窗口坐标,包括一个程序的整个窗口,包括标题条、菜单、滚动条和窗口框,窗口的左上角为(0,0)。使用GetWindowDC得到的窗口设备环境,可以将逻辑单位转换成窗口”坐标。   
            </DIV>
            <DIV><BR>  (三)映射。映射方式定义了Windows如何将GDI函数中指定的逻辑坐标映射为设备坐标。在下文中我们将介绍常用的映射方式。</DIV>
            <P>  </P>
            <DIV>  此外,习惯上,我们将逻辑坐标所在的坐标系称为“窗口”;将设备坐标所在的坐标系称为“视口”。“窗口”依赖于逻辑坐标,可以是像素点、毫米或其他尺度。这一点请牢记,这对于下面的有关内容的理解至关重要。</DIV>
            <P>  </P>

⌨️ 快捷键说明

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