25 Mart 2013 Pazartesi
WEB BROWSERDEN RESİM ALMAK
Kodlarını ..........................................
İNDİR
Sadece EXE programını......................
.
İNDİR
Imports System.Runtime.InteropServices Imports System.IO 'Imports System.Drawing Imports System.Drawing.Imaging Public Class Form1 Private Const WM_DRAWCLIPBOARD As Integer = &H308 Private Const WM_CHANGECBCHAIN As Integer = &H30D Private mNextClipBoardViewerHWnd As IntPtr Private Event OnClipboardChanged()
_ Private Shared Function SetClipboardViewer(ByVal hWnd As IntPtr) As IntPtr End Function
_ Private Shared Function ChangeClipboardChain(ByVal hWnd As IntPtr, ByVal hWndNext As IntPtr) As _
Boolean End Function
_ Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As IntPtr, _ ByVal lParam As IntPtr) As IntPtr End Function Protected Overrides Sub WndProc(ByRef m As Message) Select Case m.Msg Case WM_DRAWCLIPBOARD RaiseEvent OnClipboardChanged() SendMessage(mNextClipBoardViewerHWnd, m.Msg, m.WParam, m.LParam) Case WM_CHANGECBCHAIN If m.WParam.Equals(mNextClipBoardViewerHWnd) Then mNextClipBoardViewerHWnd = m.LParam Else SendMessage(mNextClipBoardViewerHWnd, m.Msg, m.WParam, m.LParam) End If End Select MyBase.WndProc(m) End Sub Private Sub ClipBoardChanged() If My.Computer.Clipboard.ContainsText Then If Uri.IsWellFormedUriString(My.Computer.Clipboard.GetText, UriKind.Absolute) Then TextBox1.Text = My.Computer.Clipboard.GetText TextBox1.Focus() Me.Activate() End If End If End Sub Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) Handles Me.FormClosing ChangeClipboardChain(Me.Handle, mNextClipBoardViewerHWnd) End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load mNextClipBoardViewerHWnd = SetClipboardViewer(Me.Handle) AddHandler Me.OnClipboardChanged, AddressOf ClipBoardChanged End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click PictureBox1.ImageLocation = TextBox1.Text End Sub Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged BtnSakla.Enabled = True Button1.Enabled = True Button1.PerformClick() End Sub Private Sub PictureBox1_Resize(sender As System.Object, e As System.EventArgs) Handles PictureBox1.Resize EnTxt.Text = PictureBox1.Width BoyTxt.Text = PictureBox1.Height Panel1.Width = PictureBox1.Width Panel1_Resize(sender, e) Me.Width = EnTxt.Text.ToString Me.Height = BoyTxt.Text.ToString + 100 End Sub Private Sub BtnSakla_Click(sender As System.Object, e As System.EventArgs) Handles BtnSakla.Click Try Dim saveDLG As SaveFileDialog = New SaveFileDialog saveDLG.Filter = "Resim Dosyaları (*.bmp, *.gif, *.jpg,*.png|*.bmp;*.gif;*.jpg;*.png" If saveDLG.ShowDialog = DialogResult.OK Then If saveDLG.FileName.EndsWith("bmp") Then PictureBox1.Image.Save(saveDLG.FileName, ImageFormat.Bmp) ElseIf saveDLG.FileName.EndsWith("gif") Then PictureBox1.Image.Save(saveDLG.FileName, ImageFormat.Gif) ElseIf saveDLG.FileName.EndsWith("png") Then PictureBox1.Image.Save(saveDLG.FileName, ImageFormat.Png) Else PictureBox1.Image.Save(saveDLG.FileName, ImageFormat.Jpeg) End If saveDLG.Dispose() End If Catch exc As Exception MessageBox.Show(exc.Message, " Hata", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub Private Sub Panel1_Resize(sender As System.Object, e As System.EventArgs) Handles Panel1.Resize BtnSakla.Left = Panel1.Width - BtnSakla.Width - 21 Button1.Left = Panel1.Width - Button1.Width - 21 TextBox1.Width = Panel1.Width - BtnSakla.Width - 25 End Sub End Class
Sonraki Kayıt
Önceki Kayıt
Ana Sayfa