作者shengolj (完蛋了)
看板SCU_CIS-92A
標題台客
時間Fri Oct 27 14:35:57 2006
Public Class Form1
Private files() As String
Private fileIndex As Integer = 0
Private Sub 開啟舊檔ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 開啟舊檔ToolStripMenuItem.Click
OpenFile()
End Sub
Private Sub OpenFile()
OpenFileDialog1.Title = "開啟圖形檔案"
OpenFileDialog1.Filter = "Image Files|*.jpg;*.png;*.gif;*.bmp|All files|*.*"
OpenFileDialog1.Multiselect = True
If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
files = OpenFileDialog1.FileNames
fileIndex = 0
ShowFile()
End If
End Sub
Private Sub ShowFile()
If files Is Nothing Then
Return
End If
Dim filename As String = files(fileIndex)
Try
PictureBox1.Image = Image.FromFile(filename)
statusinfo.Text = filename
statussize.Text = String.Format(" {0:#} x {1:#} ", PictureBox1.Image.Width, PictureBox1.Image.VerticalResolution) '顯示圖片的長跟寬 #一般的數字
Catch ex As Exception
statusinfo.Text = ex.Message
End Try
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'檢視VToolStripMenuItem.DropDown =
Dim sizemodes() As String
sizemodes = System.Enum.GetNames(GetType(PictureBoxSizeMode))
ToolStripComboBox1.Items.AddRange(sizemodes)
'ImageToolStripMenuItem
For Each f As String In sizemodes
ImageToolStripMenuItem.DropDownItems.Add(f)
ImageToolStripMenuItem1.DropDownItems.Add(f)
Next
End Sub
Private Sub ToolStripComboBox1_DropDownClosed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripComboBox1.DropDownClosed
Dim selected As String = ToolStripComboBox1.SelectedItem
Dim mode As PictureBoxSizeMode
mode = DirectCast(System.Enum.Parse(GetType(PictureBoxSizeMode), selected), PictureBoxSizeMode)
PictureBox1.SizeMode = mode
End Sub
End Class
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 163.14.5.94
推 pizwu:water...那我要建三小... 10/27 14:38
→ shengolj:要建得太多了 就放空城巴 10/27 14:41