Pdf vykres

This commit is contained in:
Culak-HP\Culak
2020-10-21 16:48:26 +02:00
parent 06bde98877
commit 31323587ee
17 changed files with 346923 additions and 61 deletions

Binary file not shown.

View File

@@ -108,6 +108,15 @@
</Reference> </Reference>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
<Reference Include="Syncfusion.Pdf.Base, Version=18.3460.0.35, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Syncfusion.PdfViewer.Windows, Version=18.3460.0.35, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Syncfusion.Shared.Base, Version=18.3460.0.35, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -492,7 +492,7 @@ namespace Mip
string IPaddress = ""; string IPaddress = "";
PingReply pingReply; PingReply pingReply;
IPaddress = "192.168.1.12"; //IP Adresa MariaDB pre VLAN1 IPaddress = "192.168.2.12"; //IP Adresa MariaDB pre VLAN1
//ked sa programuje mino firmu aby to hned naslo staticku ip //ked sa programuje mino firmu aby to hned naslo staticku ip
//IPaddress = "87.197.164.107"; //IPaddress = "87.197.164.107";
@@ -505,7 +505,7 @@ namespace Mip
} }
else else
{ {
IPaddress = "192.168.1.13"; //IP Adresa MariaDB pre VLAN2 IPaddress = "192.168.2.13"; //IP Adresa MariaDB pre VLAN2
pingReply = pingIP.Send(IPaddress); pingReply = pingIP.Send(IPaddress);
if (pingReply.Status.ToString() == "Success") if (pingReply.Status.ToString() == "Success")
{ {
@@ -514,7 +514,7 @@ namespace Mip
else else
{ {
IPaddress = "87.197.164.107"; IPaddress = "127.0.0.1";
pingReply = pingIP.Send(IPaddress); pingReply = pingIP.Send(IPaddress);
if (pingReply.Status.ToString() == "Success") if (pingReply.Status.ToString() == "Success")
{ {
@@ -530,7 +530,22 @@ namespace Mip
Environment.Exit(0); Environment.Exit(0);
} }
//IPaddress = "87.197.164.107";
//pingReply = pingIP.Send(IPaddress);
//if (pingReply.Status.ToString() == "Success")
//{
// classUser.MariaDBServerIPAddress = IPaddress;
//}
//else
//{
// classUser.MariaDBServerIPAddress = "0.0.0.0";
// MessageBox.Show("Žiadny lokálny ani internetový MariaDB server nebol nájdený!"
// + Environment.NewLine
// + "Program Mip bude ukončený! ");
// Environment.Exit(0);
//}
} }
} }
} }

View File

@@ -2132,6 +2132,10 @@ namespace Mip
private void frmMain_FormClosed(object sender, FormClosedEventArgs e) private void frmMain_FormClosed(object sender, FormClosedEventArgs e)
{ {
classGlobal.DeleteRamDisk();
classDiskOperations.RemoveCurrentUserProtecion(classDiskOperations.TempPath);
classDiskOperations.RemovePath(classDiskOperations.TempPath);
classSQL.SQL("UPDATE `mip`.`tabusers` SET `OnlineStatus`='Offline' WHERE `IDUsers`=" + classUser.ID + ";"); classSQL.SQL("UPDATE `mip`.`tabusers` SET `OnlineStatus`='Offline' WHERE `IDUsers`=" + classUser.ID + ";");
//classSQL.commandSQL("UPDATE `mip`.`tabusers` SET `OnlineStatus`='Offline' WHERE `IDUsers`=" + classUser.ID + ";"); //classSQL.commandSQL("UPDATE `mip`.`tabusers` SET `OnlineStatus`='Offline' WHERE `IDUsers`=" + classUser.ID + ";");
eventWatcher.Stop(); eventWatcher.Stop();

View File

@@ -28,6 +28,10 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
Syncfusion.Windows.Forms.PdfViewer.MessageBoxSettings messageBoxSettings1 = new Syncfusion.Windows.Forms.PdfViewer.MessageBoxSettings();
Syncfusion.Windows.PdfViewer.PdfViewerPrinterSettings pdfViewerPrinterSettings1 = new Syncfusion.Windows.PdfViewer.PdfViewerPrinterSettings();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmPridatVyrobok));
Syncfusion.Windows.Forms.PdfViewer.TextSearchSettings textSearchSettings1 = new Syncfusion.Windows.Forms.PdfViewer.TextSearchSettings();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.textBox7 = new System.Windows.Forms.TextBox(); this.textBox7 = new System.Windows.Forms.TextBox();
@@ -49,6 +53,7 @@
this.btnAddVykres = new System.Windows.Forms.Button(); this.btnAddVykres = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.pdfDocumentView1 = new Syncfusion.Windows.Forms.PdfViewer.PdfDocumentView();
this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.btnVymazVykres = new System.Windows.Forms.Button(); this.btnVymazVykres = new System.Windows.Forms.Button();
@@ -315,12 +320,49 @@
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.panel1.AutoScroll = true; this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.pdfDocumentView1);
this.panel1.Controls.Add(this.pictureBox1); this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Location = new System.Drawing.Point(4, 17); this.panel1.Location = new System.Drawing.Point(4, 17);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(909, 398); this.panel1.Size = new System.Drawing.Size(909, 398);
this.panel1.TabIndex = 9; this.panel1.TabIndex = 9;
// //
// pdfDocumentView1
//
this.pdfDocumentView1.AutoScroll = true;
this.pdfDocumentView1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(237)))), ((int)(((byte)(237)))));
this.pdfDocumentView1.CursorMode = Syncfusion.Windows.Forms.PdfViewer.PdfViewerCursorMode.SelectTool;
this.pdfDocumentView1.EnableContextMenu = true;
this.pdfDocumentView1.HorizontalScrollOffset = 0;
this.pdfDocumentView1.IsTextSearchEnabled = true;
this.pdfDocumentView1.IsTextSelectionEnabled = true;
this.pdfDocumentView1.Location = new System.Drawing.Point(36, 3);
messageBoxSettings1.EnableNotification = true;
this.pdfDocumentView1.MessageBoxSettings = messageBoxSettings1;
this.pdfDocumentView1.MinimumZoomPercentage = 50;
this.pdfDocumentView1.Name = "pdfDocumentView1";
this.pdfDocumentView1.PageBorderThickness = 1;
pdfViewerPrinterSettings1.PageOrientation = Syncfusion.Windows.PdfViewer.PdfViewerPrintOrientation.Auto;
pdfViewerPrinterSettings1.PageSize = Syncfusion.Windows.PdfViewer.PdfViewerPrintSize.ActualSize;
pdfViewerPrinterSettings1.PrintLocation = ((System.Drawing.PointF)(resources.GetObject("pdfViewerPrinterSettings1.PrintLocation")));
pdfViewerPrinterSettings1.ShowPrintStatusDialog = true;
this.pdfDocumentView1.PrinterSettings = pdfViewerPrinterSettings1;
this.pdfDocumentView1.ReferencePath = null;
this.pdfDocumentView1.ScrollDisplacementValue = 0;
this.pdfDocumentView1.ShowHorizontalScrollBar = true;
this.pdfDocumentView1.ShowVerticalScrollBar = true;
this.pdfDocumentView1.Size = new System.Drawing.Size(150, 150);
this.pdfDocumentView1.SpaceBetweenPages = 8;
this.pdfDocumentView1.TabIndex = 10;
textSearchSettings1.CurrentInstanceColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(255)))), ((int)(((byte)(171)))), ((int)(((byte)(64)))));
textSearchSettings1.HighlightAllInstance = true;
textSearchSettings1.OtherInstanceColor = System.Drawing.Color.FromArgb(((int)(((byte)(127)))), ((int)(((byte)(254)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))));
this.pdfDocumentView1.TextSearchSettings = textSearchSettings1;
this.pdfDocumentView1.ThemeName = "Default";
this.pdfDocumentView1.VerticalScrollOffset = 0;
this.pdfDocumentView1.VisualStyle = Syncfusion.Windows.Forms.PdfViewer.VisualStyle.Default;
this.pdfDocumentView1.ZoomMode = Syncfusion.Windows.Forms.PdfViewer.ZoomMode.FitPage;
//
// pictureBox1 // pictureBox1
// //
this.pictureBox1.ErrorImage = global::Mip.Properties.Resources.error; this.pictureBox1.ErrorImage = global::Mip.Properties.Resources.error;
@@ -518,6 +560,7 @@
// //
// radioButton1 // radioButton1
// //
this.radioButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.radioButton1.AutoSize = true; this.radioButton1.AutoSize = true;
this.radioButton1.Checked = true; this.radioButton1.Checked = true;
this.radioButton1.Location = new System.Drawing.Point(837, 12); this.radioButton1.Location = new System.Drawing.Point(837, 12);
@@ -530,6 +573,7 @@
// //
// radioButton2 // radioButton2
// //
this.radioButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.radioButton2.AutoSize = true; this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(837, 35); this.radioButton2.Location = new System.Drawing.Point(837, 35);
this.radioButton2.Name = "radioButton2"; this.radioButton2.Name = "radioButton2";
@@ -620,5 +664,6 @@
private System.Windows.Forms.TextBox textBox7; private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.RadioButton radioButton1; private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2; private System.Windows.Forms.RadioButton radioButton2;
private Syncfusion.Windows.Forms.PdfViewer.PdfDocumentView pdfDocumentView1;
} }
} }

View File

@@ -9,7 +9,6 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using System.IO;
namespace Mip namespace Mip
{ {
public partial class frmPridatVyrobok : Form public partial class frmPridatVyrobok : Form
@@ -33,7 +32,8 @@ namespace Mip
private void pictureBox1_MouseWheel(object sender, MouseEventArgs e) private void pictureBox1_MouseWheel(object sender, MouseEventArgs e)
{ {
if(pictureBox1.Image != null)
{
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
z += (Convert.ToSingle(0.1) * (e.Delta / Math.Abs(e.Delta))); z += (Convert.ToSingle(0.1) * (e.Delta / Math.Abs(e.Delta)));
pictureBox1.Height = Convert.ToInt32(sizeH * z); pictureBox1.Height = Convert.ToInt32(sizeH * z);
@@ -45,11 +45,13 @@ namespace Mip
groupBox1.Text = "Zobraziť výkres: " + dtrw.Cells["Nazov_suboru"].Value.ToString() + ", " + "Zoom= " + (Convert.ToSingle(pictureBox1.Width) / Convert.ToSingle(pictureBox1.Image.Width)).ToString(); groupBox1.Text = "Zobraziť výkres: " + dtrw.Cells["Nazov_suboru"].Value.ToString() + ", " + "Zoom= " + (Convert.ToSingle(pictureBox1.Width) / Convert.ToSingle(pictureBox1.Image.Width)).ToString();
} }
} }
}
private void frmPridatVyrobok_Load(object sender, EventArgs e) private void frmPridatVyrobok_Load(object sender, EventArgs e)
{ {
pomocnaDT.Columns.Add("Nazov_suboru",typeof (string)); pomocnaDT.Columns.Add("Nazov_suboru",typeof (string));
pomocnaDT.Columns.Add("Velkost_suboru",typeof (string)); pomocnaDT.Columns.Add("Velkost_suboru",typeof (string));
pomocnaDT.Columns.Add("Typ_suboru", typeof(string));
pomocnaDT.Columns.Add("Cesta",typeof (string)); pomocnaDT.Columns.Add("Cesta",typeof (string));
VypisSpojenyRozmer(); VypisSpojenyRozmer();
classGlobal.FillCB(comboBox2, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať iný názov"); classGlobal.FillCB(comboBox2, "tabpomocnychudajov", "Hodnota", "Kategoria", "Pridať iný názov");
@@ -62,28 +64,37 @@ namespace Mip
openFileDialog1.Multiselect = true; openFileDialog1.Multiselect = true;
openFileDialog1.DefaultExt = "jpg"; openFileDialog1.DefaultExt = "jpg";
openFileDialog1.Filter = "Obrázky (*.BMP;*.JPG;*.JPEG;*.GIF;*.PNG;*.EXIF;*.TIFF)|*.BMP;*.JPG;*.JPEG;*.GIF;*.PNG;*.EXIF;*.TIFF|" +
"Pdf súbory (*.pdf)|*.pdf";
openFileDialog1.FilterIndex = 1;
openFileDialog1.FileName = ""; openFileDialog1.FileName = "";
openFileDialog1.ShowDialog(); openFileDialog1.ShowDialog();
if (openFileDialog1.FileNames != null && openFileDialog1.FileName != "") if (openFileDialog1.FileNames != null && openFileDialog1.FileName != "")
{ {
foreach (string FN in openFileDialog1.FileNames) foreach (string Cesta in openFileDialog1.FileNames)
{ {
bool FNexist = false; bool CestaExist = false;
foreach (DataRow rowCesta in pomocnaDT.Rows) foreach (DataRow rowCesta in pomocnaDT.Rows)
{ {
if (rowCesta["Cesta"].ToString() == FN.ToString()) FNexist = true; if (rowCesta["Cesta"].ToString() == Cesta.ToString()) CestaExist = true;
} }
if (!FNexist) if (!CestaExist)
{ {
FileStream fileStream; FileStream fileStream;
fileStream = new FileStream(FN, FileMode.Open, FileAccess.Read); fileStream = new FileStream(Cesta, FileMode.Open, FileAccess.Read);
char[] help = new char[FN.Length - FN.LastIndexOf("\\") - 1]; //char[] help = new char[Cesta.Length - Cesta.LastIndexOf("\\") - 1];
FN.CopyTo(FN.LastIndexOf("\\") + 1, help, 0, (help.Length)); //Cesta.CopyTo(Cesta.LastIndexOf("\\") + 1, help, 0, (help.Length));
string hlp = new string(help); //string hlp = new string(help);
pomocnaDT.Rows.Add(hlp, FN.Length.ToString(), FN); var FileNameStart = Cesta.LastIndexOf("\\") + 1;
var FileName = Cesta.Substring(FileNameStart, Cesta.Length - FileNameStart);
var ExtensionStart = Cesta.LastIndexOf(".") + 1;
var Extension = Cesta.Substring(ExtensionStart, Cesta.Length - ExtensionStart);
pomocnaDT.Rows.Add(FileName, Cesta.Length.ToString(), Extension, Cesta);
dataGridView1.DataSource = pomocnaDT; dataGridView1.DataSource = pomocnaDT;
dataGridView1.AutoResizeColumns(); dataGridView1.AutoResizeColumns();
@@ -94,7 +105,7 @@ namespace Mip
} }
else else
{ {
MessageBox.Show("Súbor: " + FN + "\n už v zozname figuruje!", "Upozornenie ...", MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show("Súbor: " + Cesta + "\n už v zozname figuruje!", "Upozornenie ...", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//MessageBox.Show( //MessageBox.Show(
} }
@@ -167,23 +178,39 @@ namespace Mip
int fileSize; int fileSize;
byte[] fileData; byte[] fileData;
DataRow dRow; DataRow dRow;
dRow = pomocnaDT.Rows[index]; dRow = pomocnaDT.Rows[index];
var isPdf = dRow["Typ_suboru"].ToString() == "pdf";
if (isPdf)
{
FileStream pdfFileStream = new FileStream(dRow["Cesta"].ToString(), FileMode.Open, FileAccess.Read);
pictureBox1.Visible = false;
pdfDocumentView1.Visible = true;
pdfDocumentView1.Load(pdfFileStream);
pdfDocumentView1.ZoomMode = Syncfusion.Windows.Forms.PdfViewer.ZoomMode.FitWidth;
pdfDocumentView1.Dock = DockStyle.Fill;
}
else
{
fs = new FileStream(dRow["Cesta"].ToString(), FileMode.Open, FileAccess.Read); fs = new FileStream(dRow["Cesta"].ToString(), FileMode.Open, FileAccess.Read);
fileSize = (int)fs.Length; fileSize = (int)fs.Length;
fileData = new byte[fileSize]; fileData = new byte[fileSize];
fs.Read(fileData, 0, fileSize); fs.Read(fileData, 0, fileSize);
fs.Close(); fs.Close();
Bitmap obrazok; Bitmap obrazok;
//using (MemoryStream stream = new MemoryStream(fileData)) obrazok = new Bitmap(stream); //using (MemoryStream stream = new MemoryStream(fileData)) obrazok = new Bitmap(stream);
MemoryStream stream = new MemoryStream(fileData); MemoryStream stream = new MemoryStream(fileData);
obrazok = new Bitmap(stream); obrazok = new Bitmap(stream);
pictureBox1.Visible = true;
pictureBox1.Image = obrazok; pictureBox1.Image = obrazok;
pictureBox1.Height = obrazok.Height; pictureBox1.Height = obrazok.Height;
pictureBox1.Width = obrazok.Width; pictureBox1.Width = obrazok.Width;
sizeH = pictureBox1.Image.Size.Height; sizeH = pictureBox1.Image.Size.Height;
sizeW = pictureBox1.Image.Size.Width; sizeW = pictureBox1.Image.Size.Width;
pdfDocumentView1.Visible = false;
}
z = 1; z = 1;
} }

View File

@@ -117,6 +117,13 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="pdfViewerPrinterSettings1.PrintLocation" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFFTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj00LjAuMC4wLCBDdWx0
dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJh
d2luZy5Qb2ludEYCAAAAAXgBeQAACwsCAAAAAAAAAAAAAAAL
</value>
</data>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>