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

📄 基于vc_net的gdi+编程入门之画刷 _2.htm

📁 GDI编程的参考资料
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!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> &gt; <A 
title=程序开发 href="http://www.qqread.com/program/index.html">程序开发</A> &gt; <A 
title=.Net技术 href="http://www.qqread.com/dotnet/index.html">.Net技术</A> &gt; <A 
title=VC.NET href="http://www.qqread.com/vcdotnet/index.html">VC.NET</A> &gt; 
正文</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>&nbsp;<A 
  href="http://www.qqread.com/vcdotnet/f482126000.html">1</A>&nbsp;<FONT 
  color=#ff0000>2</FONT>&nbsp;<A 
  href="http://www.qqread.com/vcdotnet/f482126000_3.html">3</A>&nbsp;<A 
  href="http://www.qqread.com/vcdotnet/f482126000_4.html">4</A>&nbsp;<A 
  href="http://www.qqread.com/vcdotnet/f482126000_3.html">下一页</A>&nbsp; 
  <DD class=ArticleContent>  (二)网格画刷<BR><BR>  网格画刷根据已画或已<A 
  href="http://www.baidu.com/baidu?tn=jkday2000&amp;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-&gt;Graphics-&gt;FillRectangle(brushBackDiag, 
        20, 20, 80, 60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushCross, 120, 
        20, 80, 60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushDarkDown, 220, 20, 
        80, 60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushDarkHorz, 320, 20, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushDarkUpDiag, 420, 20, 80, 
        60);<BR><BR>e-&gt;Graphics-&gt;FillRectangle(brushVertical, 20, 100, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushDashDnDiag, 120, 100, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushDashHorz, 220, 100, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushDashUpDiag, 320, 100, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushDashVert, 420, 100, 80, 
        60);<BR><BR>e-&gt;Graphics-&gt;FillRectangle(brushDashVert, 20, 180, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushDiagBrisk, 120, 180, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushDiagCross, 220, 180, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushDivot, 320, 180, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushDotDiamond, 420, 180, 80, 
        60);<BR><BR>e-&gt;Graphics-&gt;FillRectangle(brushDottedGrid, 20, 260, 
        80, 60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushForDiag, 120, 260, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushHorz, 220, 260, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushHorzBrick, 320, 260, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushLgChkBoard, 420, 260, 80, 
        60);<BR><BR>e-&gt;Graphics-&gt;FillRectangle(brushLgGrid, 20, 340, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushLtDnDiag, 120, 340, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushLtHorz, 220, 340, 80, 
        60);<BR>e-&gt;Graphics-&gt;FillRectangle(brushUpDiag, 320, 340, 80, 
        60);<BR>e-&gt;Graphics-&gt;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>&nbsp;&nbsp;<A 
  href="http://www.baidu.com/baidu?tn=jkday2000&amp;word=设计">设计</A>&nbsp;&nbsp;<A 
  href="http://www.qqread.com/keywords/windows.html">windows</A>&nbsp;&nbsp;<A 
  href="http://www.qqread.com/keywords/vcdotnet.html">vc.net</A>&nbsp;&nbsp;<A 
  href="http://www.qqread.com/keywords/os.html">os</A>&nbsp;&nbsp;<A 
  href="http://www.qqread.com/keywords/ie.html">ie</A>&nbsp;&nbsp; 
  <DD class=ArticleInfo_3><A 
  href="http://www.qqread.com/vcdotnet/f482126000.html">上一页</A>&nbsp;<A 
  href="http://www.qqread.com/vcdotnet/f482126000.html">1</A>&nbsp;<FONT 
  color=#ff0000>2</FONT>&nbsp;<A 
  href="http://www.qqread.com/vcdotnet/f482126000_3.html">3</A>&nbsp;<A 
  href="http://www.qqread.com/vcdotnet/f482126000_4.html">4</A>&nbsp;<A 
  href="http://www.qqread.com/vcdotnet/f482126000_3.html">下一页</A>&nbsp; </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 + -