读书人

求vb小实例解决方案

发布时间: 2012-01-10 21:26:51 作者: rapoo

求vb小实例
大家好,初次接触vb。学校要求期末的拿出像样的作品。但不知道vb具体可以做些什么,请大家给我一些小的应用实例,要适合初学者。感谢大家!

[解决办法]
VB简单看图程序:

VB code
Option ExplicitPrivate Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As LongConst Srccopy = &HCC0020Private Sub Command1_Click() CommonDialog1.ShowOpen bakPic.Picture = LoadPicture(CommonDialog1.FileName)   Dim wScale As Double Dim hScale As Double   Dim newWidth As Double Dim newHeight As Double  Dim newLeft As Double Dim newTop As Double   wScale = Picture1.Width / bakPic.Width  hScale = Picture1.Height / bakPic.Height    If wScale > hScale Then     newWidth = bakPic.Width * hScale      newHeight = bakPic.Height * hScale  Else    newWidth = bakPic.Width * wScale     newHeight = bakPic.Height * wScale  End If  newLeft = (Picture1.Width - newWidth) / 2  newTop = (Picture1.Height - newHeight) / 2  Picture1.Cls    StretchBlt Picture1.hdc, newLeft, newTop, newWidth, newHeight, bakPic.hdc, 0, 0, bakPic.ScaleWidth, bakPic.ScaleHeight, Srccopy  Picture1.RefreshEnd SubPrivate Sub Form_Load() bakPic.AutoRedraw = True bakPic.Visible = False Me.ScaleMode = 3 Picture1.ScaleMode = 3 bakPic.ScaleMode = 3End Sub
[解决办法]
网上太多了,搜一下就都有了!
[解决办法]
visdata,VB自带的例子,学VB就是因为看了visdata之后才开始的。
[解决办法]
到学校图书馆光盘下载里找vb有很多源代码……

读书人网 >VB

热点推荐