大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
Public Class Form1
成都创新互联公司主营玉州网站建设的网络公司,主营网站建设方案,重庆APP软件开发,玉州h5微信小程序搭建,玉州网站营销推广欢迎玉州等地区企业咨询
Private TPS As Integer
Private TPPath() As String '定义不确定元素个数组,及动态数组
Private Sub LoadPhoto()
'将图片路径及图片名加载到数组
Dim JS As Integer '计数用
For Each foundFile As String In My.Computer.FileSystem.GetFiles(CurDir() "\职员图片")
TPS = TPS + 1 '将图片数存入变量中
Next
ReDim TPPath(TPS - 1) '确定数组大小
For Each FoundFile As String In My.Computer.FileSystem.GetFiles(CurDir() "\职员图片")
'将图片路径存入数组
TPPath(JS) = FoundFile
JS = JS + 1
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LoadPhoto()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = TPPath.Length '获取数组大小
Label1.Text = TPPath(1) '获取数组中第2个元素的值
End Sub
在自定义工具箱中选择dirlistbox,drivelistbox,filelistbox,添加这3个控件,然后在窗体上添加这些控件和一个picturebox控件,代码如下:
Public Class Form1
Private Sub DirListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DirListBox1.SelectedIndexChanged
FileListBox1.Path = DirListBox1.Path
End Sub
Private Sub DriveListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DriveListBox1.SelectedIndexChanged
DirListBox1.Path = DriveListBox1.Drive
End Sub
Private Sub FileListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles FileListBox1.SelectedIndexChanged
PictureBox1.Image = Image.FromFile(FileListBox1.Path + "\" + FileListBox1.SelectedItem.ToString())
End Sub
End Class
你可以自己在修改下,这只是个模型,呵呵!
'没办法,需的把窗口隐藏一下,还的隐藏后延迟一下再截图。
Dim WithEvents Timer1 As New Timer With {.Interval = 30, .Enabled = False}
Dim Imgrect As Rectangle
Dim img As Bitmap
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Imgrect = Me.RectangleToScreen(Me.ClientRectangle)
img = New Bitmap(Imgrect.Width, Imgrect.Height)
Me.Hide()
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Stop()
Graphics.FromImage(img).CopyFromScreen(Imgrect.X, Imgrect.Y, 0, 0, Imgrect.Size)
Me.BackgroundImage = img
Me.Show()
End Sub
INTOUCH自带的就有,打印屏幕的命令
自己写个时间条件运行那命令就可以了
PRINTSCREEN这个命令 具体怎么用 看下帮助
希望我的回答对你有所帮助
如有其他问题,可以继续追问,您的采纳是我前进的动力!
窗体上放一个PictureBox,两个CommandButton,一个FileListBox
Private Sub Command1_Click()
If File1.ListIndex = 0 Then
ShowPic File1.ListCount - 1
Else
ShowPic File1.ListIndex - 1
End If
End Sub
Private Sub Command2_Click()
If File1.ListIndex = File1.ListCount - 1 Then
ShowPic 0
Else
ShowPic File1.ListIndex + 1
End If
End Sub
Private Sub Form_Load()
File1.Visible = False
File1.Pattern = "*.jpg;*.gif" '可以浏览的文件类型,使用分号隔开
File1.Path = App.Path '改成你需要浏览的目录,比如"C:\Pic"
If File1.ListCount 1 Then '目录中图片在两张以上可以浏览
ShowPic 0
Exit Sub
ElseIf File1.ListCount = 1 Then '目录中只有一张图片时只显示这一张
ShowPic 0
End If
Command1.Enabled = False
Command2.Enabled = False
End Sub
Private Sub ShowPic(Index As Long)
File1.ListIndex = Index
Picture1.Picture = LoadPicture(File1.Path "\" File1.List(Index))
End Sub
如果对您有帮助,请记得采纳为满意答案,谢谢!祝您生活愉快!
vaela
我说选把打开多个图片路径加载到一个listbox里,利用listbox写代码
Private Sub picbox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
If ListBox1.SelectedIndex = count Then
Try
ListBox1.SelectedIndex = ListBox1.SelectedIndex + 1
Catch
ListBox1.SelectedIndex = 0
End Try
End If
picbox.Image = ListBox1.SelectedItem.ToString
End Sub