关于绘制窗体背景颜色(渐变色)

liouqiao 2011-01-07 06:37:40
我现在有段代码可以实现分左右来绘制背景色,请问怎么实现上下来绘制背景色(代码来源于网络)
// Getting the graphics object
Graphics g = pevent.Graphics;

// Creating the rectangle for the gradient
Rectangle rBackground = new Rectangle(0, 0, this.Width, this.Height);

// Creating the lineargradient
System.Drawing.Drawing2D.LinearGradientBrush bBackground
= new System.Drawing.Drawing2D.LinearGradientBrush(rBackground, _Color1, _Color2, _ColorAngle);

// Draw the gradient onto the form
g.FillRectangle(bBackground, rBackground);


// Disposing of the resources held by the brush
bBackground.Dispose();
...全文
271 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuyq11 2011-01-07
  • 打赏
  • 举报
回复
http://msdn.microsoft.com/zh-cn/library/bc6x86zw(v=VS.85).aspx
wuyq11 2011-01-07
  • 打赏
  • 举报
回复
g.TranslateTransform
g.RotateTransform(90);
liouqiao 2011-01-07
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 xiehuanxie 的回复:]
只需要改变最后一个参数_ColorAngle

上下就是90度
[/Quote]

没明白 能说得详细点吗?
liouqiao 2011-01-07
  • 打赏
  • 举报
回复
现在这段代码是实现 窗体背景色从左至右改变!我想变成从上只下改变 怎么实现呢?
xiehuanxie 2011-01-07
  • 打赏
  • 举报
回复
只需要改变最后一个参数_ColorAngle

上下就是90度

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧