• R/O
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonbathyscaphephpgamewindowsguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

デュアルディスプレイのセカンドモニターにPDFを表示。


コミットメタ情報

リビジョン50 (tree)
日時2018-12-07 17:49:50
作者bellyoshi

ログメッセージ

変更サマリ

差分

--- pdfsecondmonitor/CtlImage.Designer.vb (revision 49)
+++ pdfsecondmonitor/CtlImage.Designer.vb (revision 50)
@@ -22,23 +22,56 @@
2222 'コード エディターを使って変更しないでください。
2323 <System.Diagnostics.DebuggerStepThrough()> _
2424 Private Sub InitializeComponent()
25- Me.btnRotate = New System.Windows.Forms.Button()
25+ Me.btnRotate180 = New System.Windows.Forms.Button()
26+ Me.btnRotateM90 = New System.Windows.Forms.Button()
27+ Me.btnRotate90 = New System.Windows.Forms.Button()
28+ Me.btnRotate0 = New System.Windows.Forms.Button()
2629 Me.SuspendLayout()
2730 '
28- 'btnRotate
31+ 'btnRotate180
2932 '
30- Me.btnRotate.Location = New System.Drawing.Point(232, 58)
31- Me.btnRotate.Name = "btnRotate"
32- Me.btnRotate.Size = New System.Drawing.Size(90, 51)
33- Me.btnRotate.TabIndex = 0
34- Me.btnRotate.Text = "180度回転"
35- Me.btnRotate.UseVisualStyleBackColor = True
33+ Me.btnRotate180.Location = New System.Drawing.Point(232, 80)
34+ Me.btnRotate180.Name = "btnRotate180"
35+ Me.btnRotate180.Size = New System.Drawing.Size(90, 51)
36+ Me.btnRotate180.TabIndex = 0
37+ Me.btnRotate180.Text = "180度回転"
38+ Me.btnRotate180.UseVisualStyleBackColor = True
3639 '
40+ 'btnRotateM90
41+ '
42+ Me.btnRotateM90.Location = New System.Drawing.Point(136, 58)
43+ Me.btnRotateM90.Name = "btnRotateM90"
44+ Me.btnRotateM90.Size = New System.Drawing.Size(90, 51)
45+ Me.btnRotateM90.TabIndex = 0
46+ Me.btnRotateM90.Text = "左90度"
47+ Me.btnRotateM90.UseVisualStyleBackColor = True
48+ '
49+ 'btnRotate90
50+ '
51+ Me.btnRotate90.Location = New System.Drawing.Point(328, 58)
52+ Me.btnRotate90.Name = "btnRotate90"
53+ Me.btnRotate90.Size = New System.Drawing.Size(90, 51)
54+ Me.btnRotate90.TabIndex = 0
55+ Me.btnRotate90.Text = "右90度"
56+ Me.btnRotate90.UseVisualStyleBackColor = True
57+ '
58+ 'btnRotate0
59+ '
60+ Me.btnRotate0.Location = New System.Drawing.Point(232, 23)
61+ Me.btnRotate0.Name = "btnRotate0"
62+ Me.btnRotate0.Size = New System.Drawing.Size(90, 51)
63+ Me.btnRotate0.TabIndex = 0
64+ Me.btnRotate0.Text = "0度"
65+ Me.btnRotate0.UseVisualStyleBackColor = True
66+ '
3767 'CtlImage
3868 '
3969 Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
4070 Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
41- Me.Controls.Add(Me.btnRotate)
71+ Me.Controls.Add(Me.btnRotate90)
72+ Me.Controls.Add(Me.btnRotate0)
73+ Me.Controls.Add(Me.btnRotateM90)
74+ Me.Controls.Add(Me.btnRotate180)
4275 Me.Name = "CtlImage"
4376 Me.Size = New System.Drawing.Size(600, 179)
4477 Me.ResumeLayout(False)
@@ -45,5 +78,8 @@
4578
4679 End Sub
4780
48- Friend WithEvents btnRotate As Button
81+ Friend WithEvents btnRotate180 As Button
82+ Friend WithEvents btnRotateM90 As Button
83+ Friend WithEvents btnRotate90 As Button
84+ Friend WithEvents btnRotate0 As Button
4985 End Class
--- pdfsecondmonitor/CtlImage.vb (revision 49)
+++ pdfsecondmonitor/CtlImage.vb (revision 50)
@@ -4,17 +4,30 @@
44
55 Private _pictureBox As PictureBox
66
7- Private Sub btnRotate_Click(sender As Object, e As EventArgs) Handles btnRotate.Click
7+ Private Sub Rotate(flip As RotateFlipType)
88 Dim bmp As Bitmap = New Bitmap(_fileViewParam.FileName)
9- '180度回転して、水平方向に反転
10- '"Rotate180FlipX"の"Rotate180"は180度回転することを意味し、
11- '"FlipX"は水平方向に反転することを意味する
12- bmp.RotateFlip(RotateFlipType.Rotate180FlipX)
13- '表示
9+ bmp.RotateFlip(flip)
1410 _pictureBox.Image = bmp
1511 End Sub
12+ Private Sub None()
13+ _pictureBox.ImageLocation = _fileViewParam.FileName
14+ End Sub
15+ Private Sub btnRotate_Click(sender As Object, e As EventArgs) Handles btnRotate180.Click
16+ Rotate(RotateFlipType.Rotate180FlipNone)
17+ End Sub
1618
19+ Private Sub btnRotate90_Click(sender As Object, e As EventArgs) Handles btnRotate90.Click
20+ Rotate(RotateFlipType.Rotate90FlipNone)
21+ End Sub
1722
23+ Private Sub btnRotate0_Click(sender As Object, e As EventArgs) Handles btnRotate0.Click
24+ None()
25+ End Sub
26+
27+ Private Sub btnRotate270_Click(sender As Object, e As EventArgs) Handles btnRotateM90.Click
28+ Rotate(RotateFlipType.Rotate270FlipNone)
29+ End Sub
30+
1831 Private _fileViewParam As FileViewParam
1932
2033 Public Sub SetFileInfo(f As FileViewParam)
@@ -23,9 +36,11 @@
2336 Return
2437 End If
2538 _pictureBox = _dispacher.ShowImage()
26- _pictureBox.ImageLocation = _fileViewParam.FileName
39+ None()
2740 _pictureBox.SizeMode = PictureBoxSizeMode.Zoom 'サイズ調整
2841
2942
3043 End Sub
44+
45+
3146 End Class
--- pdfsecondmonitor/ctlPdf.Designer.vb (revision 49)
+++ pdfsecondmonitor/ctlPdf.Designer.vb (revision 50)
@@ -24,7 +24,6 @@
2424 Private Sub InitializeComponent()
2525 Me.btnPDFNext = New System.Windows.Forms.Button()
2626 Me.btnPDFBack = New System.Windows.Forms.Button()
27- Me.btnPDFLast = New System.Windows.Forms.Button()
2827 Me.btnPDFFirst = New System.Windows.Forms.Button()
2928 Me.BackgroundWorker1 = New System.ComponentModel.BackgroundWorker()
3029 Me.btnNextHalf = New System.Windows.Forms.Button()
@@ -48,15 +47,6 @@
4847 Me.btnPDFBack.Text = "前へ"
4948 Me.btnPDFBack.UseVisualStyleBackColor = True
5049 '
51- 'btnPDFLast
52- '
53- Me.btnPDFLast.Location = New System.Drawing.Point(193, 26)
54- Me.btnPDFLast.Name = "btnPDFLast"
55- Me.btnPDFLast.Size = New System.Drawing.Size(49, 23)
56- Me.btnPDFLast.TabIndex = 26
57- Me.btnPDFLast.Text = "最後へ"
58- Me.btnPDFLast.UseVisualStyleBackColor = True
59- '
6050 'btnPDFFirst
6151 '
6252 Me.btnPDFFirst.Location = New System.Drawing.Point(25, 26)
@@ -68,7 +58,7 @@
6858 '
6959 'btnNextHalf
7060 '
71- Me.btnNextHalf.Location = New System.Drawing.Point(137, 75)
61+ Me.btnNextHalf.Location = New System.Drawing.Point(112, 76)
7262 Me.btnNextHalf.Name = "btnNextHalf"
7363 Me.btnNextHalf.Size = New System.Drawing.Size(75, 23)
7464 Me.btnNextHalf.TabIndex = 28
@@ -82,7 +72,6 @@
8272 Me.Controls.Add(Me.btnNextHalf)
8373 Me.Controls.Add(Me.btnPDFNext)
8474 Me.Controls.Add(Me.btnPDFBack)
85- Me.Controls.Add(Me.btnPDFLast)
8675 Me.Controls.Add(Me.btnPDFFirst)
8776 Me.Name = "ctlPdf"
8877 Me.Size = New System.Drawing.Size(796, 133)
@@ -91,7 +80,6 @@
9180 End Sub
9281 Friend WithEvents btnPDFNext As Button
9382 Friend WithEvents btnPDFBack As Button
94- Friend WithEvents btnPDFLast As Button
9583 Friend WithEvents btnPDFFirst As Button
9684 Friend WithEvents BackgroundWorker1 As System.ComponentModel.BackgroundWorker
9785 Friend WithEvents btnNextHalf As Button
--- pdfsecondmonitor/ctlPdf.vb (revision 49)
+++ pdfsecondmonitor/ctlPdf.vb (revision 50)
@@ -21,7 +21,7 @@
2121 _viewer.PrePage()
2222 End Sub
2323
24- Private Sub btnLast_Click(sender As Object, e As EventArgs) Handles btnPDFLast.Click
24+ Private Sub btnLast_Click(sender As Object, e As EventArgs)
2525 'todo
2626 End Sub
2727 #End Region
--- pdfsecondmonitor/frmOperation.Designer.vb (revision 49)
+++ pdfsecondmonitor/frmOperation.Designer.vb (revision 50)
@@ -178,6 +178,7 @@
178178 '
179179 'lstPDFFiles
180180 '
181+ Me.lstPDFFiles.AllowDrop = True
181182 Me.lstPDFFiles.FormattingEnabled = True
182183 Me.lstPDFFiles.ItemHeight = 15
183184 Me.lstPDFFiles.Location = New System.Drawing.Point(34, 170)
--- pdfsecondmonitor/frmOperation.vb (revision 49)
+++ pdfsecondmonitor/frmOperation.vb (revision 50)
@@ -35,8 +35,12 @@
3535 Dim serializer As New System.Xml.Serialization.XmlSerializer(
3636 GetType(List(Of FileViewParam)))
3737 '読み込むファイルを開く
38+ Dim filename = "lstPDFFiles.xml"
39+ If Not IO.File.Exists(filename) Then
40+ Return
41+ End If
3842 Using sr As New System.IO.StreamReader(
39- "lstPDFFiles.xml", New System.Text.UTF8Encoding(False))
43+ filename, New System.Text.UTF8Encoding(False))
4044 'XMLファイルから読み込み、逆シリアル化する
4145 fvinfos =
4246 DirectCast(serializer.Deserialize(sr), List(Of FileViewParam))
@@ -45,7 +49,9 @@
4549 For Each info In fvinfos
4650 lstPDFFiles.Items.Add(info)
4751 Next
52+
4853 Catch ex As Exception
54+
4955 MessageBox.Show(ex.Message)
5056 End Try
5157 loading = False
@@ -207,7 +213,7 @@
207213
208214 Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
209215 OpenFileDialog1.Multiselect = True
210- OpenFileDialog1.Filter = "画像、動画、PDFファイル|*.pdf;*.bmp;*.gif;*.png;|All Files(*.*)|*.*;"
216+ OpenFileDialog1.Filter = "画像、動画、PDFファイル|*.pdf;*.bmp;*.gif;*.png;*.jpeg;*jpg;|All Files(*.*)|*.*;"
211217 OpenFileDialog1.FileName = txtPDFFileName.Text
212218 Dim ret = OpenFileDialog1.ShowDialog()
213219 If ret = Windows.Forms.DialogResult.Cancel Then
@@ -227,12 +233,34 @@
227233 _dispacher.CloseViewers()
228234 End Sub
229235
236+ Private Sub lstPDFFiles_DragEnter(sender As Object, e As DragEventArgs) Handles lstPDFFiles.DragEnter
237+ 'コントロール内にドラッグされたとき実行される
238+ If e.Data.GetDataPresent(DataFormats.FileDrop) Then
239+ 'ドラッグされたデータ形式を調べ、ファイルのときはコピーとする
240+ e.Effect = DragDropEffects.Copy
241+ Else
242+ 'ファイル以外は受け付けない
243+ e.Effect = DragDropEffects.None
244+ End If
245+ End Sub
230246
247+ Private Sub lstPDFFiles_DragDrop(sender As Object, e As DragEventArgs) Handles lstPDFFiles.DragDrop
248+ Dim items = lstPDFFiles.Items
249+ Dim fileName As String() = CType(
250+ e.Data.GetData(DataFormats.FileDrop, False),
251+ String())
252+ 'ListBoxに追加する
253+ For Each f In fileName
254+ items.Add(New FileViewParam(f))
255+ Next
256+ End Sub
231257
232258
233259
234260
235261
262+
263+
236264 #End Region
237265
238266 End Class
\ No newline at end of file