?? 基于vc_net的gdi+編程入門之畫刷 _2.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=(0048)http://www.qqread.com/vcdotnet/f482126000_2.html -->
<HTML lang=zh xml:lang="zh" xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>基于VC.NET的GDI+編程入門之畫刷 - QQread.com 電腦頻道</TITLE>
<META http-equiv=Content-Language content=zh-CN>
<META
content=[art_mtkw],電腦入門,上網指南,操作系統,常用軟件,黑客與安全,網絡游戲,程序開發,數據庫開發,網頁制作,圖像處理,多媒體制作,網絡編程,加密技術,網絡技術
name=keywords>
<META content=基于VC.NET的GDI+編程入門之畫刷 name=description>
<META content=QQRead.com name=author>
<META content=all name=robots>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
href="基于VC_NET的GDI+編程入門之畫刷 _2.files/qqread_html.css" type=text/css
rel=stylesheet><LINK href="基于VC_NET的GDI+編程入門之畫刷 _2.files/qqread_html_com.css"
type=text/css rel=stylesheet>
<STYLE type=text/css>.STYLE2 {
FONT-SIZE: 14px
}
</STYLE>
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY><!-- 公共頁頭 -->
<DIV style="TEXT-ALIGN: center">
<DIV id=topad>
<TABLE>
<TBODY>
<TR>
<TD width=10><SPAN
id=ad_qqread_top></SPAN><!--End//--></TD></TR></TBODY></TABLE></DIV>
<DIV id=CHBig>
<DIV id=CHBigCSDNLogo><A href="http://www.qqread.com/"><IMG alt=巧巧讀書網
src="基于VC_NET的GDI+編程入門之畫刷 _2.files/qqread.gif" border=0></A></DIV>
<DIV id=CHBigHeaderWrapper>
<DIV id=CHBigNavBar2>
<UL>
<LI><A href="http://www.qqread.com/news/" target=_blank>新聞中心</A>|
<LI><A href="http://www.qqread.com/skill/" target=_blank>技巧集錦</A>|
<LI><A href="http://www.qqread.com/itlife/" target=_blank>IT人生雨露</A>|
<LI><A href="http://www.qqread.com/pcbase/" target=_blank>電腦入門</A>|
<LI><A href="http://www.qqread.com/netreference/" target=_blank>上網指南</A>|
<LI><A href="http://www.qqread.com/safe/" target=_blank>黑客與安全</A>|
<LI><A href="http://www.qqread.com/commentsoft/" target=_blank>常用軟件</A>|
<LI><A href="http://www.qqread.com/os/" target=_blank>操作系統</A>|
<LI><A href="http://www.qqread.com/netgame/" target=_blank>網絡游戲</A><BR>
<LI><A title=圖片欣賞 href="http://www.qqread.com/photo/index.html"
target=_blank>圖片欣賞</A>|
<LI><A href="http://www.qqread.com/program/" target=_blank>程序開發</A>|
<LI><A href="http://www.qqread.com/database/" target=_blank>數據庫開發</A>|
<LI><A href="http://www.qqread.com/webdesign/" target=_blank>網頁制作</A>|
<LI><A href="http://www.qqread.com/photohandle/" target=_blank>圖像處理</A>|
<LI><A href="http://www.qqread.com/mutimedia/" target=_blank>多媒體制作</A>|
<LI><A href="http://www.qqread.com/netprogram/" target=_blank>網絡編程</A>|
<LI><A href="http://www.qqread.com/encrypt/" target=_blank>加密技術</A>|
<LI><A href="http://www.qqread.com/network/" target=_blank>網絡技術</A>
</LI></UL></DIV>
<DIV id=CHBigNavBar1></DIV></DIV>
<DIV style="CLEAR: both"></DIV></DIV></DIV><!-- /公共頁頭 -->
<DIV id=OutBox>
<DIV id=listMainArea>
<DIV id=disclaimer><A href="http://www.qqread.com/">巧巧讀書首頁</A> > <A
title=程序開發 href="http://www.qqread.com/program/index.html">程序開發</A> > <A
title=.Net技術 href="http://www.qqread.com/dotnet/index.html">.Net技術</A> > <A
title=VC.NET href="http://www.qqread.com/vcdotnet/index.html">VC.NET</A> >
正文</DIV>
<DL class=ReadArticle>
<DT>基于VC.NET的GDI+編程入門之畫刷
<DD class=ArticleInfo3>
<SCRIPT src="基于VC_NET的GDI+編程入門之畫刷 _2.files/adtitle.js"
type=text/javascript></SCRIPT>
<HR SIZE=2>
<DD class=ArticleInfo3>
<DIV align=center><A href="http://www.qqread.com/">http://www.qqread.com/</A>
作者:劉濤 2005-12-03 來源:天極網 瀏覽:<SPAN id=count></SPAN> </DIV>
<DD class=ArticleInfo_3>
<DD class=ArticleInfo_3><A
href="http://www.qqread.com/vcdotnet/f482126000.html">上一頁</A> <A
href="http://www.qqread.com/vcdotnet/f482126000.html">1</A> <FONT
color=#ff0000>2</FONT> <A
href="http://www.qqread.com/vcdotnet/f482126000_3.html">3</A> <A
href="http://www.qqread.com/vcdotnet/f482126000_4.html">4</A> <A
href="http://www.qqread.com/vcdotnet/f482126000_3.html">下一頁</A>
<DD class=ArticleContent> (二)網格畫刷<BR><BR> 網格畫刷根據已畫或已<A
href="http://www.baidu.com/baidu?tn=jkday2000&word=設計"
target=_blank>設計</A>的模式來設置它的填充類型。為了支持網格畫刷,.NET框架提供了畫刷可以使用的各種模式,這些預先設計的模式對應于網格畫刷的類型。這意味著在使用網格畫刷時,必須在可用的各種類型中選擇想要使用的模式,為了使填充區域更生動,還需要說明所使用的顏色。<BR><BR> 為了獲取一個網格畫刷,可以使用HatchBrush類,它的其中一個構造函數使用以下語法:<BR><BR>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf
border=1><TBODY>
<TR>
<TD>public: HatchBrush(HatchStyle style, Color
foreColor);</TD></TR></TBODY></TABLE><BR> 參數foreColor是用來繪制模式的顏色,style參數是想使用的網格類型,一些可用的類型是:<BR><BR>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf
border=1><TBODY>
<TR>
<TD>private: System::Void Form1_Paint(System::Object * sender,
<BR>System::Windows::Forms::PaintEventArgs * e)<BR>{<BR>using namespace
System::Drawing::Drawing2D;<BR>HatchBrush *brushBackDiag = new
HatchBrush(HatchStyle::BackwardDiagonal, <BR>Color::FromArgb(0, 0,
255));<BR>HatchBrush *brushCross = new HatchBrush(HatchStyle::Cross,
<BR>Color::FromArgb(200, 0, 0));<BR>HatchBrush *brushDarkDown = <BR>new
HatchBrush(HatchStyle::DarkDownwardDiagonal,
Color::Salmon);<BR>HatchBrush *brushDarkHorz = new
HatchBrush(HatchStyle::DarkHorizontal,<BR>Color::Navy);<BR>HatchBrush
*brushDarkUpDiag = new HatchBrush(HatchStyle::DarkUpwardDiagonal,
<BR>Color::Pink);<BR>HatchBrush *brushVertical = new
HatchBrush(HatchStyle::DarkVertical, <BR>Color::FromArgb(255, 0,
255));<BR>HatchBrush *brushDashDnDiag = new
HatchBrush(<BR>HatchStyle::DashedDownwardDiagonal, Color::FromArgb(255,
128, 0));<BR>HatchBrush *brushDashHorz = new
HatchBrush(HatchStyle::DashedHorizontal, <BR>Color::FromArgb(0, 128,
192));<BR>HatchBrush *brushDashUpDiag = new
<BR>HatchBrush(HatchStyle::DashedUpwardDiagonal,
Color::Green);<BR>HatchBrush *brushDashVert = new
HatchBrush(HatchStyle::DashedVertical,
<BR>Color::Firebrick);<BR>HatchBrush *brushDiagBrisk = new
HatchBrush(HatchStyle::DiagonalBrick,<BR>Color::Fuchsia);<BR>HatchBrush
*brushDiagCross = new HatchBrush(HatchStyle::DiagonalCross,
<BR>Color::Moccasin);<BR>HatchBrush *brushDivot = new
HatchBrush(HatchStyle::Divot, <BR>Color::Goldenrod);<BR>HatchBrush
*brushDotDiamond = new HatchBrush(HatchStyle::DottedDiamond,
<BR>Color::Gainsboro);<BR>HatchBrush *brushDottedGrid = new
HatchBrush(HatchStyle::DottedGrid,<BR>Color::Khaki);<BR>HatchBrush
*brushForDiag = new HatchBrush(HatchStyle::ForwardDiagonal,
<BR>Color::Maroon);<BR>HatchBrush *brushHorz = new
HatchBrush(HatchStyle::Horizontal, <BR>Color::Red);<BR>HatchBrush
*brushHorzBrick = new
HatchBrush(HatchStyle::HorizontalBrick,<BR>Color::SaddleBrown);<BR>HatchBrush
*brushLgChkBoard = new HatchBrush(HatchStyle::LargeCheckerBoard,
<BR>Color::RoyalBlue);<BR>HatchBrush *brushLgConfetti = new
HatchBrush(HatchStyle::LargeConfetti,
<BR>Color::MistyRose);<BR>HatchBrush *brushLgGrid = new
HatchBrush(HatchStyle::LargeGrid, <BR>Color::Purple);<BR>HatchBrush
*brushLtDnDiag = new HatchBrush(<BR>HatchStyle::LightDownwardDiagonal,
Color::DarkCyan);<BR>HatchBrush *brushLtHorz = new
HatchBrush(HatchStyle::LightHorizontal,<BR>Color::PowderBlue);<BR>HatchBrush
*brushUpDiag = new HatchBrush(<BR>HatchStyle::LightUpwardDiagonal,
Color::SeaGreen);<BR>HatchBrush *brushLtVert = new
HatchBrush(HatchStyle::LightVertical,<BR>Color::Olive);<BR>e->Graphics->FillRectangle(brushBackDiag,
20, 20, 80, 60);<BR>e->Graphics->FillRectangle(brushCross, 120,
20, 80, 60);<BR>e->Graphics->FillRectangle(brushDarkDown, 220, 20,
80, 60);<BR>e->Graphics->FillRectangle(brushDarkHorz, 320, 20, 80,
60);<BR>e->Graphics->FillRectangle(brushDarkUpDiag, 420, 20, 80,
60);<BR><BR>e->Graphics->FillRectangle(brushVertical, 20, 100, 80,
60);<BR>e->Graphics->FillRectangle(brushDashDnDiag, 120, 100, 80,
60);<BR>e->Graphics->FillRectangle(brushDashHorz, 220, 100, 80,
60);<BR>e->Graphics->FillRectangle(brushDashUpDiag, 320, 100, 80,
60);<BR>e->Graphics->FillRectangle(brushDashVert, 420, 100, 80,
60);<BR><BR>e->Graphics->FillRectangle(brushDashVert, 20, 180, 80,
60);<BR>e->Graphics->FillRectangle(brushDiagBrisk, 120, 180, 80,
60);<BR>e->Graphics->FillRectangle(brushDiagCross, 220, 180, 80,
60);<BR>e->Graphics->FillRectangle(brushDivot, 320, 180, 80,
60);<BR>e->Graphics->FillRectangle(brushDotDiamond, 420, 180, 80,
60);<BR><BR>e->Graphics->FillRectangle(brushDottedGrid, 20, 260,
80, 60);<BR>e->Graphics->FillRectangle(brushForDiag, 120, 260, 80,
60);<BR>e->Graphics->FillRectangle(brushHorz, 220, 260, 80,
60);<BR>e->Graphics->FillRectangle(brushHorzBrick, 320, 260, 80,
60);<BR>e->Graphics->FillRectangle(brushLgChkBoard, 420, 260, 80,
60);<BR><BR>e->Graphics->FillRectangle(brushLgGrid, 20, 340, 80,
60);<BR>e->Graphics->FillRectangle(brushLtDnDiag, 120, 340, 80,
60);<BR>e->Graphics->FillRectangle(brushLtHorz, 220, 340, 80,
60);<BR>e->Graphics->FillRectangle(brushUpDiag, 320, 340, 80,
60);<BR>e->Graphics->FillRectangle(brushLtVert, 420, 340, 80,
60);<BR>}</TD></TR></TBODY></TABLE><BR>
<TABLE width="90%" align=center border=0>
<TBODY>
<TR>
<TD>
<DIV align=center><IMG hspace=3
src="基于VC_NET的GDI+編程入門之畫刷 _2.files/20051203ig390_3.gif" align=center
vspace=1 border=1
;?><BR>圖三、各種網絡格畫刷效果圖</DIV></TD></TR></TBODY></TABLE><BR> 如果使用上面的構造函數來填充一個圖形,選擇的模式將繪制在黑色背景上,如果想使用不同的背景,使用下面的構造函數來初始化畫刷。<BR><BR>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf
border=1><TBODY>
<TR>
<TD>public: HatchBrush(HatchStyle hatchstyle, Color foreColor, Color
backColor);</TD></TR></TBODY></TABLE><BR> 參數backColor是將用于背景的顏色。<BR><BR> 任何時候,為了得到繪制模式的顏色,可以操作畫刷的ForegroundColor屬性;為了了解背景顏色,可以操作畫刷的BackgroundColor屬性;為了知道當前畫刷的類型,可以操作它的HatchStyle類型。<BR><BR>
<TABLE style="MARGIN: 10px 8px 3px 7px" cellSpacing=0 cellPadding=0 align=left
border=0>
<TBODY>
<TR>
<TD><SPAN id=ad_qqread_mid_big></SPAN></TD></TR></TBODY></TABLE>
<DD class=ArticleContent>關鍵字: <A
href="http://www.qqread.com/keywords/file-format.html">文件格式</A> <A
href="http://www.baidu.com/baidu?tn=jkday2000&word=設計">設計</A> <A
href="http://www.qqread.com/keywords/windows.html">windows</A> <A
href="http://www.qqread.com/keywords/vcdotnet.html">vc.net</A> <A
href="http://www.qqread.com/keywords/os.html">os</A> <A
href="http://www.qqread.com/keywords/ie.html">ie</A>
<DD class=ArticleInfo_3><A
href="http://www.qqread.com/vcdotnet/f482126000.html">上一頁</A> <A
href="http://www.qqread.com/vcdotnet/f482126000.html">1</A> <FONT
color=#ff0000>2</FONT> <A
href="http://www.qqread.com/vcdotnet/f482126000_3.html">3</A> <A
href="http://www.qqread.com/vcdotnet/f482126000_4.html">4</A> <A
href="http://www.qqread.com/vcdotnet/f482126000_3.html">下一頁</A> </DD></DL>
<DIV id=ArticleContent4>
<SCRIPT src="基于VC_NET的GDI+編程入門之畫刷 _2.files/adend.js"
type=text/javascript></SCRIPT>
</DIV>
<TABLE style="MARGIN-BOTTOM: 5px" cellSpacing=1 cellPadding=0 width=582
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -