[求助]多色渐变的问题

Alibabar 2014-12-11 06:47:19

请教一下如图的多色渐变怎样设置渐变画笔绘制
...全文
130 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Alibabar 2014-12-11
  • 打赏
  • 举报
回复
Private Sub Btn_Test_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Test.Click Dim LBrush As LinearGradientBrush Dim Bmp As Bitmap Dim Grp As Graphics Dim Blend As ColorBlend LBrush = New LinearGradientBrush(New Rectangle(0, 0, Pic_Test.Width, Pic_Test.Height), Color.Red, Color.Blue, LinearGradientMode.Horizontal) '随便什么烂颜色创建一个画笔,重要的是区域和渐变方向 Blend = New ColorBlend(4) Blend.Colors = New Color() {Color.Red, Color.Green, Color.Yellow, Color.Blue} '指定颜色 Blend.Positions = New Single() {0, 0.25F, 0.5F, 1.0F} '指定百分比位置 LBrush.InterpolationColors = Blend Bmp = New Bitmap(Pic_Test.Width, Pic_Test.Height) Grp = Graphics.FromImage(Bmp) Grp.FillRectangle(LBrush, New Rectangle(0, 0, Pic_Test.Width, Pic_Test.Height)) LBrush.Dispose() Grp.Dispose() Pic_Test.BackgroundImage = Bmp End Sub 自我了断吧

16,552

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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