网站建设资讯

NEWS

网站建设资讯

vb.net浏览器截图,vb 截图

在vb.net下怎么制作一个图片浏览器,根据用户选择的文件夹,程序自动搜索改文件夹下的图片文件。

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

怎样用vb.net做一个图片浏览器?

在自定义工具箱中选择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

你可以自己在修改下,这只是个模型,呵呵!

VB.net点击按钮后截图,截取被当前窗体挡住的图像作为窗体背景(窗体默认无边框样式)

'没办法,需的把窗口隐藏一下,还的隐藏后延迟一下再截图。

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

vb.net 2008 如何将指定的窗体截图并保存

INTOUCH自带的就有,打印屏幕的命令

自己写个时间条件运行那命令就可以了

PRINTSCREEN这个命令 具体怎么用 看下帮助

希望我的回答对你有所帮助

如有其他问题,可以继续追问,您的采纳是我前进的动力!

用vb.net如何编写图片浏览器的基本步骤功能是:图片的打开、显示、缩放、旋转。

窗体上放一个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

vb.net编写一个照片浏览器程序,程序执行时单击下一张,将会显示下一张照片

我说选把打开多个图片路径加载到一个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


文章题目:vb.net浏览器截图,vb 截图
分享路径:http://cdweb.net/article/hoogih.html