質問編集履歴
4
理解しました。バッククォートで囲みました。教えてくださりありがとうございます。よろしくお願いします。
test
CHANGED
File without changes
|
test
CHANGED
@@ -11,8 +11,8 @@
|
|
11
11
|
↓
|
12
12
|
Saveボタンでファイルダイアログを開きピクチャーボックスに表示されている画像を保存する。この時ファイル名は現在の日付。 例)0728.jpg
|
13
13
|
|
14
|
-
|
14
|
+
```
|
15
|
-
|
15
|
+
Public Class Form1
|
16
16
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Load.Click
|
17
17
|
Dim ofd As New OpenFileDialog
|
18
18
|
ofd.Filter = "JPG" & "|" & "*.jpg" & "|" & "PNG" & "|" & "*.png" & "|" & "GIF" & "|" & "*.gif" & "|" & "BMP" & "|" & "*.bmp" ' 読込むファイルの種類を設定
|
@@ -30,10 +30,10 @@
|
|
30
30
|
End If
|
31
31
|
|
32
32
|
End Sub
|
33
|
-
End Class
|
33
|
+
End Class
|
34
34
|
|
35
35
|
|
36
|
-
|
36
|
+
```
|
37
37
|
現在Saveボタンでファイルダイアログを開いたあと、画像を選択して名前を
|
38
38
|
入力しなければ保存ができない状態になっています。そのため上記の動作
|
39
39
|
をさせるためのプログラムや方法をご教示ください。よろしくお願いいたします。
|
3
バッククォートでインデントいたしました。教えてくださりありがとうございます!よろしくお願いいたします。
test
CHANGED
File without changes
|
test
CHANGED
@@ -11,11 +11,31 @@
|
|
11
11
|
↓
|
12
12
|
Saveボタンでファイルダイアログを開きピクチャーボックスに表示されている画像を保存する。この時ファイル名は現在の日付。 例)0728.jpg
|
13
13
|
|
14
|
+
|
15
|
+
```Public Class Form1
|
16
|
+
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Load.Click
|
17
|
+
Dim ofd As New OpenFileDialog
|
18
|
+
ofd.Filter = "JPG" & "|" & "*.jpg" & "|" & "PNG" & "|" & "*.png" & "|" & "GIF" & "|" & "*.gif" & "|" & "BMP" & "|" & "*.bmp" ' 読込むファイルの種類を設定
|
19
|
+
If ofd.ShowDialog() = DialogResult.OK Then ' ファイルダイアログを開く。
|
14
|
-
|
20
|
+
PictureBox1.SizeMode = PictureBoxSizeMode.Zoom ' PicturaBox1に表示される画像を比率を変えずに表示
|
21
|
+
PictureBox1.Image = Image.FromFile(ofd.FileName) ' PictureBox1に選択された画像ファイルを表示
|
22
|
+
End If
|
23
|
+
End Sub
|
24
|
+
|
25
|
+
Private Sub Save_Click(sender As Object, e As EventArgs) Handles Save.Click
|
26
|
+
Dim sfd As New SaveFileDialog ' 各パラメータを設定していきます
|
27
|
+
sfd.Filter = "JPG" & "|" & "*.jpg" & "|" & "PNG" & "|" & "*.png" & "|" & "GIF" & "|" & "*.gif" & "|" & "BMP" & "|" & "*.bmp"
|
28
|
+
If sfd.ShowDialog() = DialogResult.OK Then ' ファイルダイアログを開く。
|
29
|
+
PictureBox1.Image.Save(sfd.FileName, Imaging.ImageFormat.Jpeg)
|
30
|
+
End If
|
31
|
+
|
32
|
+
End Sub
|
33
|
+
End Class```
|
34
|
+
|
35
|
+
|
36
|
+
|
15
37
|
現在Saveボタンでファイルダイアログを開いたあと、画像を選択して名前を
|
16
38
|
入力しなければ保存ができない状態になっています。そのため上記の動作
|
17
39
|
をさせるためのプログラムや方法をご教示ください。よろしくお願いいたします。
|
18
40
|
|
19
|
-
|
20
|
-
|
21
41
|

|
2
スクリーンショットは添付しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -11,29 +11,11 @@
|
|
11
11
|
↓
|
12
12
|
Saveボタンでファイルダイアログを開きピクチャーボックスに表示されている画像を保存する。この時ファイル名は現在の日付。 例)0728.jpg
|
13
13
|
|
14
|
-
|
14
|
+

|
15
15
|
現在Saveボタンでファイルダイアログを開いたあと、画像を選択して名前を
|
16
16
|
入力しなければ保存ができない状態になっています。そのため上記の動作
|
17
17
|
をさせるためのプログラムや方法をご教示ください。よろしくお願いいたします。
|
18
18
|
|
19
|
-
’’’Public Class Form1
|
20
|
-
’’’Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Load.Click
|
21
|
-
’’’Dim ofd As New OpenFileDialog
|
22
|
-
’’’ofd.Filter = "JPG" & "|" & "*.jpg" & "|" & "PNG" & "|" & "*.png" & "|" & "GIF" & "|" & "*.gif" & "|" & "BMP" & "|" & "*.bmp" ' 読込むファイルの種類を設定
|
23
|
-
’’’If ofd.ShowDialog() = DialogResult.OK Then ' ファイルダイアログを開く。
|
24
|
-
’’’PictureBox1.SizeMode = PictureBoxSizeMode.Zoom ' PicturaBox1に表示される画像を比率を変えずに表示
|
25
|
-
’’’PictureBox1.Image = Image.FromFile(ofd.FileName) ' PictureBox1に選択された画像ファイルを表示
|
26
|
-
’’’End If
|
27
|
-
’’’End Sub
|
28
19
|
|
29
|
-
’’’Private Sub Save_Click(sender As Object, e As EventArgs) Handles Save.Click
|
30
|
-
’’’Dim sfd As New SaveFileDialog ' 各パラメータを設定していきます
|
31
|
-
’’’sfd.Filter = "JPG" & "|" & "*.jpg" & "|" & "PNG" & "|" & "*.png" & "|" & "GIF" & "|" & "*.gif" & "|" & "BMP" & "|" & "*.bmp"
|
32
|
-
’’’If sfd.ShowDialog() = DialogResult.OK Then ' ファイルダイアログを開く。
|
33
|
-
’’’PictureBox1.Image.Save(sfd.FileName, Imaging.ImageFormat.Jpeg)
|
34
|
-
’’’End If
|
35
|
-
|
36
|
-
’’’End Sub
|
37
|
-
’’’End Class
|
38
20
|
|
39
21
|

|
1
インデント
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,24 +16,24 @@
|
|
16
16
|
入力しなければ保存ができない状態になっています。そのため上記の動作
|
17
17
|
をさせるためのプログラムや方法をご教示ください。よろしくお願いいたします。
|
18
18
|
|
19
|
-
Public Class Form1
|
19
|
+
’’’Public Class Form1
|
20
|
-
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Load.Click
|
20
|
+
’’’Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Load.Click
|
21
|
-
Dim ofd As New OpenFileDialog
|
21
|
+
’’’Dim ofd As New OpenFileDialog
|
22
|
-
ofd.Filter = "JPG" & "|" & "*.jpg" & "|" & "PNG" & "|" & "*.png" & "|" & "GIF" & "|" & "*.gif" & "|" & "BMP" & "|" & "*.bmp" ' 読込むファイルの種類を設定
|
22
|
+
’’’ofd.Filter = "JPG" & "|" & "*.jpg" & "|" & "PNG" & "|" & "*.png" & "|" & "GIF" & "|" & "*.gif" & "|" & "BMP" & "|" & "*.bmp" ' 読込むファイルの種類を設定
|
23
|
-
If ofd.ShowDialog() = DialogResult.OK Then ' ファイルダイアログを開く。
|
23
|
+
’’’If ofd.ShowDialog() = DialogResult.OK Then ' ファイルダイアログを開く。
|
24
|
-
PictureBox1.SizeMode = PictureBoxSizeMode.Zoom ' PicturaBox1に表示される画像を比率を変えずに表示
|
24
|
+
’’’PictureBox1.SizeMode = PictureBoxSizeMode.Zoom ' PicturaBox1に表示される画像を比率を変えずに表示
|
25
|
-
PictureBox1.Image = Image.FromFile(ofd.FileName) ' PictureBox1に選択された画像ファイルを表示
|
25
|
+
’’’PictureBox1.Image = Image.FromFile(ofd.FileName) ' PictureBox1に選択された画像ファイルを表示
|
26
|
-
End If
|
26
|
+
’’’End If
|
27
|
-
End Sub
|
27
|
+
’’’End Sub
|
28
28
|
|
29
|
-
Private Sub Save_Click(sender As Object, e As EventArgs) Handles Save.Click
|
29
|
+
’’’Private Sub Save_Click(sender As Object, e As EventArgs) Handles Save.Click
|
30
|
-
Dim sfd As New SaveFileDialog ' 各パラメータを設定していきます
|
30
|
+
’’’Dim sfd As New SaveFileDialog ' 各パラメータを設定していきます
|
31
|
-
sfd.Filter = "JPG" & "|" & "*.jpg" & "|" & "PNG" & "|" & "*.png" & "|" & "GIF" & "|" & "*.gif" & "|" & "BMP" & "|" & "*.bmp"
|
31
|
+
’’’sfd.Filter = "JPG" & "|" & "*.jpg" & "|" & "PNG" & "|" & "*.png" & "|" & "GIF" & "|" & "*.gif" & "|" & "BMP" & "|" & "*.bmp"
|
32
|
-
If sfd.ShowDialog() = DialogResult.OK Then ' ファイルダイアログを開く。
|
32
|
+
’’’If sfd.ShowDialog() = DialogResult.OK Then ' ファイルダイアログを開く。
|
33
|
-
PictureBox1.Image.Save(sfd.FileName, Imaging.ImageFormat.Jpeg)
|
33
|
+
’’’PictureBox1.Image.Save(sfd.FileName, Imaging.ImageFormat.Jpeg)
|
34
|
-
End If
|
34
|
+
’’’End If
|
35
35
|
|
36
|
-
End Sub
|
36
|
+
’’’End Sub
|
37
|
-
End Class
|
37
|
+
’’’End Class
|
38
38
|
|
39
39
|

|