• R/O
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

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


Commit MetaInfo

Revision28 (tree)
Time2017-11-12 21:24:37
Authorbellyoshi

Log Message

Change Summary

Incremental Difference

--- WindowsFormsApp2/Form1.Designer.cs (revision 27)
+++ WindowsFormsApp2/Form1.Designer.cs (revision 28)
@@ -28,32 +28,29 @@
2828 /// </summary>
2929 private void InitializeComponent()
3030 {
31- this.button1 = new System.Windows.Forms.Button();
32- this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
31+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
32+ this.axAcroPDF1 = new AxAcroPDFLib.AxAcroPDF();
33+ ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).BeginInit();
3334 this.SuspendLayout();
3435 //
35- // button1
36+ // axAcroPDF1
3637 //
37- this.button1.Location = new System.Drawing.Point(136, 210);
38- this.button1.Name = "button1";
39- this.button1.Size = new System.Drawing.Size(75, 23);
40- this.button1.TabIndex = 0;
41- this.button1.Text = "button1";
42- this.button1.UseVisualStyleBackColor = true;
43- this.button1.Click += new System.EventHandler(this.button1_Click);
38+ this.axAcroPDF1.Enabled = true;
39+ this.axAcroPDF1.Location = new System.Drawing.Point(83, 108);
40+ this.axAcroPDF1.Name = "axAcroPDF1";
41+ this.axAcroPDF1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axAcroPDF1.OcxState")));
42+ this.axAcroPDF1.Size = new System.Drawing.Size(240, 240);
43+ this.axAcroPDF1.TabIndex = 0;
4444 //
45- // openFileDialog1
46- //
47- this.openFileDialog1.FileName = "openFileDialog1";
48- //
4945 // Form1
5046 //
5147 this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
5248 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
5349 this.ClientSize = new System.Drawing.Size(282, 253);
54- this.Controls.Add(this.button1);
50+ this.Controls.Add(this.axAcroPDF1);
5551 this.Name = "Form1";
5652 this.Text = "Form1";
53+ ((System.ComponentModel.ISupportInitialize)(this.axAcroPDF1)).EndInit();
5754 this.ResumeLayout(false);
5855
5956 }
@@ -60,8 +57,7 @@
6057
6158 #endregion
6259
63- private System.Windows.Forms.Button button1;
64- private System.Windows.Forms.OpenFileDialog openFileDialog1;
60+ private AxAcroPDFLib.AxAcroPDF axAcroPDF1;
6561 }
6662 }
6763
--- WindowsFormsApp2/Form1.cs (revision 27)
+++ WindowsFormsApp2/Form1.cs (revision 28)
@@ -7,42 +7,20 @@
77 using System.Text;
88 using System.Threading.Tasks;
99 using System.Windows.Forms;
10-using System.Windows;
11-using System.Windows.Media;
1210
13-
1411 namespace WindowsFormsApp2
1512 {
1613 public partial class Form1 : Form
1714 {
15+
16+
1817 public Form1()
1918 {
2019 InitializeComponent();
20+ axAcroPDF1.Dock = System.Windows.Forms.DockStyle.Fill;
21+ axAcroPDF1.LoadFile("C:\\Users\\bellm\\Downloads\\CA-brpgm18_J.pdf");
22+ axAcroPDF1.setZoom(100);
23+ axAcroPDF1.Visible = true;
2124 }
22-
23- private void button1_Click(object sender, EventArgs e)
24- {
25- var ret = openFileDialog1.ShowDialog();
26- if (ret == DialogResult.Cancel)
27- {
28- return;
29- }
30-
31- //
32- // Create a VideoDrawing.
33- //
34- MediaPlayer player = new MediaPlayer();
35-
36- player.Open(new Uri(openFileDialog1.FileName , UriKind.Absolute ));
37-
38- VideoDrawing aVideoDrawing = new VideoDrawing();
39-
40- aVideoDrawing.Rect = new Rect(0, 0, 100, 100);
41-
42- aVideoDrawing.Player = player;
43-
44- // Play the video once.
45- player.Play();
46- }
4725 }
4826 }
--- WindowsFormsApp2/Properties/AssemblyInfo.cs (revision 27)
+++ WindowsFormsApp2/Properties/AssemblyInfo.cs (revision 28)
@@ -20,7 +20,7 @@
2020 [assembly: ComVisible(false)]
2121
2222 // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
23-[assembly: Guid("edc52062-9c75-4fd8-925e-5473faf2af2f")]
23+[assembly: Guid("d24de68b-c8dd-4064-9c54-ff351bbd0ea4")]
2424
2525 // アセンブリのバージョン情報は次の 4 つの値で構成されています:
2626 //
--- pdfsecondmonitor/frmOperation.Designer.vb (revision 27)
+++ pdfsecondmonitor/frmOperation.Designer.vb (revision 28)
@@ -52,6 +52,7 @@
5252 Me.cmbPDFView = New System.Windows.Forms.ComboBox()
5353 Me.btnPDFLast = New System.Windows.Forms.Button()
5454 Me.btnPDFFirst = New System.Windows.Forms.Button()
55+ Me.Button1 = New System.Windows.Forms.Button()
5556 Me.GroupBox1.SuspendLayout()
5657 CType(Me.nudWidth, System.ComponentModel.ISupportInitialize).BeginInit()
5758 CType(Me.nudHeight, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -132,9 +133,6 @@
132133 Me.Label3.TabIndex = 13
133134 Me.Label3.Text = "高さ"
134135 '
135- 'Timer1
136- '
137- '
138136 'tpMediaPlayer
139137 '
140138 Me.tpMediaPlayer.Controls.Add(Me.btnOpenMediaFile)
@@ -336,11 +334,21 @@
336334 Me.btnPDFFirst.Text = "最初へ"
337335 Me.btnPDFFirst.UseVisualStyleBackColor = True
338336 '
337+ 'Button1
338+ '
339+ Me.Button1.Location = New System.Drawing.Point(695, 60)
340+ Me.Button1.Name = "Button1"
341+ Me.Button1.Size = New System.Drawing.Size(75, 23)
342+ Me.Button1.TabIndex = 13
343+ Me.Button1.Text = "Button1"
344+ Me.Button1.UseVisualStyleBackColor = True
345+ '
339346 'frmOperation
340347 '
341348 Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
342349 Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
343350 Me.ClientSize = New System.Drawing.Size(782, 465)
351+ Me.Controls.Add(Me.Button1)
344352 Me.Controls.Add(Me.tbcFileOpes)
345353 Me.Controls.Add(Me.GroupBox1)
346354 Me.Name = "frmOperation"
@@ -387,4 +395,5 @@
387395 Friend WithEvents btnInsert As Button
388396 Friend WithEvents lstPDFFiles As ListBox
389397 Friend WithEvents btnDelete As Button
398+ Friend WithEvents Button1 As Button
390399 End Class
--- pdfsecondmonitor/frmOperation.vb (revision 27)
+++ pdfsecondmonitor/frmOperation.vb (revision 28)
@@ -50,7 +50,7 @@
5050 lstPDFFiles.Items.Add(info)
5151 Next
5252 Catch ex As Exception
53-
53+ MessageBox.Show(ex.Message)
5454 End Try
5555
5656 End Sub
@@ -103,9 +103,9 @@
103103 If cmbDisplay.SelectedItem Is Nothing Then
104104 Exit Sub
105105 End If
106- 'フォームを表示するディスプレイのScreenを取得する
106+ ' 'フォームを表示するディスプレイのScreenを取得する
107107 Dim s As Screen = DirectCast(Me.cmbDisplay.SelectedItem, Screen)
108- 'フォームの開始位置をディスプレイの左上座標に設定する
108+ ' 'フォームの開始位置をディスプレイの左上座標に設定する
109109 frmView.StartPosition = FormStartPosition.Manual
110110 frmView.Location = s.Bounds.Location
111111 frmView.Size = s.Bounds.Size
@@ -157,8 +157,8 @@
157157 If axPDF Is Nothing Then
158158 Exit Sub
159159 End If
160- axPDF.setZoom(nudPdfZoom.Value)
161- setLstZoom(nudPdfZoom.Value)
160+ frmView.SetZoom(nudPdfZoom.Value)
161+ SetLstZoom(nudPdfZoom.Value)
162162 End Sub
163163
164164 ''' <summary>
@@ -173,7 +173,7 @@
173173
174174
175175 #Region "PDFファイルを開く"
176- Private backFileName As String
176+ ' Private backFileName As String
177177 Private Sub btnFileOpen_Click(sender As Object, e As EventArgs) Handles btnOpenPDFFile.Click
178178 OpenFileDialog1.Filter = "PDFファイル (*.pdf) |*.pdf"
179179 OpenFileDialog1.FileName = txtPDFFileName.Text
@@ -194,15 +194,15 @@
194194 Return
195195 End If
196196 frmView.pnlCover.Visible = False
197- If backFileName = txtPDFFileName.Text Then
198- Return
199- End If
200- axPDF.Visible = True
201- axPDF.LoadFile(txtPDFFileName.Text)
202- 'todo : pdfが開けなかったときの処理
203- backFileName = txtPDFFileName.Text
204- axPDF.setShowToolbar(False)
205- axPDF.setShowScrollbars(False)
197+ 'If backFileName = txtPDFFileName.Text Then
198+ ' Return
199+ 'End If
200+
201+ frmView.LoadFile(txtPDFFileName.Text)
202+ ' 'todo : pdfが開けなかったときの処理
203+ ' backFileName = txtPDFFileName.Text
204+ 'axPDF.setShowToolbar(False)
205+ 'axPDF.setShowScrollbars(False)
206206 End Sub
207207
208208
@@ -277,6 +277,10 @@
277277 frmView.Width = nudWidth.Value
278278 End Sub
279279
280+ Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
281+ axPDF.LoadFile("C:\Users\bellm\Downloads\CA-brpgm18_J.pdf")
282+ End Sub
283+
280284 #Region "リストボックス処理"
281285
282286 Private Sub btnInsert_Click(sender As Object, e As EventArgs) Handles btnInsert.Click
--- pdfsecondmonitor/frmView.vb (revision 27)
+++ pdfsecondmonitor/frmView.vb (revision 28)
@@ -12,7 +12,28 @@
1212 End Sub
1313
1414 Private Sub frmView_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
15+ AxAcroPDF1.Top = 0
16+ AxAcroPDF1.Left = 0
1517 AxAcroPDF1.Size = Size
1618 pnlCover.Size = Size
1719 End Sub
20+
21+ Private loaded As Boolean = False
22+ Public Sub LoadFile(fileName As String)
23+ loaded = True
24+ AxAcroPDF1.LoadFile(fileName)
25+ AxAcroPDF1.Visible = True
26+ End Sub
27+
28+ Private zoom As Single = 100
29+ Public Sub SetZoom(ByVal zoom As Single)
30+ If Not loaded Then
31+ Exit Sub
32+ End If
33+ If Math.Abs(Me.zoom - zoom) < 0.1 Then
34+ Exit Sub
35+ End If
36+ Me.zoom = zoom
37+ AxAcroPDF1.setZoom(zoom)
38+ End Sub
1839 End Class