Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports Google.API.Search
- Imports System.Drawing.Imaging
- Public Class MainForm
- Private Sub btnSearch_Click(sender As Object, e As EventArgs) Handles btnSearch.Click
- If txtRequest.Text = "" Then
- MsgBox("Ты ж даже ничего не задал!", MsgBoxStyle.Critical, "*_*")
- Else
- Try
- Dim Engine As New GimageSearchClient("") ' Создаём переменную с новым классом
- Picture.ImageLocation = Engine.Search(txtRequest.Text, 1).Item(0).Url ' Наполняем PictureBox картинкой
- btnSave.Enabled = True
- If cbCopyLink.Checked Then
- Clipboard.SetText(Picture.ImageLocation)
- End If
- Catch ex As Net.WebException
- MsgBox("И как ты собираешься искать? Без интернета?!", MsgBoxStyle.Critical, "*_*")
- End Try
- End If
- End Sub
- Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
- SaveFile.Filter = "Все файлы|*.*"
- If Picture.Image.RawFormat.Equals(ImageFormat.Bmp) Then
- SaveFile.Filter = "BMP|*.bmp"
- End If
- If Picture.Image.RawFormat.Equals(ImageFormat.Emf) Then
- SaveFile.Filter = "EMF|*.emf"
- End If
- If Picture.Image.RawFormat.Equals(ImageFormat.Exif) Then
- SaveFile.Filter = "EXIF|*.exif"
- End If
- If Picture.Image.RawFormat.Equals(ImageFormat.Gif) Then
- SaveFile.Filter = "GIF|*.gif"
- End If
- If Picture.Image.RawFormat.Equals(ImageFormat.Icon) Then
- SaveFile.Filter = "Icon|*.ico"
- End If
- If Picture.Image.RawFormat.Equals(ImageFormat.Jpeg) Then
- SaveFile.Filter = "JPEG|*.jpg"
- End If
- If Picture.Image.RawFormat.Equals(ImageFormat.Png) Then
- SaveFile.Filter = "PNG|*.png"
- End If
- If Picture.Image.RawFormat.Equals(ImageFormat.Tiff) Then
- SaveFile.Filter = "TIFF|*.tiff"
- End If
- If Picture.Image.RawFormat.Equals(ImageFormat.Wmf) Then
- SaveFile.Filter = "WMF|*.wmf"
- End If
- If SaveFile.ShowDialog = Windows.Forms.DialogResult.OK Then
- Picture.Image.Save(SaveFile.FileName)
- End If
- End Sub
- Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
- MsgBox("ЙОУ, САВОК СНОВА В ДЕЛЕ!", MsgBoxStyle.Exclamation, "*_*")
- End Sub
- Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- If My.Computer.Network.IsAvailable = False Then
- MsgBox("И как ты собираешься искать? Без интернета?!", MsgBoxStyle.Critical, "*_*")
- End
- End If
- End Sub
- Private Sub Picture_Click(sender As Object, e As EventArgs) Handles Picture.Click
- PicturePreview.PictureBox1.Image = Picture.Image
- PicturePreview.ShowDialog()
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement