'在窗体上加入控件Picture1(AutoSize=True),command1,然后复制下面代码,修改其中的文件名,运行即可:
Option Explicit
Private Declare Function GetDIBits Lib "gdi32 " (ByVal hdc As Long, ByVal hBitmap As Long, ByVal nStartScan As Long, ByVal nNumScans As Long, lpBits As Any, lpBI As BITMAPINFO, ByVal wUsage As Long) As Long
Private Declare Function StretchDIBits Lib "gdi32 " (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal dX As Long, ByVal dy As Long, ByVal SrcX As Long, ByVal SrcY As Long, ByVal SrcWidth As Long, ByVal SrcHeight As Long, lpBits As Any, lpBitsInfo As BITMAPINFO, ByVal wUsage As Long, ByVal dwRop As Long) As Long
Private Declare Function GetObjectAPI Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
Private Type BITMAP
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
Private Type RGBQUAD
rgbBlue As Byte
rgbGreen As Byte
rgbRed As Byte
rgbAlpha As Byte
End Type
Private Type BITMAPINFOHEADER
bmSize As Long
bmWidth As Long
bmHeight As Long
bmPlanes As Integer
bmBitCount As Integer
bmCompression As Long
bmSizeImage As Long
bmXPelsPerMeter As Long
bmYPelsPerMeter As Long
bmClrUsed As Long
bmClrImportant As Long
End Type
Private Type BITMAPINFO
bmHeader As BITMAPINFOHEADER
bmColors(0 To 255) As RGBQUAD
End Type
Private bm As BITMAP
Private bmi As BITMAPINFO
Private bmLen As Long
Private Sub Class_Initialize()
bmLen = Len(bm)
bmibmHeaderbmSize = 40
bmibmHeaderbmPlanes = 1
bmibmHeaderbmBitCount = 24
bmibmHeaderbmCompression = 0
End Sub
Private Function GetImageWidth(SrcPictureBox As PictureBox) As Long
GetObjectAPI SrcPictureBoxImage, bmLen, bm
GetImageWidth = bmbmWidth - 1
End Function
Private Function GetImageHeight(SrcPictureBox As PictureBox) As Long
GetObjectAPI SrcPictureBoxImage, bmLen, bm
GetImageHeight = bmbmHeight
End Function
Private Sub GetImageData(SrcPictureBox As PictureBox, ImageData() As Byte)
GetObjectAPI SrcPictureBoxImage, bmLen, bm
ReDim ImageData(0 To 2, 0 To bmbmWidth - 1, 0 To bmbmHeight)
bmibmHeaderbmWidth = bmbmWidth
bmibmHeaderbmHeight = bmbmHeight
GetDIBits SrcPictureBoxhdc, SrcPictureBoxImage, 0, bmbmHeight, ImageData(0, 0, 0), bmi, 0
End Sub
Private Sub Command1_Click()
Dim X As Long, Y As Long, Js As Long
Dim iArray() As Byte
Dim r As Long, g As Long, b As Long, RGB As Long
Dim TempWidth As Long, TempHeight As Long
Picture1 = LoadPicture("c:\1bmp") '读入文件,请修改
If bmibmHeaderbmSize = 0 Then Class_Initialize
'将读到数组中
GetImageData Picture1, iArray()
'取得宽高
TempWidth = GetImageWidth(Picture1)
TempHeight = GetImageHeight(Picture1)
For X = 0 To TempWidth
For Y = 0 To TempHeight
iArray(1, X, Y) = g
If g < 100 Then Js = Js + 1 'G值小于100的点的计数
Next
Next
Erase iArray
MsgBox "G值小于100的点的有" & Js & "个"
End Sub
先说一下:
1)添加用户管理和权限设置的功能;(2)界面美观, *** 作方便;(3)数据导入和导出功能(excel文档)
这几个要求都不难,全新做也就1,2天就搞定了,但是打印功能就闹心了,先说一下,VB里面调用OFFICE的打印功能是可以的,但是会打印出神马结果就不好说了,反正很闹心,我当初是自己调用的打印函数自己编的打印部分,全部弄好,弄了快半个月,期间,浪费打印纸1包以上。。所以呢。。看看吧,如果乃真想弄这个,劝你自己搞吧,而且作为还可以顺势写给论文什么的
计算机专业类包括计算机科学与技术、软件工程、网络工程、信息安全等七八个专业。
计算机专业学习的课程主要有大数据技术导论、数据采集与处理实践(Python)、Web前/后端开发、统计与数据分析、机器学习、高级数据库系统、数据可视化、云计算技术、人工智能、自然语言处理、
媒体大数据案例分析、网络空间安全、计算机网络、数据结构、软件工程、 *** 作系统等,以及大数据方向系列实验,并完成程序设计、数据分析、机器学习、数据可视化、大数据综合应用实践、专业实训和毕业设计等多种实践环节。
以上就是关于询问VB中的一个问题,有关image全部的内容,包括:询问VB中的一个问题,有关image、用VB加上SQL或者ACESS做一个学生成绩管理程序。是学校VB大作业不要太高深。发到我的邮箱1027595443@qq.com、计算机专业都学什么呢等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)