Public Class Form1 Inherits Form 'フォームがコンポーネントの一覧をクリーンアップするために dispose をオーバーライドします。 _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) If disposing AndAlso components IsNot Nothing Then components.Dispose() End If MyBase.Dispose(disposing) End Sub Private WithEvents openFileDialog1 As System.Windows.Forms.OpenFileDialog Private WithEvents textBoxPath As System.Windows.Forms.TextBox Private WithEvents pictureBox1 As System.Windows.Forms.PictureBox Private WithEvents buttonReference As System.Windows.Forms.Button Private WithEvents buttonShow As System.Windows.Forms.Button 'Windows フォーム デザイナで必要です。 Private components As System.ComponentModel.IContainer 'メモ: 以下のプロシージャは Windows フォーム デザイナで必要です。 'Windows フォーム デザイナを使用して変更できます。 'コード エディタを使って変更しないでください。 _ Private Sub InitializeComponent() Me.openFileDialog1 = New System.Windows.Forms.OpenFileDialog Me.textBoxPath = New System.Windows.Forms.TextBox Me.pictureBox1 = New System.Windows.Forms.PictureBox Me.buttonReference = New System.Windows.Forms.Button Me.buttonShow = New System.Windows.Forms.Button CType(Me.pictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'openFileDialog1 ' Me.openFileDialog1.FileName = "openFileDialog1" ' 'textBoxPath ' Me.textBoxPath.Location = New System.Drawing.Point(12, 13) Me.textBoxPath.Name = "textBoxPath" Me.textBoxPath.Size = New System.Drawing.Size(221, 19) Me.textBoxPath.TabIndex = 7 Me.textBoxPath.Text = "C:\WINDOWS\system32\notepad.exe" ' 'pictureBox1 ' Me.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D Me.pictureBox1.Location = New System.Drawing.Point(13, 76) Me.pictureBox1.Name = "pictureBox1" Me.pictureBox1.Size = New System.Drawing.Size(267, 179) Me.pictureBox1.TabIndex = 6 Me.pictureBox1.TabStop = False ' 'buttonReference ' Me.buttonReference.Location = New System.Drawing.Point(239, 11) Me.buttonReference.Name = "buttonReference" Me.buttonReference.Size = New System.Drawing.Size(41, 23) Me.buttonReference.TabIndex = 4 Me.buttonReference.Text = "参照..." Me.buttonReference.UseVisualStyleBackColor = True ' 'buttonShow ' Me.buttonShow.Location = New System.Drawing.Point(62, 47) Me.buttonShow.Name = "buttonShow" Me.buttonShow.Size = New System.Drawing.Size(168, 23) Me.buttonShow.TabIndex = 5 Me.buttonShow.Text = "アイコンのビットマップを表示..." Me.buttonShow.UseVisualStyleBackColor = True ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(292, 266) Me.Controls.Add(Me.textBoxPath) Me.Controls.Add(Me.pictureBox1) Me.Controls.Add(Me.buttonReference) Me.Controls.Add(Me.buttonShow) Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "Form1" Me.Text = "Form1" CType(Me.pictureBox1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() End Sub Sub New() InitializeComponent() End Sub Private Sub buttonReference_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonReference.Click openFileDialog1.FileName = textBoxPath.Text Dim ret As DialogResult = openFileDialog1.ShowDialog() If ret = System.Windows.Forms.DialogResult.OK Then textBoxPath.Text = openFileDialog1.FileName End If End Sub Private Sub buttonShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttonShow.Click Dim path As String = textBoxPath.Text Dim appIcon As Icon = System.Drawing.Icon.ExtractAssociatedIcon(path) pictureBox1.Image = appIcon.ToBitmap() End Sub End Class