@@ -634,8 +634,10 @@ private void pictureBox1_Click(object sender, EventArgs e)
634634 dr . EndEdit ( ) ;
635635 dtPos . AcceptChanges ( ) ;
636636 }
637-
638-
637+ Point pt1 = pictureBox1 . Location ;
638+
639+ pictureBox2 . Location = new Point ( pt1 . X + pt . X - 10 , pt1 . Y + pt . Y - 10 ) ;
640+
639641 }
640642 //印章比例类型
641643 private void comboBoxBL_SelectionChangeCommitted ( object sender , EventArgs e )
@@ -703,9 +705,29 @@ private void buttonUp_Click(object sender, EventArgs e)
703705 imgStartPage -- ;
704706 PDFFile pdfFile = PDFFile . Open ( pdfInputPath ) ;
705707 Bitmap pageImage = pdfFile . GetPageImage ( imgStartPage - 1 , 56 * 1 ) ;
708+ pdfFile . Dispose ( ) ;
706709 pictureBox1 . Image = pageImage ;
707710 labelPage . Text = imgStartPage + "/" + imgPageCount ;
708711
712+ float px , py ;
713+ DataRow [ ] arrRow = dtPos . Select ( "Path = '" + pdfInputPath + "' and Page = " + imgStartPage ) ;
714+ if ( arrRow == null || arrRow . Length == 0 )
715+ {
716+ px = Convert . ToSingle ( textPx . Text ) ; //这里根据比例来定位
717+ py = Convert . ToSingle ( textPy . Text ) ; //这里根据比例来定位
718+ }
719+ else
720+ {
721+ DataRow dr = arrRow [ 0 ] ;
722+ px = Convert . ToSingle ( dr [ "X" ] . ToString ( ) ) ;
723+ py = Convert . ToSingle ( dr [ "Y" ] . ToString ( ) ) ;
724+ }
725+ int X = Convert . ToInt32 ( pictureBox1 . Width * px ) ;
726+ int Y = Convert . ToInt32 ( pictureBox1 . Height * py ) ;
727+ Point pt1 = pictureBox1 . Location ;
728+
729+ pictureBox2 . Location = new Point ( pt1 . X + X - 10 , pt1 . Y + Y - 10 ) ;
730+
709731 }
710732 }
711733 //下一页
@@ -716,9 +738,29 @@ private void buttonNext_Click(object sender, EventArgs e)
716738 imgStartPage ++ ;
717739 PDFFile pdfFile = PDFFile . Open ( pdfInputPath ) ;
718740 Bitmap pageImage = pdfFile . GetPageImage ( imgStartPage - 1 , 56 * 1 ) ;
741+ pdfFile . Dispose ( ) ;
719742 pictureBox1 . Image = pageImage ;
720743 labelPage . Text = imgStartPage + "/" + imgPageCount ;
721744
745+ float px , py ;
746+ DataRow [ ] arrRow = dtPos . Select ( "Path = '" + pdfInputPath + "' and Page = " + imgStartPage ) ;
747+ if ( arrRow == null || arrRow . Length == 0 )
748+ {
749+ px = Convert . ToSingle ( textPx . Text ) ; //这里根据比例来定位
750+ py = Convert . ToSingle ( textPy . Text ) ; //这里根据比例来定位
751+ }
752+ else
753+ {
754+ DataRow dr = arrRow [ 0 ] ;
755+ px = Convert . ToSingle ( dr [ "X" ] . ToString ( ) ) ;
756+ py = Convert . ToSingle ( dr [ "Y" ] . ToString ( ) ) ;
757+ }
758+ int X = Convert . ToInt32 ( pictureBox1 . Width * px ) ;
759+ int Y = Convert . ToInt32 ( pictureBox1 . Height * py ) ;
760+ Point pt1 = pictureBox1 . Location ;
761+
762+ pictureBox2 . Location = new Point ( pt1 . X + X - 10 , pt1 . Y + Y - 10 ) ;
763+
722764 }
723765 }
724766
@@ -785,6 +827,7 @@ private void comboPDFlist_SelectionChangeCommitted(object sender, EventArgs e)
785827 pictureBox1 . Image = pageImage ;
786828 imgStartPage = 1 ;
787829 imgPageCount = pdfFile . PageCount ;
830+ pdfFile . Dispose ( ) ;
788831 labelPage . Text = imgStartPage + "/" + imgPageCount ;
789832 }
790833 //根据印章类型切换窗口大小
0 commit comments