注册 登录
编程论坛 VB.NET论坛

图像透明度问题

jiutian1981 发布于 2009-10-16 11:41, 1052 次点击
各位大虾:
    在编程过程中如何设置图像的透明度啊?
    请赐教。
2 回复
#2
dyqq12342009-10-25 01:01
中的透明度只能通过定义画刷来完成,但是效果不好的.
try
dim g as Graphics
dim myBrush as Brush
dim MyFiler as String="*.jpg"
dim MyImage as image=image.FromFile(MyFileName)
g=Me.Panel1.CreateGraphics()
g.SmoothingMode=System.Drawing.Drawing2D.SmoothingMode.AntiAlias
MyBrush=new TextureBrush(MyImage)
dim MyColor as Color=Color.LightGray
g.FillRectangle(MyBrush,Me.Panel1.ClientRectangle)
for i as Integer=0 To 255-1 step +1
g.FillRectangle(new SolidBrush(Color.FromArgb(i,MyColor)),Me.Panel1.ClientRectangle)
System.Threading.Thread.Sleep(100)
Next
Catch ex as Exception
MessageBox.Show(ex.Message,"信息提示",MessageBoxButton.OK,MessageBoxIcon.Information)
End Try
里面有些大小没区分,写的时候注意吧!不懂可以问我!
#3
jiutian19812009-10-26 11:31
其实,不是的。设置透明度比较简单。通过修改图像fromargb(alpha,r,g,b)即可。
1