VB中图像显示特效五例
#1?牐犚弧⒈喑淘?
?牐犚雇枷褚徊糠忠徊糠值叵允境隼矗托枰劝淹枷穹指畛扇舾煽椋缓蟀瓷杓频姆绞揭来蜗允境隼础T赩B中有Pictureclip控件,利用它可以将图像分割成若干行和列,然后使用PaintPicture方法显示到Picture控件上。
#1?牐牰⒊绦虼?
?牐犑紫茸急敢徽磐计笃涑ず涂砭?100的倍数,以方便我们分割。然后在窗体上放置一个Picture控件(Visible=False)、一个Pictureclip控件和一个Image控件。
?牐燨ption Explicit
?牐燚im i As Integer
?牐燩rivate Sub Form_Load()'主程序
?牐燫andomize
?牐燩icture1.Height = Image1.Height
?牐燩icture1.Width = Image1.Width
?牐燩ictureClip1.Picture = Image1.Picture
?牐燛nd Sub
?牐燬ub ys()'延时子程序
?牐燚im k As Integer
?牐燜or k = 0 To 30000
?牐燦ext
?牐燛nd Sub
?牐?1.从左到右显示
?牐燩rivate Sub Command1_Click()??
?牐燩icture1.Cls '清除Picture1中的图像
?牐燩ictureClip1.Cols = 100 '分割列数
?牐燩ictureClip1.Rows = 1 '分割行数
?牐燜or i = 0 To 99
?牐爕s '延时
?牐燩icture1.PaintPicture PictureClip1.GraphicCell(i), Picture1.Width / 100*(i),0
?牐燦ext
?牐燛nd Sub
?牐?2.从上到下显示
?牐燩rivate Sub Command2_Click()
?牐燩icture1.Cls
?牐燩ictureClip1.Cols = 1
?牐燩ictureClip1.Rows = 100
?牐燜or i = 0 To 99
?牐爕s
?牐燩icture1.PaintPicture PictureClip1.GraphicCell(i),0,Picture1.Height/100*(i)??
?牐燦ext
?牐燛nd Sub
?牐?3.从中间向两边伸展显示
?牐燩rivate Sub Command3_Click()?煟?
?牐燩icture1.Cls
?牐燩ictureClip1.Cols = 100
?牐燩ictureClip1.Rows = 1
?牐燜or i = 0 To 49
?牐爕s
?牐燩icture1.PaintPicture PictureClip1.GraphicCell(i+50),Picture1.Width/100*(i + 50),0
?牐燩icture1.PaintPicture PictureClip1.GraphicCell(49-i),Picture1.Width/100*(49-i),0
?牐燦ext
?牐燛nd Sub
?牐?4.水平百叶窗方式显示
?牐燩rivate Sub Command4_Click()?煟?
?牐燩icture1.Cls
?牐燩ictureClip1.Cols = 1
?牐燩ictureClip1.Rows = 100
?牐燚im j As Integer
?牐燜or i = 1 To 10
?牐燜or j = 1 To 10
?牐爕s
?牐燩icture1.PaintPicture PictureClip1.GraphicCell((j - 1)) * 10 + i - 1), 0, Image1.Height / 100*((j - 1)* 10 + i - 1)??
?牐燦ext
?牐燦ext
?牐燛nd Sub
?牐?5.以马赛克方式显示
?牐燩rivate Sub Command5_Click?煟?
?牐燩icture1.Cls
?牐燩ictureClip1.Cols=10
?牐燩ictureClip1.Rows=10
?牐燚im temp(99) As Integer '定义数组
?牐燚im j As Integer
?牐爐emp(0) = Int(Rnd*100)'随机产生100个0到99之间不重复的数
?牐燜or i = 1 To 99
?牐燼0:temp(i) = Int(Rnd*100)??
?牐燜or j = 0 To i - 1
?牐營f temp(i) = temp(j) Then GoTo a0
?牐燦ext
?牐燦ext
?牐燜or i = 0 To 99 '根据随机数显示
?牐爕s
?牐燩icture1.PaintPicture PictureClip1.GraphicCell(temp(i)), Picture1.Width / 10*(temp(i) Mod 10),Image1.Height/10*(temp(i)\10)??
?牐燦ext
?牐燛nd Sub
?牐犜趺囱亢芩桑±谜飧鲈恚箍梢允迪帧按佑业阶蟆薄ⅰ按酉碌缴稀薄ⅰ按恿奖呦蛑屑浔蘸稀薄ⅰ按怪卑僖洞啊薄ⅰ拔行绞健钡认允痉绞健?愕哪越睿迪指嗝烂畹南允痉绞桨桑。?