デュアルディスプレイのセカンドモニターにPDF、動画、画像を表示。
@@ -2,11 +2,7 @@ | ||
2 | 2 | |
3 | 3 | Private _dispacher As FormDispacher = FormDispacher.GetInstance |
4 | 4 | |
5 | - Public ReadOnly Property PictureBox As PictureBox | |
6 | - Get | |
7 | - Return _dispacher.GetPictureBox | |
8 | - End Get | |
9 | - End Property | |
5 | + Private _pictureBox As PictureBox | |
10 | 6 | |
11 | 7 | Private Sub btnRotate_Click(sender As Object, e As EventArgs) Handles btnRotate.Click |
12 | 8 | Dim bmp As Bitmap = New Bitmap(_fileViewParam.FileName) |
@@ -15,24 +11,20 @@ | ||
15 | 11 | '"FlipX"は水平方向に反転することを意味する |
16 | 12 | bmp.RotateFlip(RotateFlipType.Rotate180FlipX) |
17 | 13 | '表示 |
18 | - PictureBox.Image = bmp | |
14 | + _pictureBox.Image = bmp | |
19 | 15 | End Sub |
20 | 16 | |
21 | - Private Sub CtlImage_Load(sender As Object, e As EventArgs) Handles MyBase.Load | |
22 | 17 | |
23 | - End Sub | |
24 | - | |
25 | 18 | Private _fileViewParam As FileViewParam |
26 | 19 | |
27 | 20 | Public Sub SetFileInfo(f As FileViewParam) |
28 | 21 | Me._fileViewParam = f |
29 | - If _fileViewParam Is Nothing Then | |
30 | - _dispacher.HidePdfViewer() | |
31 | - Else | |
32 | - _dispacher.ShowPdfViewer() | |
22 | + If f Is Nothing Then | |
23 | + Return | |
33 | 24 | End If |
34 | - PictureBox.ImageLocation = _fileViewParam.FileName | |
35 | - PictureBox.SizeMode = PictureBoxSizeMode.Zoom 'サイズ調整 | |
25 | + _pictureBox = _dispacher.ShowImage() | |
26 | + _pictureBox.ImageLocation = _fileViewParam.FileName | |
27 | + _pictureBox.SizeMode = PictureBoxSizeMode.Zoom 'サイズ調整 | |
36 | 28 | |
37 | 29 | |
38 | 30 | End Sub |
@@ -35,34 +35,17 @@ | ||
35 | 35 | Return instance |
36 | 36 | End Function |
37 | 37 | |
38 | - Private _frmOperation As frmOperation | |
39 | - Public Sub ShowOperation() | |
40 | - Create(_frmOperation, GetType(frmOperation)) | |
41 | - _frmOperation.Show() | |
42 | - End Sub | |
43 | - | |
44 | - | |
45 | - Public Sub ShowImage() | |
38 | + Public Function ShowImage() As PictureBox | |
46 | 39 | Show(_frmImageViewer, GetType(frmImageViewer)) |
47 | - End Sub | |
48 | - Private _frmImageViewer As frmImageViewer | |
49 | - Public Function GetPictureBox() As PictureBox | |
50 | - If _frmImageViewer Is Nothing Then | |
51 | - ShowImage() | |
52 | - End If | |
53 | 40 | Return _frmImageViewer.PictureBox1 |
54 | 41 | End Function |
42 | + Private _frmImageViewer As frmImageViewer | |
55 | 43 | |
56 | - Dim _frmPdfViewer As frmPdfViewer | |
57 | 44 | |
45 | + | |
58 | 46 | Private _frmMovieViewer As frmMovieViewer |
59 | - Public Sub ShowMovie() | |
47 | + Public Function ShowMovie() As AxWMPLib.AxWindowsMediaPlayer | |
60 | 48 | Show(_frmMovieViewer, GetType(frmMovieViewer)) |
61 | - End Sub | |
62 | - Public Function GetPlayer() As AxWMPLib.AxWindowsMediaPlayer | |
63 | - If _frmMovieViewer Is Nothing Then | |
64 | - ShowMovie() | |
65 | - End If | |
66 | 49 | Return _frmMovieViewer.AxWindowsMediaPlayer1 |
67 | 50 | End Function |
68 | 51 |
@@ -89,25 +72,18 @@ | ||
89 | 72 | targetForm.Show() |
90 | 73 | End Sub |
91 | 74 | |
92 | - Public Sub HidePdfViewer() | |
93 | - _frmPdfViewer.Hide() | |
94 | - End Sub | |
95 | - | |
96 | - Public Sub ShowPdfViewer() | |
75 | + Dim _frmPdfViewer As frmPdfViewer | |
76 | + Public Function ShowPdfViewer() As frmPdfViewer | |
97 | 77 | Show(_frmPdfViewer, GetType(frmPdfViewer)) |
98 | - End Sub | |
99 | - | |
100 | - 'Private _frmStartup As frmStartup | |
101 | - 'Public Sub SetStartup(ByVal frm As frmStartup) | |
102 | - ' _frmStartup = frmStartup | |
103 | - 'End Sub | |
104 | - Public Sub Close() | |
105 | - '特に処理なし | |
106 | - End Sub | |
107 | - | |
108 | - Public Function GetFrmPdfViewer() As frmPdfViewer | |
109 | 78 | Return _frmPdfViewer |
110 | 79 | End Function |
111 | 80 | |
112 | 81 | |
82 | + | |
83 | + Public Sub CloseViewers() | |
84 | + For Each frm In _secondMonitorWindows | |
85 | + frm.Close() | |
86 | + Next | |
87 | + End Sub | |
88 | + | |
113 | 89 | End Class |
@@ -32,7 +32,7 @@ | ||
32 | 32 | |
33 | 33 | <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _ |
34 | 34 | Protected Overrides Sub OnCreateMainForm() |
35 | - Me.MainForm = Global.pdfsecondmonitor.startup | |
35 | + Me.MainForm = Global.pdfsecondmonitor.frmOperation | |
36 | 36 | End Sub |
37 | 37 | End Class |
38 | 38 | End Namespace |
@@ -2,11 +2,7 @@ | ||
2 | 2 | Private _dispacher As FormDispacher = FormDispacher.GetInstance |
3 | 3 | |
4 | 4 | |
5 | - Public ReadOnly Property player As AxWMPLib.AxWindowsMediaPlayer | |
6 | - Get | |
7 | - Return _dispacher.GetPlayer | |
8 | - End Get | |
9 | - End Property | |
5 | + Private player As AxWMPLib.AxWindowsMediaPlayer | |
10 | 6 | |
11 | 7 | Private _fileViewParam As FileViewParam |
12 | 8 |
@@ -13,10 +9,10 @@ | ||
13 | 9 | Public Sub SetFileInfo(f As FileViewParam) |
14 | 10 | Me._fileViewParam = f |
15 | 11 | If _fileViewParam Is Nothing Then |
12 | + Return | |
13 | + End If | |
14 | + player = _dispacher.ShowMovie() | |
16 | 15 | |
17 | - Else | |
18 | - _dispacher.ShowMovie() | |
19 | - End If | |
20 | 16 | player.URL = _fileViewParam.FileName |
21 | 17 | player.uiMode = "none" |
22 | 18 | player.stretchToFit = True |
@@ -2,28 +2,23 @@ | ||
2 | 2 | |
3 | 3 | Private _dispacher As FormDispacher = FormDispacher.GetInstance |
4 | 4 | |
5 | - ReadOnly Property frmPdfViewer As frmPdfViewer | |
6 | - Get | |
7 | - Return _dispacher.GetFrmPdfViewer | |
8 | - End Get | |
9 | - End Property | |
5 | + Private _viewer As frmPdfViewer | |
10 | 6 | |
11 | 7 | |
12 | 8 | |
13 | 9 | |
14 | - | |
15 | 10 | #Region "ページ移動" |
16 | 11 | |
17 | 12 | Private Sub btnFirst_Click(sender As Object, e As EventArgs) Handles btnPDFFirst.Click |
18 | - frmPdfViewer.FirstPage() | |
13 | + _viewer.FirstPage() | |
19 | 14 | End Sub |
20 | 15 | |
21 | 16 | Private Sub btnNext_Click(sender As Object, e As EventArgs) Handles btnPDFNext.Click |
22 | - frmPdfViewer.NextPage() | |
17 | + _viewer.NextPage() | |
23 | 18 | End Sub |
24 | 19 | |
25 | 20 | Private Sub btnBack_Click(sender As Object, e As EventArgs) Handles btnPDFBack.Click |
26 | - frmPdfViewer.PrePage() | |
21 | + _viewer.PrePage() | |
27 | 22 | End Sub |
28 | 23 | |
29 | 24 | Private Sub btnLast_Click(sender As Object, e As EventArgs) Handles btnPDFLast.Click |
@@ -37,7 +32,8 @@ | ||
37 | 32 | Private _fileViewParam As FileViewParam |
38 | 33 | Public Sub SetFileInfo(f As FileViewParam) |
39 | 34 | Me._fileViewParam = f |
40 | - frmPdfViewer.OpenFile(f.FileName) | |
35 | + _viewer = _dispacher.ShowPdfViewer() | |
36 | + _viewer.OpenFile(f.FileName) | |
41 | 37 | End Sub |
42 | 38 | |
43 | 39 |
@@ -1,5 +1,3 @@ | ||
1 | 1 | Public Class frmMovieViewer |
2 | - Private Sub CtlMoviePlayer1_Load(sender As Object, e As EventArgs) | |
3 | 2 | |
4 | - End Sub | |
5 | 3 | End Class |
\ No newline at end of file |
@@ -38,10 +38,9 @@ | ||
38 | 38 | Me.Label6 = New System.Windows.Forms.Label() |
39 | 39 | Me.txtPDFFileName = New System.Windows.Forms.TextBox() |
40 | 40 | Me.btnDelete = New System.Windows.Forms.Button() |
41 | - Me.btnInsert = New System.Windows.Forms.Button() | |
42 | 41 | Me.lstPDFFiles = New System.Windows.Forms.ListBox() |
43 | 42 | Me.BackgroundWorker1 = New System.ComponentModel.BackgroundWorker() |
44 | - Me.Button1 = New System.Windows.Forms.Button() | |
43 | + Me.btnUnSelect = New System.Windows.Forms.Button() | |
45 | 44 | Me.Button2 = New System.Windows.Forms.Button() |
46 | 45 | Me.GroupBox1.SuspendLayout() |
47 | 46 | Me.tpMediaPlayer.SuspendLayout() |
@@ -177,15 +176,6 @@ | ||
177 | 176 | Me.btnDelete.Text = "削除" |
178 | 177 | Me.btnDelete.UseVisualStyleBackColor = True |
179 | 178 | ' |
180 | - 'btnInsert | |
181 | - ' | |
182 | - Me.btnInsert.Location = New System.Drawing.Point(107, 598) | |
183 | - Me.btnInsert.Name = "btnInsert" | |
184 | - Me.btnInsert.Size = New System.Drawing.Size(92, 23) | |
185 | - Me.btnInsert.TabIndex = 20 | |
186 | - Me.btnInsert.Text = "リストに追加" | |
187 | - Me.btnInsert.UseVisualStyleBackColor = True | |
188 | - ' | |
189 | 179 | 'lstPDFFiles |
190 | 180 | ' |
191 | 181 | Me.lstPDFFiles.FormattingEnabled = True |
@@ -195,14 +185,14 @@ | ||
195 | 185 | Me.lstPDFFiles.Size = New System.Drawing.Size(308, 349) |
196 | 186 | Me.lstPDFFiles.TabIndex = 19 |
197 | 187 | ' |
198 | - 'Button1 | |
188 | + 'btnUnSelect | |
199 | 189 | ' |
200 | - Me.Button1.Location = New System.Drawing.Point(43, 114) | |
201 | - Me.Button1.Name = "Button1" | |
202 | - Me.Button1.Size = New System.Drawing.Size(299, 23) | |
203 | - Me.Button1.TabIndex = 20 | |
204 | - Me.Button1.Text = "背景テキスト" | |
205 | - Me.Button1.UseVisualStyleBackColor = True | |
190 | + Me.btnUnSelect.Location = New System.Drawing.Point(53, 126) | |
191 | + Me.btnUnSelect.Name = "btnUnSelect" | |
192 | + Me.btnUnSelect.Size = New System.Drawing.Size(267, 23) | |
193 | + Me.btnUnSelect.TabIndex = 20 | |
194 | + Me.btnUnSelect.Text = "選択解除" | |
195 | + Me.btnUnSelect.UseVisualStyleBackColor = True | |
206 | 196 | ' |
207 | 197 | 'Button2 |
208 | 198 | ' |
@@ -220,10 +210,9 @@ | ||
220 | 210 | Me.ClientSize = New System.Drawing.Size(1168, 649) |
221 | 211 | Me.Controls.Add(Me.Label6) |
222 | 212 | Me.Controls.Add(Me.Button2) |
223 | - Me.Controls.Add(Me.Button1) | |
213 | + Me.Controls.Add(Me.btnUnSelect) | |
224 | 214 | Me.Controls.Add(Me.tbcFileOpes) |
225 | 215 | Me.Controls.Add(Me.GroupBox1) |
226 | - Me.Controls.Add(Me.btnInsert) | |
227 | 216 | Me.Controls.Add(Me.btnDelete) |
228 | 217 | Me.Controls.Add(Me.lstPDFFiles) |
229 | 218 | Me.Controls.Add(Me.txtPDFFileName) |
@@ -248,11 +237,10 @@ | ||
248 | 237 | Friend WithEvents tbcFileOpes As TabControl |
249 | 238 | Friend WithEvents tpAdobePDF As TabPage |
250 | 239 | Friend WithEvents txtPDFFileName As TextBox |
251 | - Friend WithEvents btnInsert As Button | |
252 | 240 | Friend WithEvents lstPDFFiles As ListBox |
253 | 241 | Friend WithEvents btnDelete As Button |
254 | 242 | Friend WithEvents BackgroundWorker1 As System.ComponentModel.BackgroundWorker |
255 | - Friend WithEvents Button1 As Button | |
243 | + Friend WithEvents btnUnSelect As Button | |
256 | 244 | Friend WithEvents Label6 As Label |
257 | 245 | Friend WithEvents Button2 As Button |
258 | 246 | Friend WithEvents tpImage As TabPage |
@@ -85,8 +85,8 @@ | ||
85 | 85 | |
86 | 86 | Private Sub frmOperation_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed |
87 | 87 | AppSettingSave() |
88 | - _dispacher.Close() | |
89 | 88 | |
89 | + | |
90 | 90 | End Sub |
91 | 91 | #End Region |
92 | 92 |
@@ -170,13 +170,11 @@ | ||
170 | 170 | Dim ext = IO.Path.GetExtension(fileviewinfo.FileName) |
171 | 171 | If IsContain(ext, {".pdf"}) Then |
172 | 172 | tbcFileOpes.SelectTab(tpAdobePDF.TabIndex) |
173 | - _dispacher.ShowPdfViewer() | |
174 | 173 | CtlPdf1.SetFileInfo(fileviewinfo) |
175 | 174 | |
176 | 175 | ElseIf IsImageExt(ext) Then |
177 | 176 | tbcFileOpes.SelectTab(tpImage.TabIndex) |
178 | 177 | CtlImage1.SetFileInfo(fileviewinfo) |
179 | - _dispacher.ShowImage() | |
180 | 178 | ElseIf IsMovieExt(ext) Then |
181 | 179 | tbcFileOpes.SelectTab(tpMediaPlayer.TabIndex) |
182 | 180 | CtlMovie1.SetFileInfo(fileviewinfo) |
@@ -225,6 +223,9 @@ | ||
225 | 223 | |
226 | 224 | End Sub |
227 | 225 | |
226 | + Private Sub btnUnSelect_Click(sender As Object, e As EventArgs) Handles btnUnSelect.Click | |
227 | + _dispacher.CloseViewers() | |
228 | + End Sub | |
228 | 229 | |
229 | 230 | |
230 | 231 |
@@ -231,6 +232,7 @@ | ||
231 | 232 | |
232 | 233 | |
233 | 234 | |
235 | + | |
234 | 236 | #End Region |
235 | 237 | |
236 | 238 | End Class |
\ No newline at end of file |
@@ -1,7 +1,7 @@ | ||
1 | 1 | Public Class startup |
2 | 2 | Private Sub startup_Load(sender As Object, e As EventArgs) Handles MyBase.Load |
3 | 3 | Dim dis = FormDispacher.GetInstance |
4 | - dis.ShowOperation() | |
5 | 4 | |
5 | + | |
6 | 6 | End Sub |
7 | 7 | End Class |
\ No newline at end of file |