ImageBitmap = New Bitmap(PictureBox1.ImageLocation)'提示参数无效,求教为何,谢谢!!!

msdn165168 2010-10-08 03:29:29
Public Class Form2

Dim ImageBitmap As Bitmap
Dim gra As Graphics

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TrackBar1.Maximum = 100
TrackBar1.Value = 100
TrackBar1.TickFrequency = 10
PictureBox1.ImageLocation = "C:\Documents and Settings\YangJun\My Documents\My Pictures\白羊座.jpeg"
ImageBitmap = New Bitmap(PictureBox1.ImageLocation)'提示参数无效,求教为何,谢谢!!!
End Sub

Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
PictureBox1.Refresh()
End Sub

Private Sub PictureBox1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
gra = e.Graphics
gra.Clear(Color.White)

Dim cm As System.Drawing.Imaging.ColorMatrix = New System.Drawing.Imaging.ColorMatrix()
cm.Matrix00 = 1
cm.Matrix11 = 1
cm.Matrix22 = 1
cm.Matrix44 = 1
cm.Matrix33 = CType(TrackBar1.Value / 100, Single) ' 調 alpha 值
Dim ia As System.Drawing.Imaging.ImageAttributes = New System.Drawing.Imaging.ImageAttributes()
ia.SetColorMatrix(cm)
gra.DrawImage(ImageBitmap, New Rectangle(0, 0, ImageBitmap.Width, ImageBitmap.Height), 0, 0, ImageBitmap.Width, ImageBitmap.Height, GraphicsUnit.Pixel, ia)

End Sub
End Class
...全文
360 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
msdn165168 2010-10-08
  • 打赏
  • 举报
回复
求助!!!
PictureBox1.ImageLocation = ‘只能指定bmp图片,我想加载其它格式图片,Dim ImageBitmap As Bitmap 该如何改,谢谢!!!

ImageBitmap = New Bitmap(PictureBox1.ImageLocation)
msdn165168 2010-10-08
  • 打赏
  • 举报
回复
谢谢!!!
想设置PictureBox1透明度。
兔子-顾问 2010-10-08
  • 打赏
  • 举报
回复
如果想复制
ImageBitmap = Ctype(PictureBox1.Image.Clone(),Bitmap)
兔子-顾问 2010-10-08
  • 打赏
  • 举报
回复
你想干嘛,定义个一样大小的?
ImageBitmap = New Bitmap(PictureBox1.Image.Size)

16,722

社区成员

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

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