image insert, select, save

main
syneffort 3 years ago
parent 234dfcc52d
commit 371a079ad2
  1. 33
      MainApp/MainApp/AdoClient.cs
  2. 181
      MainApp/MainApp/Controls/Image_Insert_Select_Control.Designer.cs
  3. 145
      MainApp/MainApp/Controls/Image_Insert_Select_Control.cs
  4. 120
      MainApp/MainApp/Controls/Image_Insert_Select_Control.resx
  5. 62
      MainApp/MainApp/Controls/Sql_Param_Control.Designer.cs
  6. 57
      MainApp/MainApp/Controls/Sql_Param_Control.cs
  7. 120
      MainApp/MainApp/Controls/Sql_Param_Control.resx
  8. 29
      MainApp/MainApp/MainApp.csproj
  9. 10
      MainApp/MainApp/MainForm.cs
  10. 73
      MainApp/MainApp/Properties/app.manifest
  11. 39
      MainApp/MainApp/Util.cs

@ -67,6 +67,24 @@ namespace MainApp
}
}
public DataSet Query(string paramedSql, SqlParameter[] sqlParams)
{
using (conn = new SqlConnection(connString))
{
conn.Open();
SqlCommand cmd = new SqlCommand(paramedSql, conn);
cmd.Parameters.AddRange(sqlParams);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet);
conn.Close();
return dataSet;
}
}
public int NonQuery(string sql)
{
using (conn = new SqlConnection(connString))
@ -77,5 +95,20 @@ namespace MainApp
return cmd.ExecuteNonQuery();
}
}
public void NonQuery(string paramedSql, SqlParameter[] sqlParams)
{
using (conn = new SqlConnection(connString))
{
conn.Open();
SqlCommand cmd = new SqlCommand(paramedSql, conn);
cmd.Parameters.AddRange(sqlParams);
cmd.ExecuteNonQuery();
conn.Close();
}
}
}
}

@ -0,0 +1,181 @@

namespace MainApp.Controls
{
partial class Image_Insert_Select_Control
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 구성 요소 디자이너에서 생성한 코드
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.pictureBox = new System.Windows.Forms.PictureBox();
this.saveButton = new System.Windows.Forms.Button();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.uploadButton = new System.Windows.Forms.Button();
this.selectButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.indexTextbox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.tableLayoutPanel2.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.pictureBox, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.saveButton, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 2);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 3;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(554, 549);
this.tableLayoutPanel1.TabIndex = 6;
//
// pictureBox
//
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox.Location = new System.Drawing.Point(3, 33);
this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(548, 478);
this.pictureBox.TabIndex = 4;
this.pictureBox.TabStop = false;
//
// saveButton
//
this.saveButton.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.saveButton.Location = new System.Drawing.Point(457, 3);
this.saveButton.Name = "saveButton";
this.saveButton.Size = new System.Drawing.Size(94, 23);
this.saveButton.TabIndex = 2;
this.saveButton.Text = "Save";
this.saveButton.UseVisualStyleBackColor = true;
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 5;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 50F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 50F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
this.tableLayoutPanel2.Controls.Add(this.uploadButton, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.selectButton, 4, 0);
this.tableLayoutPanel2.Controls.Add(this.label1, 2, 0);
this.tableLayoutPanel2.Controls.Add(this.indexTextbox, 3, 0);
this.tableLayoutPanel2.Controls.Add(this.nameLabel, 0, 0);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 517);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(548, 29);
this.tableLayoutPanel2.TabIndex = 5;
//
// uploadButton
//
this.uploadButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.uploadButton.Location = new System.Drawing.Point(251, 3);
this.uploadButton.Name = "uploadButton";
this.uploadButton.Size = new System.Drawing.Size(94, 23);
this.uploadButton.TabIndex = 0;
this.uploadButton.Text = "Upload";
this.uploadButton.UseVisualStyleBackColor = true;
this.uploadButton.Click += new System.EventHandler(this.uploadButton_Click);
//
// selectButton
//
this.selectButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.selectButton.Location = new System.Drawing.Point(451, 3);
this.selectButton.Name = "selectButton";
this.selectButton.Size = new System.Drawing.Size(94, 23);
this.selectButton.TabIndex = 2;
this.selectButton.Text = "Select";
this.selectButton.UseVisualStyleBackColor = true;
this.selectButton.Click += new System.EventHandler(this.selectButton_Click);
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Location = new System.Drawing.Point(351, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(44, 29);
this.label1.TabIndex = 1;
this.label1.Text = "Index :";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// indexTextbox
//
this.indexTextbox.Dock = System.Windows.Forms.DockStyle.Fill;
this.indexTextbox.Location = new System.Drawing.Point(401, 3);
this.indexTextbox.Name = "indexTextbox";
this.indexTextbox.Size = new System.Drawing.Size(44, 21);
this.indexTextbox.TabIndex = 1;
this.indexTextbox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.indexTextbox_KeyUp);
//
// nameLabel
//
this.nameLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(3, 8);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(0, 12);
this.nameLabel.TabIndex = 3;
//
// Image_Insert_Select_Control
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "Image_Insert_Select_Control";
this.Size = new System.Drawing.Size(554, 549);
this.tableLayoutPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.PictureBox pictureBox;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Button uploadButton;
private System.Windows.Forms.Button selectButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox indexTextbox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Button saveButton;
}
}

@ -0,0 +1,145 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MainApp.Controls
{
public partial class Image_Insert_Select_Control : UserControl
{
public Image_Insert_Select_Control()
{
InitializeComponent();
InitInstance();
}
private void InitInstance()
{
pictureBox.SizeMode = PictureBoxSizeMode.Zoom;
if (!AdoClient.Instance.SetConnection("peacecloud.synology.me,21433", "Study", "study", "Study123$"))
{
MessageBox.Show("Cannot access database.");
return;
}
}
private void uploadButton_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() != DialogResult.OK)
return;
Image img = Image.FromFile(dlg.FileName);
pictureBox.Image = img;
byte[] imgByteArray = Util.ImageToByteArray(img);
string paramedSql = "INSERT INTO IMAGE (name, image, createdAt) VALUES (@name, @image, @createdAt)";
SqlParameter[] sqlParams = new SqlParameter[3];
sqlParams[0] = new SqlParameter("@name", SqlDbType.NVarChar);
string name = Guid.NewGuid().ToString();
nameLabel.Text = name;
sqlParams[0].Value = name;
sqlParams[1] = new SqlParameter("@image", SqlDbType.VarBinary);
sqlParams[1].Value = imgByteArray;
sqlParams[2] = new SqlParameter("@createdAt", SqlDbType.DateTime);
sqlParams[2].Value = DateTime.Now;
AdoClient.Instance.NonQuery(paramedSql, sqlParams);
GC.Collect();
}
private void selectButton_Click(object sender, EventArgs e)
{
int idx = -1;
if (!int.TryParse(indexTextbox.Text, out idx))
{
MessageBox.Show("Invalid index");
return;
}
DataSet dataSet = AdoClient.Instance.Query($"SELECT * FROM IMAGE WHERE idx = {idx}");
if (dataSet == null ||
dataSet.Tables == null || dataSet.Tables.Count < 1 ||
dataSet.Tables[0].Rows == null || dataSet.Tables[0].Rows.Count < 1 ||
dataSet.Tables[0].Rows[0].ItemArray == null)
{
MessageBox.Show("No matched data");
return;
}
object[] selectedObj = dataSet.Tables[0].Rows[0].ItemArray;
string name = (string)selectedObj[1];
DateTime createdAt = (DateTime)selectedObj[3];
nameLabel.Text = $"{name}@[{createdAt.ToString("yyyy-MM-dd HH:mm:ss")}]";
byte[] imgByteArray = (byte[])selectedObj[2];
Image img = Util.ByteToImage(imgByteArray);
pictureBox.Image = img;
GC.Collect();
}
private void saveButton_Click(object sender, EventArgs e)
{
if (pictureBox.Image == null)
{
MessageBox.Show("No Image to save");
return;
}
SaveFileDialog dlg = new SaveFileDialog();
dlg.Filter = "png type|*.png|bmp type|*.bmp|jpg type|*.jpg";
if (dlg.ShowDialog() != DialogResult.OK)
return;
ImageFormat imageFormat = null;
switch (dlg.FilterIndex)
{
case 1:
imageFormat = ImageFormat.Png;
break;
case 2:
imageFormat = ImageFormat.Bmp;
break;
case 3:
imageFormat = ImageFormat.Jpeg;
break;
default:
MessageBox.Show("Invalid Type");
break;
}
if (imageFormat == null)
{
return;
}
Util.SaveImage(dlg.FileName, pictureBox.Image, imageFormat);
GC.Collect();
}
private void indexTextbox_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode != Keys.Enter)
return;
selectButton_Click(sender, e);
}
}
}

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -0,0 +1,62 @@

namespace MainApp.Controls
{
partial class Sql_Param_Control
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 구성 요소 디자이너에서 생성한 코드
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.mainGridView = new System.Windows.Forms.DataGridView();
((System.ComponentModel.ISupportInitialize)(this.mainGridView)).BeginInit();
this.SuspendLayout();
//
// mainGridView
//
this.mainGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.mainGridView.Dock = System.Windows.Forms.DockStyle.Fill;
this.mainGridView.Location = new System.Drawing.Point(0, 0);
this.mainGridView.Name = "mainGridView";
this.mainGridView.RowTemplate.Height = 23;
this.mainGridView.Size = new System.Drawing.Size(282, 237);
this.mainGridView.TabIndex = 3;
//
// Sql_Param_Control
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.mainGridView);
this.Name = "Sql_Param_Control";
this.Size = new System.Drawing.Size(282, 237);
((System.ComponentModel.ISupportInitialize)(this.mainGridView)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView mainGridView;
}
}

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MainApp.Controls
{
public partial class Sql_Param_Control : UserControl
{
public Sql_Param_Control(string job, DateTime hiredate)
{
InitializeComponent();
InitInstance(job, hiredate);
}
private void InitInstance(string job, DateTime hiredate)
{
if (!AdoClient.Instance.SetConnection("peacecloud.synology.me,21433", "Study", "study", "Study123$"))
{
MessageBox.Show("Cannot access database.");
return;
}
DoWork(job, hiredate);
}
private void BindTableToGridView(DataTable table)
{
mainGridView.SuspendLayout();
mainGridView.DataSource = table;
mainGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
mainGridView.ResumeLayout();
}
private void DoWork(string job, DateTime hiredate)
{
string paramedSql = "SELECT * FROM EMPLOYEE WHERE JOB = @job AND HIREDATE >= @hiredate";
SqlParameter[] sqlParams = new SqlParameter[]
{
new SqlParameter("@job", SqlDbType.VarChar),
new SqlParameter("@hiredate", SqlDbType.Date)
};
sqlParams[0].Value = job;
sqlParams[1].Value = hiredate;
DataSet dataSet = AdoClient.Instance.Query(paramedSql, sqlParams);
BindTableToGridView(dataSet.Tables[0]);
}
}
}

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -31,6 +31,15 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -46,6 +55,12 @@
<ItemGroup>
<Compile Include="AdoClient.cs" />
<Compile Include="Client.cs" />
<Compile Include="Controls\Image_Insert_Select_Control.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\Image_Insert_Select_Control.Designer.cs">
<DependentUpon>Image_Insert_Select_Control.cs</DependentUpon>
</Compile>
<Compile Include="Controls\Insert_Select_Control.cs">
<SubType>UserControl</SubType>
</Compile>
@ -64,6 +79,12 @@
<Compile Include="Controls\Multiple_Query_Control.Designer.cs">
<DependentUpon>Multiple_Query_Control.cs</DependentUpon>
</Compile>
<Compile Include="Controls\Sql_Param_Control.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\Sql_Param_Control.Designer.cs">
<DependentUpon>Sql_Param_Control.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
@ -72,6 +93,10 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Util.cs" />
<EmbeddedResource Include="Controls\Image_Insert_Select_Control.resx">
<DependentUpon>Image_Insert_Select_Control.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\Insert_Select_Control.resx">
<DependentUpon>Insert_Select_Control.cs</DependentUpon>
</EmbeddedResource>
@ -81,6 +106,9 @@
<EmbeddedResource Include="Controls\Multiple_Query_Control.resx">
<DependentUpon>Multiple_Query_Control.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\Sql_Param_Control.resx">
<DependentUpon>Sql_Param_Control.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
@ -93,6 +121,7 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

@ -38,7 +38,15 @@ namespace MainApp
//control.Dock = DockStyle.Fill;
//this.Controls.Add(control);
Multiple_Query_Control control = new Multiple_Query_Control();
//Multiple_Query_Control control = new Multiple_Query_Control();
//control.Dock = DockStyle.Fill;
//this.Controls.Add(control);
//Sql_Param_Control control = new Sql_Param_Control("tester", DateTime.Now.AddDays(-1));
//control.Dock = DockStyle.Fill;
//this.Controls.Add(control);
Image_Insert_Select_Control control = new Image_Insert_Select_Control();
control.Dock = DockStyle.Fill;
this.Controls.Add(control);
}

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 매니페스트 옵션
Windows 사용자 계정 컨트롤 수준을 변경하려면
requestedExecutionLevel 노드를 다음 중 하나로 바꿉니다.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
requestedExecutionLevel 요소를 지정하면 파일 및 레지스트리 가상화를 사용하지 않습니다.
이전 버전과의 호환성을 위해 애플리케이션에 가상화가 필요한 경우
이 요소를 제거합니다.
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" Unrestricted="true" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 이 애플리케이션이 테스트되고 함께 작동하도록 설계된 Windows 버전
목록입니다. 해당 요소의 주석 처리를 제거하면 Windows에서
호환 가능성이 가장 큰 환경을 자동으로 선택합니다. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- 애플리케이션이 DPI를 인식하며 높은 DPI에서 Windows가 자동으로 스케일링하지
않음을 나타냅니다. WPF(Windows Presentation Foundation) 애플리케이션은 자동으로 DPI를 인식하며
옵트인할 필요가 없습니다. 이 설정에 옵트인한 .NET Framework 4.6을 대상으로 하는
Windows Forms 애플리케이션은 app.config에서 'EnableWindowsFormsHighDpiAutoResizing' 설정도 'true'로 설정해야 합니다.
애플리케이션이 긴 경로를 인식하도록 설정합니다. https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation을 참조하세요. -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<!-- Windows 공용 컨트롤 및 대화 상자의 테마 사용(Windows XP 이상) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
namespace MainApp
{
class Util
{
public static byte[] ImageToByteArray(Image image)
{
using (MemoryStream ms = new MemoryStream())
{
image.Save(ms, image.RawFormat);
return ms.ToArray();
}
}
public static Bitmap ByteToImage(byte[] imgByteArray)
{
using (MemoryStream ms = new MemoryStream(imgByteArray))
{
Bitmap img = Image.FromStream(ms) as Bitmap;
return img;
}
}
public static void SaveImage(string fileName, Image img, ImageFormat format)
{
using (Image saveImage = new Bitmap(img))
{
saveImage.Save(fileName, format);
}
}
}
}
Loading…
Cancel
Save