Public Class Form1
Private Sub upld_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles upld_btn.Click
Dim open_file As New OpenFileDialog
open_file.Filter = "Pictures Files| *.bmp;*.jpg;*.gif;*.wmf;*.tif;*.png"
Try
If open_file.ShowDialog() = DialogResult.OK Then
picture_bx1.Image = Image.FromFile(open_file.FileName)
Else
MsgBox("Please select a picture", vbInformation, "Pictures Files")
End If
Catch ex As Exception
MsgBox(ex.Message, vbCritical, "Pictures Files")
End Try
End Sub
'////////////////////////////////////////////////////// GetPixel ////////////////////////////////////////////////////////////////////////////////////////////
Private Sub get_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles get_btn.Click
'ต้องเริ่มจับเวลาตรงนี้
Dim Image_1 As New Bitmap(picture_bx1.Image)
Dim Px1 As Integer
Dim Py1 As Integer
Dim Image_1_Pixel(Image_1.Width, Image_1.Height) As Color
For Px1 = 0 To Image_1.Width - 1 Step 1
For Py1 = 0 To Image_1.Height - 1 Step 1
Image_1_Pixel(Px1, Py1) = Image_1.GetPixel(Px1, Py1)
Next
Next
'แล้วหยุดการจับเวลาตรงนี้
End Sub
End Class
Private Sub get_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles get_btn.Click
Dim dateStart as datetime
Dim dateStop as datetime
'ต้องเริ่มจับเวลาตรงนี้
dateStart=Now
Dim Image_1 As New Bitmap(picture_bx1.Image)
Dim Px1 As Integer
Dim Py1 As Integer
Dim Image_1_Pixel(Image_1.Width, Image_1.Height) As Color
For Px1 = 0 To Image_1.Width - 1 Step 1
For Py1 = 0 To Image_1.Height - 1 Step 1
Image_1_Pixel(Px1, Py1) = Image_1.GetPixel(Px1, Py1)
Next
Next
'แล้วหยุดการจับเวลาตรงนี้
dateStop=Now
Msgbox(datediff("s",dateStart,dateStop))
End Sub