VB.Net背景渐变使用LinearGradientBrush并显示Image
发布时间:2020-12-17 07:25:24 所属栏目:百科 来源:网络整理
导读:我尝试使用渐变背景颜色绘制一个表单,并将图像与透明度重叠. 这个有可能? 我想使用具有透明背景的平铺背景图像,并使用自定义线性渐变绘制背景. 解决方法 我做到了!,我希望与你分享我的解决方案(这很简单): 外部帮助:Tile a Shape with an Image Private
我尝试使用渐变背景颜色绘制一个表单,并将图像与透明度重叠.
这个有可能? 我想使用具有透明背景的平铺背景图像,并使用自定义线性渐变绘制背景. 解决方法
我做到了!,我希望与你分享我的解决方案(这很简单):
外部帮助:Tile a Shape with an Image Private Sub BackgroundGradient(ByRef Control As Object,_ ByVal Color1 As Drawing.Color,_ ByVal Color2 As Drawing.Color) Dim vLinearGradient As Drawing.Drawing2D.LinearGradientBrush = _ New Drawing.Drawing2D.LinearGradientBrush(New Drawing.Point(Control.Width,Control.Height),_ New Drawing.Point(Control.Width,0),_ Color1,_ Color2) Dim vGraphic As Drawing.Graphics = Control.CreateGraphics ' To tile the image background - Using the same image background of the image Dim vTexture As New Drawing.TextureBrush(Control.BackgroundImage) vGraphic.FillRectangle(vLinearGradient,Control.DisplayRectangle) vGraphic.FillRectangle(vTexture,Control.DisplayRectangle) vGraphic.Dispose() : vGraphic = Nothing : vTexture.Dispose() : vTexture = Nothing End Sub (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |