?? windows gdi和gdi+編程實例剖析_7.htm
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0046)http://tech.bc0436.com/dev/255/2190255_6.shtml -->
<HTML lang=zh-CN xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>Windows GDI和GDI+編程實例剖析</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META http-equiv=Content-Language content=zh-CN>
<META content=all name=robots>
<META content="index, follow" name=googlebot>
<META content="MSHTML 6.00.2900.2180" name=GENERATOR>
<META content="天極Yesky | 全球中文IT第一門戶" name=author>
<META content="天極Yesky | 全球中文IT第一門戶" name=Copyright>
<META content=硬件,軟件,數(shù)碼,游戲,e時代,下載,社區(qū),評測,筆記本; name=keywords><LINK media=all
href="Windows GDI和GDI+編程實例剖析_7.files/yesky-content-cs.css" type=text/css
rel=stylesheet></HEAD>
<BODY>
<SCRIPT language=JavaScript>
function sendemail(){
OpenWindow = window.open('http://other.chinabyte.com/chinabyte/qin/sendemail-new.shtm?url=/dev/255/2190255.shtml&title=Windows GDI和GDI+編程實例剖析&channel=324','emailwin','toolbar=no,location=no,scrollbars=no,menubar=no,width=462,height=450')
}</SCRIPT>
<DIV class=width>
<DIV class=minwidth>
<DIV class=container><!--頭部-->
<DIV class=hidden>yesky內(nèi)容</DIV>
<SCRIPT language=JavaScript src="" type=text/JavaScript></SCRIPT>
<SPAN id=ad1 style="DISPLAY: none"></SPAN>
<DIV align=center>
<SCRIPT>document.write(navigator.userAgent.indexOf('MSIE')==-1?"<SCRIPT src='http://219.239.88.50:80/adsunion/get/;pl=pl-1-survey2005-column-051118;tp=js;sk=0;ck=0;/?'><\/SCRIPT>":"<IFRAME MARGINHEIGHT=0 MARGINWIDTH=0 FRAMEBORDER=0 BORDER=0 VSPACE=0 WIDTH=760 NORESIZE HEIGHT=90 SCROLLING=NO SRC='http://219.239.88.50:80/adsunion/get/;pl=pl-1-survey2005-column-051118;tp=if;sk=0;ck=0;/?'></IFRAME>");</SCRIPT>
</DIV>
<DIV class=clear1></DIV>
<DIV class=newbox><SPAN id=ad8></SPAN></DIV><!--導(dǎo)航條-->
<DIV class=newbox>
<DIV class=newbgpic>
<DIV class=left>您現(xiàn)在的位置: <A href="http://tech.bc0436.com/">Yesky</A>><A
href="http://tech.bc0436.com/soft"> 軟件</A>><A
href="http://tech.bc0436.com/dev"> 開發(fā)者網(wǎng)絡(luò)</A> </DIV>
<DIV class=right>
<DIV class=space1><SPAN id=ad3></SPAN></DIV></DIV></DIV></DIV>
<DIV class=clear1></DIV><!--結(jié)束-->
<DIV class=clear1></DIV><!--文章內(nèi)容區(qū)-->
<DIV class=newbox>
<DIV class=newleft>
<DIV class=newleft1>
<DIV class=newsmallbox>Windows GDI和GDI+編程實例剖析 </DIV>
<DIV class=clear1></DIV>
<DIV class=newsmall1box>
<DIV class=newtitle1>作者: 宋寶華 </DIV>
<DIV class=newtitle2>出處: 天極網(wǎng) </DIV>
<DIV class=newtitle3>責(zé)任編輯: <A title=向本編輯提問
href="http://comments.yesky.com/t/·½ÖÛ/6,324/2190255.shtml">方舟 </A></DIV>
<DIV class=newtitle4>[ 2005-11-11 08:18 ]</DIV></DIV>
<DIV class=clear1></DIV>
<STYLE type=text/css>A.zhy0815button_content {
BORDER-RIGHT: black 1px solid; PADDING-RIGHT: 8px; BORDER-TOP: white 1px solid; PADDING-LEFT: 8px; FONT-SIZE: 12px; PADDING-BOTTOM: 4px; BORDER-LEFT: white 1px solid; COLOR: #000000; LINE-HEIGHT: 300%; PADDING-TOP: 4px; BORDER-BOTTOM: black 1px solid; FONT-FAMILY: "宋體"; TEXT-ALIGN: center; min-width: 75px
}
A.zhy0815button_content:link {
COLOR: #000; LINE-HEIGHT: 300%; BACKGROUND-COLOR: #d9d9d9; TEXT-DECORATION: none
}
A.zhy0815button_content:visited {
COLOR: #000000; LINE-HEIGHT: 300%; BACKGROUND-COLOR: #d9d9d9; TEXT-DECORATION: none
}
A.zhy0815button_content:hover {
BORDER-LEFT-COLOR: black; BORDER-BOTTOM-COLOR: white; COLOR: #333333; BORDER-TOP-COLOR: black; LINE-HEIGHT: 300%; BACKGROUND-COLOR: #cccccc; TEXT-DECORATION: none; BORDER-RIGHT-COLOR: white
}
A.zhy0815button_content:active {
COLOR: #000000; LINE-HEIGHT: 300%; BACKGROUND-COLOR: #d9d9d9; TEXT-DECORATION: none
}
</STYLE>
<CENTER><A class=zhy0815button_content title=編輯推薦你閱讀
href="http://tech.bc0436.com/dev/255/2190255_6.shtml#1" target=_self>推薦閱讀</A> <A
class=zhy0815button_content title=本欄目的最新更新
href="http://tech.bc0436.com/dev/255/2190255_6.shtml#2" target=_self>最新更新</A> <A
class=zhy0815button_content title=閱讀此文章的讀者還看了以下文章
href="http://tech.bc0436.com/dev/255/2190255_6.shtml#3" target=_self>繼續(xù)閱讀</A> <A
class=zhy0815button_content title=相關(guān)主題的關(guān)鍵字
href="http://tech.bc0436.com/dev/255/2190255_6.shtml#4" target=_self>相關(guān)主題</A> <A
class=zhy0815button_content title=本文編輯方舟的其他文章
href="http://tech.bc0436.com/dev/255/2190255_6.shtml#5" target=_self>編輯新作</A> <A
class=zhy0815button_content title=本欄目最近最受歡迎的文章
href="http://tech.bc0436.com/dev/255/2190255_6.shtml#6" target=_self>閱讀排行</A> <A
class=zhy0815button_content id=comment_url_tag title=讀者、編輯互動討論區(qū)
href="http://comments.yesky.com/t/GDI/6,324/2190255.shtml">討論本文</A><A
class=zhy0815button_content id=comment_url_art title=讀者、編輯互動討論區(qū)
href="http://comments.yesky.com/a/6,324/2190255.shtml">討論本文</A> <A
class=zhy0815button_content title=本文相關(guān)產(chǎn)品和廠商
href="http://tech.bc0436.com/dev/255/2190255_6.shtml#8" target=_self>相關(guān)產(chǎn)品</A>
</CENTER>
<DIV class=space2><SPAN id=ad5></SPAN></DIV><BR>
<DIV class=newmiddlebox style="OVERFLOW: hidden">
<DIV class=guanggao><SPAN id=ad4></SPAN></DIV>
<DIV class=guanggao><SPAN
id=contentAdv></SPAN></DIV> <STRONG>強大的文字輸出</STRONG><BR><BR> GDI+擁有極其強大的文字輸出處理能力,輸出文字的顏色、字體、填充方式都可以直接作為Graphics類DrawString成員函數(shù)的參數(shù)進行設(shè)置,其功能遠勝過GDI設(shè)備上下文的TextOut函數(shù)。<BR><BR>
<TABLE borderColor=#cccccc width="90%" align=center bgColor=#e3e3e3 border=1>
<TBODY>
<TR>
<TD>void CGdiexampleDlg::OnText()<BR>{<BR> // TODO: Add your command
handler code here<BR> CClientDC dc(this);<BR> //創(chuàng)建Graphics對象<BR> Graphics
graphics(dc);<BR> //創(chuàng)建20號"楷體"字體<BR> FontFamily fontFamily1(L "楷體_GB2312");
// 定義"楷體"字樣<BR> Font font1(&fontFamily1, 20, FontStyleRegular,
UnitPoint);<BR> //定義輸出UNICODE字符串<BR> WCHAR string[256];<BR> wcscpy(string,
L
"天極網(wǎng)的讀者朋友,您好!");<BR> //以藍色畫刷和20號"楷體"顯示字符串<BR> graphics.DrawString(string,
(INT)wcslen(string), &font1, PointF(30,
10),&SolidBrush(Color::Blue));<BR> //定義字符串顯示畫刷<BR> LinearGradientBrush
linGrBrush(Point(30, 50), Point(100, 50), Color(255, 255,0, 0), Color(255,
0, 0, 255));<BR> //以線性漸變畫刷和創(chuàng)建的20號"楷體"顯示字符串<BR> graphics.DrawString(string,
(INT)wcslen(string), &font1, PointF(30,
50),&linGrBrush);<BR> //創(chuàng)建20號"華文行楷"字體<BR> FontFamily fontFamily2(L
"華文行楷"); // 定義"楷體"字樣<BR> Font font2(&fontFamily2, 20,
FontStyleRegular,
UnitPoint);<BR> //以線性漸變畫刷和20號"華文行楷"顯示字符串<BR> graphics.DrawString(string,
(INT)wcslen(string), &font2, PointF(30,
90),&linGrBrush);<BR> //以圖像創(chuàng)建畫刷<BR> Image image(L
"d:\\3.jpg");<BR> TextureBrush
tBrush(&image);<BR> //以圖像畫刷和20號"華文行楷"顯示字符串<BR> graphics.DrawString(string,
(INT)wcslen(string), &font2, PointF(30,
130),&tBrush);<BR> //創(chuàng)建25號"華文中宋"字體<BR> FontFamily fontFamily3(L
"華文中宋"); // 定義"楷體"字樣<BR> Font font3(&fontFamily2, 25,
FontStyleRegular,
UnitPoint);<BR> //以圖像畫刷和20號"華文行楷"顯示字符串<BR> graphics.DrawString(string,
(INT)wcslen(string), &font3, PointF(30,
170),&tBrush);<BR>}</TD></TR></TBODY></TABLE><BR> 上述代碼的執(zhí)行效果如圖10所示,字體、顏色和填充都很豐富!<BR><BR>
<TABLE width="90%" align=center border=0>
<TBODY>
<TR>
<TD>
<DIV align=center><IMG
src="Windows GDI和GDI+編程實例剖析_7.files/cot9ur00rl9w.jpg" border=0><BR>圖10
GDI+文本輸出</DIV></TD></TR></TBODY></TABLE><BR>
<DIV class=right>共8頁。 <A class=page
href="http://tech.bc0436.com/dev/255/2190255.shtml" target=_self><FONT
face=Webdings>9</FONT></A> <A class=page
href="http://tech.bc0436.com/dev/255/2190255_5.shtml" target=_self><FONT
face=Webdings>7</FONT></A> <A class=page
href="http://tech.bc0436.com/dev/255/2190255.shtml" target=_self><B>1</B></A> <A
class=page href="http://tech.bc0436.com/dev/255/2190255_1.shtml"
target=_self><B>2</B></A> <A class=page
href="http://tech.bc0436.com/dev/255/2190255_2.shtml" target=_self><B>3</B></A>
<A class=page href="http://tech.bc0436.com/dev/255/2190255_3.shtml"
target=_self><B>4</B></A> <A class=page
href="http://tech.bc0436.com/dev/255/2190255_4.shtml" target=_self><B>5</B></A>
<A class=page href="http://tech.bc0436.com/dev/255/2190255_5.shtml"
target=_self><B>6</B></A> <A class=page
href="http://tech.bc0436.com/dev/255/2190255_6.shtml" target=_self><FONT
color=#666666><B>7</B></FONT></A> <A class=page
href="http://tech.bc0436.com/dev/255/2190255_7.shtml" target=_self><B>8</B></A>
<A class=page href="http://tech.bc0436.com/dev/255/2190255_7.shtml"
target=_self><FONT face=Webdings>8</FONT></A> <A class=page
href="http://tech.bc0436.com/dev/255/2190255_7.shtml" target=_self><FONT
face=Webdings>:</FONT></A></DIV></DIV>
<CENTER><A class=zhy0815button_content title=編輯推薦你閱讀
href="http://tech.bc0436.com/dev/255/2190255_6.shtml#1" target=_self>推薦閱讀</A> <A
class=zhy0815button_content title=本欄目的最新更新
href="http://tech.bc0436.com/dev/255/2190255_6.shtml#2" target=_self>最新更新</A> <A
class=zhy0815button_content title=閱讀此文章的讀者還看了以下文章
href="http://tech.bc0436.com/dev/255/2190255_6.shtml#3" target=_self>繼續(xù)閱讀</A> <A
class=zhy0815button_content title=相關(guān)主題的關(guān)鍵字
href="http://tech.bc0436.com/dev/255/2190255_6.shtml#4" target=_self>相關(guān)主題</A> <A
class=zhy0815button_content title=本文編輯方舟的其他文章
href="http://tech.bc0436.com/dev/255/2190255_6.shtml#5" target=_self>編輯新作</A> <A
class=zhy0815button_content title=本欄目最近最受歡迎的文章
href="http://tech.bc0436.com/dev/255/2190255_6.shtml#6" target=_self>閱讀排行</A> <A
class=zhy0815button_content id=comment_url_tag title=讀者、編輯互動討論區(qū)
href="http://comments.yesky.com/t/GDI/6,324/2190255.shtml">討論本文</A><A
class=zhy0815button_content id=comment_url_art title=讀者、編輯互動討論區(qū)
href="http://comments.yesky.com/a/6,324/2190255.shtml">討論本文</A> <A
class=zhy0815button_content title=本文相關(guān)產(chǎn)品和廠商
href="http://tech.bc0436.com/dev/255/2190255_6.shtml#8" target=_self>相關(guān)產(chǎn)品</A>
</CENTER><!-- Error -->
<DIV class=clear1></DIV></DIV><!--結(jié)束-->
<DIV class=clear1></DIV>
<DIV class=space2><SPAN id=ad7></SPAN></DIV><!--文章評論區(qū)-->
<SCRIPT language=JavaScript>
<!--
var aid = 2190255;
var channelid = 324;
var tagname = "GDI";
//-->
</SCRIPT>
<SCRIPT language=JavaScript>
<!--
if(typeof(tagname) == "string" && tagname.length > 0) {
comment_url_art[0].style.display = "none";
comment_url_art[1].style.display = "none";
comment_url_tag[0].style.display = "";
comment_url_tag[1].style.display = "";
} else {
comment_url_art[0].style.display = "";
comment_url_art[1].style.display = "";
comment_url_tag[0].style.display = "none";
comment_url_tag[1].style.display = "none";
}
//-->
</SCRIPT>
<!--結(jié)束-->
<DIV class=clear1></DIV>
<DIV class=newxiangguan>
<DIV class=newxiangguanmenu><IMG height=11
src="Windows GDI和GDI+編程實例剖析_7.files/inverse1-dht.gif" width=22><A
name=1>推薦閱讀:相關(guān)文章</A> </DIV>
<DIV class=newxiangguancontent>
<LI><A
href="http://tech.bc0436.com/387/1937387.shtml">VC++.NET的GDI+入門之位圖和圖標(biāo)</A>(2005-04-19
16:18)
<LI><A
href="http://tech.bc0436.com/423/1937423.shtml">VC.NET的GDI+編程入門教程之圖形</A>(2005-04-19
16:09)
<LI><A
href="http://tech.bc0436.com/SoftChannel/72348977504190464/20050419/1938104.shtml">基于Visual
C++.NET的GDI+編程快速入門</A>(2005-04-19 18:28)
<LI><A href="http://tech.bc0436.com/188/1951188.shtml">基于Windows
GDI+的幾何線條處理</A>(2005-05-20 15:02)
<LI><A
href="http://tech.bc0436.com/dev/121/2018121.shtml">基于VC++的GDI常用坐標(biāo)系統(tǒng)及應(yīng)用</A>(2005-06-20
08:59)
<LI><A
href="http://tech.bc0436.com/dev/msdn/113/2112113.shtml">利用GDI+的雙緩沖技術(shù)來提高繪圖效率</A>(2005-09-12
17:01)
<LI><A
href="http://tech.bc0436.com/dev/msdn/183/2133683.shtml">托管C++中GDI+和GDI混合編程技術(shù)</A>(2005-09-26
09:16)
<LI><A
href="http://tech.bc0436.com/soft/lesson/multimedia/index.shtml">圖像與多媒體編程</A>(專題)
</LI></DIV></DIV>
<DIV class=clear1></DIV><!--相關(guān)文章-->
<DIV class=newxiangguan>
<DIV class=newxiangguanmenu><IMG height=11
src="Windows GDI和GDI+編程實例剖析_7.files/inverse1-dht.gif" width=22>最新熱圖 </DIV>
<DIV class=newxiangguancontent>
<DIV class=contentpicleft>
<SCRIPT language=JavaScript
src="Windows GDI和GDI+編程實例剖析_7.files/wenpic1.js"></SCRIPT>
</DIV>
<DIV class=contentpicright>
<SCRIPT language=JavaScript
src="Windows GDI和GDI+編程實例剖析_7.files/wpic.js"></SCRIPT>
</DIV></DIV></DIV>
<DIV class=clear1></DIV>
<DIV class=newxiangguan>
<DIV class=newxiangguanmenu><IMG height=11
src="Windows GDI和GDI+編程實例剖析_7.files/inverse1-dht.gif" width=22>天極無線 </DIV>
<DIV class=newxiangguancontent><SPAN id=ad6></SPAN></DIV></DIV><!--結(jié)束-->
<DIV class=clear1></DIV></DIV>
<DIV class=newright>
<DIV class=newrightad style="HEIGHT: 800px"><SPAN id=ad2></SPAN>
<DIV class=newrightbox>相關(guān)廠商 </DIV>
<DIV class=space3><SPAN id=catalogspan></SPAN></DIV><!--writen by michael.joe 2005.06.03 start-->
<STYLE type=text/css>#container2 {
WIDTH: 100%; TEXT-ALIGN: left
}
#catalog_container1 {
WIDTH: 100%
}
#catalog_container1 UL {
LIST-STYLE-TYPE: none
}
#catalog_container1 UL LI {
FLOAT: left; MARGIN: 0px 3px; TEXT-ALIGN: center
}
</STYLE>
<SCRIPT language=JavaScript>function showCatalogSpan(){ if(catalog_num!=0){ var i=0 var str="<div id=\"container2\">" str+="<div id=\"catalog_container1\">" str+="<ul>" var j=catalog_num for(i=0;i<j;i++){ if(typeof(catalog_name[i])!='undefined') str+="<li><a href="+catalog_url[i]+" title=\""+catalog_name[i]+"\">"+catalog_name[i]+"</a></li>" } str+="</ul>" str+="</div>" str+="</div>" }else{ var str="" } catalogspan.innerHTML = str } </SCRIPT>
<SCRIPT language=JavaScript>
<!--
var catalogid=0;
var pbcid=-1 ;
var pscid=-1;
var brandid=-1;
var pid=0;
var regionid=-1;
if (brandid>0)
{
catalogid = brandid;
}else if (pscid > 0)
{
catalogid = pscid;
}else if (pbcid > 0)
{
catalogid = pbcid;
}
//else if(pid > 0){catalogid=pid;}
//else if(regionid>0){catalogid=regionid;}
if(typeof(catalogid) != "undefined" &&catalogid!=0) {
document.write("<script language=\"JavaScript\" charset=\"gb2312\" defer src=\"http://product1.yesky.com/product2article/"+catalogid+"c1.js\"><\/script>");
}
//-->
</SCRIPT>
<!--writen by michael.joe 2005.06.03 end--><!--結(jié)束-->
<DIV class=newrightbox><A name=8>相關(guān)產(chǎn)品</A> </DIV>
<DIV class=space3><SPAN id=productspan></SPAN></DIV><!--writen by michael.joe 2005.06.03 start-->
<STYLE type=text/css>#container1 {
WIDTH: 100%; TEXT-ALIGN: center
}
#line1 {
WIDTH: 99%
}
#line1 UL {
LIST-STYLE-TYPE: none
}
#line1 UL LI {
BACKGROUND: url(http://product1.yesky.com/cseekimages/new/br.gif) repeat-x center 50%; FLOAT: left; WIDTH: 100%; TEXT-ALIGN: center
}
#product_container1 {
FLOAT: left; WIDTH: 99%
}
#product_container1 UL {
LIST-STYLE-TYPE: none
}
#product_container1 UL LI {
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -