Browse Source

PageView测试

章政 7 years ago
parent
commit
f1cf0a54ec
3 changed files with 59 additions and 127 deletions
  1. 39 81
      UAS-MES/Form1.Designer.cs
  2. 14 46
      UAS-MES/Form1.cs
  3. 6 0
      UAS-MES/Form1.resx

+ 39 - 81
UAS-MES/Form1.Designer.cs

@@ -28,14 +28,12 @@
         /// </summary>
         private void InitializeComponent()
         {
+            this.components = new System.ComponentModel.Container();
             this.button1 = new System.Windows.Forms.Button();
             this.button2 = new System.Windows.Forms.Button();
-            this.button3 = new System.Windows.Forms.Button();
-            this.button4 = new System.Windows.Forms.Button();
-            this.txtMsg = new System.Windows.Forms.RichTextBox();
-            this.txtIP = new System.Windows.Forms.TextBox();
-            this.txtPORT = new System.Windows.Forms.TextBox();
-            this.enterTextBox2 = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.document = new O2S.Components.PDFView4NET.PDFDocument(this.components);
+            this.pageView = new O2S.Components.PDFView4NET.PDFPageView();
+            this.timer1 = new System.Windows.Forms.Timer(this.components);
             this.SuspendLayout();
             // 
             // button1
@@ -58,84 +56,47 @@
             this.button2.Text = "button2";
             this.button2.UseVisualStyleBackColor = true;
             // 
-            // button3
-            // 
-            this.button3.Location = new System.Drawing.Point(424, 198);
-            this.button3.Margin = new System.Windows.Forms.Padding(4);
-            this.button3.Name = "button3";
-            this.button3.Size = new System.Drawing.Size(100, 29);
-            this.button3.TabIndex = 0;
-            this.button3.Text = "OPEN";
-            this.button3.UseVisualStyleBackColor = true;
-            this.button3.Click += new System.EventHandler(this.button3_Click_1);
-            // 
-            // button4
-            // 
-            this.button4.Location = new System.Drawing.Point(547, 198);
-            this.button4.Margin = new System.Windows.Forms.Padding(4);
-            this.button4.Name = "button4";
-            this.button4.Size = new System.Drawing.Size(100, 29);
-            this.button4.TabIndex = 2;
-            this.button4.Text = "Send";
-            this.button4.UseVisualStyleBackColor = true;
-            this.button4.Click += new System.EventHandler(this.button4_Click);
-            // 
-            // txtMsg
-            // 
-            this.txtMsg.Location = new System.Drawing.Point(424, 320);
-            this.txtMsg.Name = "txtMsg";
-            this.txtMsg.Size = new System.Drawing.Size(283, 160);
-            this.txtMsg.TabIndex = 7;
-            this.txtMsg.Text = "";
-            // 
-            // txtIP
-            // 
-            this.txtIP.Location = new System.Drawing.Point(424, 270);
-            this.txtIP.Name = "txtIP";
-            this.txtIP.Size = new System.Drawing.Size(136, 25);
-            this.txtIP.TabIndex = 8;
-            this.txtIP.Text = "127.0.0.1";
-            // 
-            // txtPORT
-            // 
-            this.txtPORT.Location = new System.Drawing.Point(607, 270);
-            this.txtPORT.Name = "txtPORT";
-            this.txtPORT.Size = new System.Drawing.Size(100, 25);
-            this.txtPORT.TabIndex = 9;
-            this.txtPORT.Text = "8080";
-            // 
-            // enterTextBox2
-            // 
-            this.enterTextBox2.AllPower = null;
-            this.enterTextBox2.BackColor = System.Drawing.Color.White;
-            this.enterTextBox2.ID = null;
-            this.enterTextBox2.Location = new System.Drawing.Point(753, 270);
-            this.enterTextBox2.Name = "enterTextBox2";
-            this.enterTextBox2.Power = null;
-            this.enterTextBox2.Size = new System.Drawing.Size(196, 25);
-            this.enterTextBox2.Str = null;
-            this.enterTextBox2.Str1 = null;
-            this.enterTextBox2.Str2 = null;
-            this.enterTextBox2.TabIndex = 10;
+            // document
+            // 
+            this.document.Metadata = null;
+            this.document.PageLayout = O2S.Components.PDFView4NET.PDFPageLayout.SinglePage;
+            this.document.PageMode = O2S.Components.PDFView4NET.PDFPageMode.UseNone;
+            // 
+            // pageView
+            // 
+            this.pageView.AutoScroll = true;
+            this.pageView.BackColor = System.Drawing.SystemColors.Window;
+            this.pageView.DefaultEllipseAnnotationBorderWidth = 1D;
+            this.pageView.DefaultInkAnnotationWidth = 1D;
+            this.pageView.DefaultRectangleAnnotationBorderWidth = 1D;
+            this.pageView.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.pageView.Document = this.document;
+            this.pageView.DownscaleLargeImages = false;
+            this.pageView.EnableRepeatedKeys = false;
+            this.pageView.Location = new System.Drawing.Point(0, 0);
+            this.pageView.Name = "pageView";
+            this.pageView.PageDisplayLayout = O2S.Components.PDFView4NET.PDFPageDisplayLayout.OneColumn;
+            this.pageView.PageNumber = 0;
+            this.pageView.RenderingProgressColor = System.Drawing.Color.Empty;
+            this.pageView.RequiredFormFieldHighlightColor = System.Drawing.Color.Empty;
+            this.pageView.ScrollPosition = new System.Drawing.Point(0, 0);
+            this.pageView.Size = new System.Drawing.Size(929, 590);
+            this.pageView.SubstituteFonts = null;
+            this.pageView.TabIndex = 2;
+            this.pageView.VerticalPageSpacing = 5;
+            this.pageView.WorkMode = O2S.Components.PDFView4NET.UserInteractiveWorkMode.PanAndScan;
             // 
             // Form1
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1239, 738);
-            this.Controls.Add(this.enterTextBox2);
-            this.Controls.Add(this.txtPORT);
-            this.Controls.Add(this.txtIP);
-            this.Controls.Add(this.txtMsg);
-            this.Controls.Add(this.button4);
-            this.Controls.Add(this.button3);
-            this.Margin = new System.Windows.Forms.Padding(4);
+            this.ClientSize = new System.Drawing.Size(929, 590);
+            this.Controls.Add(this.pageView);
             this.Name = "Form1";
             this.Tag = "123123";
             this.Text = "Form1";
             this.Load += new System.EventHandler(this.Form1_Load);
             this.ResumeLayout(false);
-            this.PerformLayout();
 
         }
 
@@ -146,11 +107,8 @@
         private CustomControl.ButtonUtil.NormalButton normalButton1;
         private CustomControl.TextBoxWithIcon.EnterTextBox enterTextBox1;
         private CustomControl.SetLoading.LoadingCircle loadingCircle1;
-        private System.Windows.Forms.Button button3;
-        private System.Windows.Forms.Button button4;
-        private System.Windows.Forms.RichTextBox txtMsg;
-        private System.Windows.Forms.TextBox txtIP;
-        private System.Windows.Forms.TextBox txtPORT;
-        private CustomControl.TextBoxWithIcon.EnterTextBox enterTextBox2;
+        private O2S.Components.PDFView4NET.PDFDocument document;
+        private O2S.Components.PDFView4NET.PDFPageView pageView;
+        private System.Windows.Forms.Timer timer1;
     }
 }

+ 14 - 46
UAS-MES/Form1.cs

@@ -29,59 +29,27 @@ namespace UAS_MES
         public Form1()
         {
             InitializeComponent();
+            timer1.Interval = 1000;
+            timer1.Tick += Timer1_Tick;
         }
 
-
-
         private void Form1_Load(object sender, EventArgs e)
         {
-            //Com.PortName = "COM4";
-            //Com.ReadTimeout = 5000;
-            //Com.WriteTimeout = 5000;
-            //Com.BaudRate = 9600;
-            //Com.StopBits = StopBits.One;
-            //Com.Parity = Parity.None;
-
-        }
-
-        [DllImport("WinIo64.dll")]
-        public static extern bool InitializeWinIo();
-        [DllImport("WinIo64.dll")]
-        public static extern void ShutdownWinIo();
-        [DllImport("WinIo64.dll")]
-        public static extern bool GetPortVal(IntPtr wPortAddr, out int pdwPortVal, byte bSize);
-        [DllImport("WinIo64.dll")]
-        public static extern bool SetPortVal(IntPtr wPortAddr, int dwPortVal, byte bSize);
-        //以下是与并口无关  
-        [DllImport("WinIo64.dll")]
-        public static extern byte MapPhysToLin(byte pbPhysAddr, uint dwPhysSize, IntPtr PhysicalMemoryHandle);
-        [DllImport("WinIo64.dll")]
-        public static extern bool UnmapPhysicalMemory(IntPtr PhysicalMemoryHandle, byte pbLinAddr);
-        [DllImport("WinIo64.dll")]
-        public static extern bool GetPhysLong(IntPtr pbPhysAddr, byte pdwPhysVal);
-        [DllImport("WinIo64.dll")]
-        public static extern bool SetPhysLong(IntPtr pbPhysAddr, byte dwPhysVal);
-        [DllImport("user32.dll")]
-        public static extern int MapVirtualKey(uint Ucode, uint uMapType);
-
-        public bool online = false;                          //WinIo打开标志  
-        //数据端口共8位,控制端口共4位,可以组成1~12位的任意数字输出端口;  
-        //状态端口共5位,控制端口共4位,可以组成1~9位的任意数字输入端口  
-        private static IntPtr data_port = (IntPtr)0x378;     //数据端口地址 D0-D7 8个端口  
-        private static IntPtr state_port = (IntPtr)0x379;    //状态端口地址 S3-S7 只能读取5位  
-        private static IntPtr control_port = (IntPtr)0x37A;  //控制端口地址 C0-C3 只能控制或输出4位  
-
-        ModeBusTCPServer md;
-        private void button3_Click_1(object sender, EventArgs e)
-        {
-            md = new ModeBusTCPServer();
-            md.Open();
-            txtMsg.AppendText("SUCCESS");
+            document.Load(@"H:\PDFView4NET 5.0.1 WinForms Edition\SupportFiles\multicolumntextandimages.pdf");
+            pageView.PageDisplayLayout = 0;
+            timer1.Start();
         }
 
-        private void button4_Click(object sender, EventArgs e)
+        private void Timer1_Tick(object sender, EventArgs e)
         {
-            md.SendOrder(enterTextBox2.Text);
+            pageView.GoToNextPage();
+            if (document.PageCount - 1 == pageView.PageNumber)
+            {
+                pageView.GoToFirstPage();
+                //设置滚动的范围
+                //pageView.ScrollPosition;
+                Thread.Sleep(1000);
+            }
         }
     }
 }

+ 6 - 0
UAS-MES/Form1.resx

@@ -117,4 +117,10 @@
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
+  <metadata name="document.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>129, 17</value>
+  </metadata>
 </root>