?? 基于visual c++的gdi常用坐標系統及應用 (3).htm
字號:
function _S_gEnvInfo(){var now=new Date();var pct=0;var ckValue="sz:"+screen.width+"x"+screen.height+"||";ckValue=ckValue+"dp:"+screen.colorDepth+"||";ckValue=ckValue+"ac:"+_S_BN_.appCodeName+"||";ckValue=ckValue+"an:"+_S_NAN_+"||";var ckTmp=_S_NAV_; var pos=0; var tmpValue=""; var len=ckTmp.length; var pos2=0; pos2=ckTmp.indexOf(";",pos); while(pos2>=0) {tmpValue=tmpValue + ckTmp.substring(pos,pos2)+",";pos=pos2+1;pos2=ckTmp.indexOf(";",pos) } tmpValue=tmpValue + ckTmp.substring(pos,len);ckValue=ckValue+"av:"+tmpValue+"||";ckValue=ckValue+"cpu:"+_S_BN_.cpuClass+"||"; ckValue=ckValue+"pf:"+_S_BN_.platform+"||";ckValue=ckValue+"jv:"+_S_gJVer()+"||";ckValue=ckValue+"ct:"+_S_gConType()+"||";ckValue=ckValue+"lg:"+_S_BN_.systemLanguage+"||";ckValue=ckValue+"tz:"+now.getTimezoneOffset()/60;return ckValue;}function setBaseCookie(shrink, _sp_mpid){if (("undefined"==_sp_mpid)||(""==_sp_mpid)){return; } var ckTmp=_S_gsSINAUID();var sudsid=_S_gsSINAPUID();var ckValue=_S_gEnvInfo();var unStr=_S_gUniproUN();var uidStr=_S_gUniproUNid();var envStr="UNIPROINFO="+ckValue+"||un:"+unStr+"||uid:"+uidStr+";";var refUrl=_S_PWD_.referrer;var cPageStr=_S_gPageInfo(_sp_mpid,refUrl);var lbStr=sudsid+"|*|"+cPageStr;lbStr=envStr+"UNIPROPATH="+lbStr+";";_S_p2Bcn(lbStr,cp_rf);}function shrinkCookie(p1,p2,p3,p4,p5){try {metaList=_S_gMeta("sinachannel");if(""!=metaList) {setBaseCookie(1, metaList);} else{setBaseCookie(1, _S_CID_+_S_DPID_); } } catch(e){}}shrinkCookie();--></SCRIPT>
<!-- SUDS_CODE_END -->
<CENTER><!--導航start-->
<STYLE>.h3 {
FONT-SIZE: 7px; COLOR: #ffbd00
}
</STYLE>
<TABLE cellSpacing=0 cellPadding=0 width=750 border=0>
<TBODY>
<TR>
<TD>
<SCRIPT>
function getCookie(name) {
var search;
search = name + "="
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length ;
end = document.cookie.indexOf(";", offset) ;
if (end == -1)
end = document.cookie.length;
return document.cookie.substring(offset, end);
}
else
return "";
}
function unipro_clearCookie(name ) {
document.cookie=name+"=; " + "domain=sina.com.cn; path=/; ";
//bites = document.cookie.split("; ");
}
function getMobileNum(ckName){
var userInfo = getCookie(ckName).split(":");
return userInfo[2];
}
function unipro_UniProLogout() {
unipro_clearCookie("SINAPRO");
unipro_clearCookie("SINA-AVATAR");
unipro_clearCookie("SINAPROC");
unipro_clearCookie("nick");
unipro_clearCookie("SINA_NU");
unipro_clearCookie("SINA_OU");
unipro_clearCookie("appmask");
unipro_clearCookie("gender");
unipro_clearCookie("UNIPROTM");
unipro_clearCookie("UNIPROU");
unipro_clearCookie("SINA_USER");
unipro_clearCookie("SMS_COOKIE");
return true;
}
function getUniproUrl_stand(){
window.location='http://unipro.sina.com.cn/';
return false;
}
function getUniproUrl_welcome(){
unipro_UniProLogout();
window.location='http://unipro.sina.com.cn';
return false;
}
function print_stand_unipro_head()
{
document.write("<table border=0 cellpadding=0 cellspacing=0><tr align=center><td><a href=http://www.sina.com.cn class=a01>首頁</a></td><td width=14></td><td><a href=http://news.sina.com.cn class=a01>新聞</a></td><td width=14></td><td><a href=http://sports.sina.com.cn class=a01>體育</a></td><td width=14></td><td><a href=http://ent.sina.com.cn class=a01>娛樂</a></td><td width=14></td><td><a href=http://bn.sina.com.cn/ class=a01>視頻</a></td><td width=14></td><td><a href=http://finance.sina.com.cn/ class=a01>財經</a></td><td width=14></td><td><a href=http://tech.sina.com.cn/ class=a01>科技</a></td><td width=14></td><td><a href=http://auto.sina.com.cn/ class=a01>汽車</a></td><td width=14></td><td><a href=http://house.sina.com.cn/ class=a01><font color=red>房產</font></a></td><td width=14></td><td><a href=http://games.sina.com.cn class=a01>游戲</a></td><td width=14></td><td><a href=http://eladies.sina.com.cn/ class=a01>女性</a></td><td width=14></td><td><a href=http://book.sina.com.cn/ class=a01>讀書</a><td width=14></td><td><a href=http://y.sina.com.cn/ class=a01>校園</a></td><td width=14></td><td><a href=http://weather.sina.com.cn/ class=a01>天氣</a></td><td width=14></td><td><a href=http://sms.sina.com.cn class=a01>短信</a></td><td width=14></td><td><a href=http://mail.sina.com.cn class=a01>郵箱</a></td><td width=14></td><td><a href=http://search.sina.com.cn class=a01>搜索</a></td><td width=14></td><td><a href=http://news.sina.com.cn/guide/ class=a01>導航</a></td><td width=14></td></tr></table>");
document.write("</td><td align=right>");
document.write("<table height=25 border=0 cellpadding=0 cellspacing=0>");
document.write("<tr><td><td align=right> <a href=# onClick='return getUniproUrl_stand()'>通行證登錄</a></td></tr>");
document.write("</table>");
}
function print_stand_unipro_welcome()
{
var unipro_login_nickname = getCookie( "nick" );
var unipro_login_pos = unipro_login_nickname.indexOf( "(" );
if ( unipro_login_pos != -1 )
{
unipro_login_nickname = unipro_login_nickname.substr( 0, unipro_login_pos );
}
document.write("<table border=0 cellpadding=0 cellspacing=0><tr align=center><td><a href=http://www.sina.com.cn class=a01>首頁</a></td><td width=14></td><td><a href=http://news.sina.com.cn class=a01>新聞</a></td><td width=14></td><td><a href=http://sports.sina.com.cn class=a01>體育</a></td><td width=14></td><td><a href=http://ent.sina.com.cn class=a01>娛樂</a></td><td width=14></td><td><a href=http://bn.sina.com.cn/ class=a01>視聽</a></td><td width=14></td><td><a href=http://finance.sina.com.cn/ class=a01>財經</a></td><td width=14></td><td><a href=http://tech.sina.com.cn/ class=a01>科技</a></td><td width=14></td><td><a href=http://auto.sina.com.cn/ class=a01>汽車</a></td><td width=14></td><td><a href=http://house.sina.com.cn/ class=a01><font color=red>房產</font></a></td><td width=14></td><td><a href=http://games.sina.com.cn class=a01>游戲</a></td><td width=14></td><td><a href=http://weather.sina.com.cn/ class=a01>天氣</a></td><td width=14></td><td><a href=http://sms.sina.com.cn class=a01>短信</a></td><td width=14></td><td><a href=http://mail.sina.com.cn class=a01>郵箱</a></td><td width=14></td><td><a href=http://search.sina.com.cn class=a01>搜索</a></td><td width=14></td><td><a href=http://news.sina.com.cn/guide/ class=a01>導航</a></td><td width=14></td><td></td></tr></table>");
document.write("</td><td align=right>");
document.write("<table height=25 border=0 cellpadding=0 cellspacing=0>");
document.write("<tr>");
if ( unipro_login_nickname!="" && unipro_login_nickname!="null" && unipro_login_nickname!=null && unipro_login_nickname!="undefined" ) {
document.write("<td align=right> "+unipro_login_nickname+"</td><td width=4></td><td><a href=# onClick='return getUniproUrl_welcome()'><font color=#0000ff>安全退出</font></a>");
} else {
document.write( "<td align=right> 新浪過客" +"</td><td width=4></td><td><a href=# onClick='return getUniproUrl_welcome()'><font color=#0000ff>安全退出</font></a>");
}
document.write("</td></tr>");
document.write("</table>");
}
</SCRIPT>
<SCRIPT language=javascript>
if (getCookie("SINAPRO") == "") {
print_stand_unipro_head();
} else {
print_stand_unipro_welcome();
}
</SCRIPT>
</TD></TR></TBODY></TABLE><!--導航end--><!--頭部結束--><!--科技新聞內頁頂部通欄開始--><!--17F810F98351-->
<OBJECT
codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0
height=80 width=750 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME="movie" VALUE="http://ad4.sina.com.cn/200506/13/21036.swf"><PARAM NAME="quality" VALUE="high"><PARAM NAME="wmode" VALUE="opaque">
<EMBED src="http://ad4.sina.com.cn/200506/13/21036.swf" FlashVars="h"
quality=high WIDTH="750" HEIGHT="80" 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-20/B $--><!--科技新聞內頁頂部通欄結束-->
<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常用坐標系統及應用 (3).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> > <A class=a02
href="http://tech.sina.com.cn/">科技時代</A> > <A class=a02
href="http://tech.sina.com.cn/introduction/">學園</A> > 正文</FONT></TD>
<TD vAlign=bottom align=right width=150><A href="http://www.yesky.com/"
target=_blank><IMG height=28
src="基于Visual C++的GDI常用坐標系統及應用 (3).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常用坐標系統及應用 (3).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常用坐標系統及應用 (3)</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日 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 -->
<DIV></DIV>
<DIV></DIV>
<DIV>
<DIV><B> 三、固定映射模式</B></DIV>
<DIV> 為了控制設備上下文中的坐標軸的方向,可以使用CDC類的SetMapMode()函數,它的語法如下:</DIV>
<DIV>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf
border=1>
<TBODY>
<TR>
<TD>int SetMapMode(int nMapMode);</TD></TR></TBODY></TABLE></DIV>
<DIV> 這個函數將根據參數的設置的不同做兩件事,<B>一是</B>控制坐標軸的方向;<B>二是</B>坐標系統的單位長度。</DIV>
<DIV> 這個函數的參數是用來定義映射模式的整型常量。它可能的值是:MM_TEXT, MM_LOENGLISH、MM_HIENGLISH、MM_AN<A
class=akey
href="http://tech.sina.com.cn/other/2004-07-10/1642385995.shtml"
target=_blank>ISO</A>TROPIC、MM_HIMETRIC, MM_ISOTROPIC、 MM_LOMETRIC, MM_TWIPS。</DIV>
<DIV> 默認情況下使用MM_TEXT映射模式。換句話說,如果你沒有具體的規定某一映射模式,你的應用程序就將使用MM_TEXT映射模式。在這種映射模式下,設備上下文中的度量尺寸將使用默認的像素單位,水平坐標軸正方向向右,垂直坐標軸正方向向下。例如,上面的OnPaint事件可以用下面的代碼重寫,它將產生同樣的效果,仿佛沒有使用映射模式。</DIV>
<DIV>
<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); // device context for painting</DIV>
<DIV> dc.SetMapMode(MM_TEXT);</DIV>
<DIV> dc.SetViewportOrg(380, 220);</DIV>
<DIV> // Use a red pen</DIV>
<DIV> CPen PenRed(PS_SOLID, 1, RGB(255, 0, 0));</DIV>
<DIV> dc.SelectObject(PenRed);</DIV>
<DIV> // A circle whose center is at the origin (0, 0)</DIV>
<DIV> dc.Ellipse(-100, -100, 100, 100);</DIV>
<DIV> // Use a blue pen</DIV>
<DIV> CPen PenBlue(PS_SOLID, 1, RGB(0, 0, 255));</DIV>
<DIV> dc.SelectObject(PenBlue);</DIV>
<DIV> // Horizontal axis</DIV>
<DIV> dc.MoveTo(-380, 0);</DIV>
<DIV> dc.LineTo(380, 0);</DIV>
<DIV> // Vertical axis</DIV>
<DIV> dc.MoveTo(0, -220);</DIV>
<DIV> dc.LineTo(0, 220);</DIV>
<DIV> // An orange pen</DIV>
<DIV> CPen PenOrange(PS_SOLID, 1, RGB(255, 128, 0));</DIV>
<DIV> dc.SelectObject(PenOrange);</DIV>
<DIV> // A diagonal line at 45 degrees</DIV>
<DIV> dc.MoveTo(0, 0);</DIV>
<DIV> dc.LineTo(120, 120);</DIV>
<DIV>}</DIV></TD></TR></TBODY></TABLE><BR></DIV>
<TABLE width="90%" align=center border=0>
<TBODY>
<TR>
<TD>
<DIV align=center><B><IMG alt=基于VisualC++的GDI常用坐標系統及應用(3)
src="基于Visual C++的GDI常用坐標系統及應用 (3).files/4077332547.gif"
border=1><BR>圖十、代碼效果圖</B></DIV></TD></TR></TBODY></TABLE>
<DIV><BR> MM_LOENGLISH模式,與其他一些映射模式(不包括MM_TEXT模式)一樣,執行兩個動作,它改變坐標軸的方向,垂直坐標軸的正方向向上;</DIV><BR>
<TABLE width="90%" align=center border=0>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -