社区
C#
帖子详情
为什么用了using System.Drawing还需要using System.Drawing.Drawing2D
hz251
2011-05-14 01:21:08
如题,刚开始没加using System.Drawing.Drawing2D
结果HatchBrush不能用,于是加上上面一句。
我想知道的是,为什么还需要加这一句
...全文
376
5
打赏
收藏
为什么用了using System.Drawing还需要using System.Drawing.Drawing2D
如题,刚开始没加using System.Drawing.Drawing2D 结果HatchBrush不能用,于是加上上面一句。 我想知道的是,为什么还需要加这一句
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
hz251
2011-05-14
打赏
举报
回复
[Quote=引用 4 楼 caozhy 的回复:]
因为命名空间没有层次关系。
为什么 using System; 还要 using System.Drawing; ?
[/Quote]
说到点子上了,明白
threenewbee
2011-05-14
打赏
举报
回复
因为命名空间没有层次关系。
为什么 using System; 还要 using System.Drawing; ?
Fs_2011
2011-05-14
打赏
举报
回复
System.Drawing和System.Drawing.Drawing2D是两个不同的命名空间啦
HatchBrush是System.Drawing.Drawing2D下的对象,当然要引用2D了。
如果不加的话,使用时就要写System.Drawing.Drawing2D.HatchBrush。
这么长的代码,看起来多累
风之影子
2011-05-14
打赏
举报
回复
因为这你所用到的是HatchBrush类是属于Drawing2D命名空间下的。
所以要加。如不加,就在用到HatchBrush类时Drawing2D.HatchBrush也行。
一般绘图时建议直接导入,省去在用到类时写法烦琐。
isjoe
2011-05-14
打赏
举报
回复
HatchBrush属于System.Drawing.Drawing2D而不是System.Drawing.Drawing
由直线、曲线创建图形,
using
System.
Drawing
.
Drawing
2D
;的应用例子,C#源代码 Point[]
由直线、曲线创建图形,
using
System.
Drawing
.
Drawing
2D
;的应用例子,C#源代码 Point[] points = { new Point(40, 60), new Point(50, 70), new Point(30, 90)}; GraphicsPath path = new GraphicsPath(); path.StartFigure(); // Start the first figure. path.AddArc(175, 50, 50, 50, 0, -180); path.AddLine(100, 0, 250, 20); // First figure is not closed. path.StartFigure(); // Start the second figure. path.AddLine(50, 20, 5, 90); path.AddCurve(points, 3); path.AddLine(50, 150, 150, 180); path.CloseFigure(); // Second figure is closed. e.Graphics.DrawPath(new Pen(Color.FromArgb(255, 255, 0, 0), 2), path); }
用paint方法渐变的窗口背景,
using
System.
Drawing
.
Drawing
2D
的应用,C#源代码Graphics g=e.Graphics;
用paint方法渐变的窗口背景,
using
System.
Drawing
.
Drawing
2D
的应用,C#源代码Graphics g=e.Graphics; Color FColor=Color.Blue; Color TColor=Color.Yellow; Brush b =new LinearGradientBrush(this.ClientRectangle, FColor, TColor, LinearGradientMode.ForwardDiagonal); g.FillRectangle(b,this.ClientRectangle); VS2008
微服务系列第七十一季-Introducing Spring Boot
微服务应用是分布式开发的主要手段,它很好的解决了高并发等电商平台的问题。微服务系列课程是以Java语言为基础,以SpringCloud+SpringBoot为核心,结合Spring、SpringMVC及MyBatis,通过游戏案例、电商案例,以极简的方式,带领入门的朋友们快速上手微服务开发。全部案例源码分享给学习的朋友,案例采用敏捷开发管理模式,让朋友们在每一个阶段,有着游戏过关一样的学习体验。 第七十一季主要内容包括: 1-Introducing Spring Boot2-Installing Spring Boot3-Developing Your First Spring Boot Application -Creating the POM4-Developing Your First Spring Boot Application -Adding Classpath Dependencies5-Writing the Code6-Running the Example7-Creating an Executable Jar8-Part III.
Using
Spring Boot9-Build Systems 10- Structuring Your Code
C# winform GDI
C# winform GDI画销售漏斗图形 CRM销售漏斗的实现
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.
Drawing
;
using
System.Text;
using
System.Windows.Forms;
using
System.
Drawing
.Text;//提供画GDI+图形的高级功能
using
System.
Drawing
.
Drawing
2D
;//提供画高级二维,矢量图形功能
using
System.
Drawing
.Imaging;//提供画GDI+图形的高级功能
using
System.IO;//用于文件存取
如何创建不规则窗体,可以实现
这
需要
用到多态具体代码如下
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.
Drawing
;
using
System.Text;
using
System.Windows.Forms;
using
System.
Drawing
.
Drawing
2D
;namespace 窗体重写{ public partial class MainForm : Form { public MainForm() { InitializeComponent(); } protected override void OnPaint(PaintEventArgs e) { //重写父类窗体的方法 Point[] points = new Point[] { new Point(2, 1), new Point(55, 25), new Point(110, 200), new Point(99,200), new Point(77, 117), new Point(22,123)}; GraphicsPath path = new GraphicsPath(); //GrapjicsPath是图形路径 path.AddCurve(points); //增加曲线的点 this.Region = new Region(path); //Region本窗体的区域 }
C#
110,536
社区成员
642,576
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章