KOP/TestingForm/FormMain.cs

117 lines
4.1 KiB
C#
Raw Normal View History

2024-10-16 01:47:44 +04:00
using Components.Nonvisual;
2024-10-04 11:22:00 +04:00
namespace TestingForm
{
public partial class FormMain : Form
{
public FormMain()
{
InitializeComponent();
}
2024-10-04 12:20:51 +04:00
private void button1_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog
{
Filter = "pdf|*.pdf",
};
if (dialog.ShowDialog() == DialogResult.OK)
{
List<string[][]> tables = new List<string[][]>();
string[][] table1 = new string[2][];
table1[0] = new string[] { "test", "test 2" };
table1[1] = new string[] { "test next", "test next 2" };
string[][] table2 = new string[3][];
table2[0] = new string[] { "ttt", "ttt 2", "ttt 3" };
table2[1] = new string[] { "ttt next", "ttt next 2" };
table2[2] = new string[] { "next" };
tables.Add(table1);
tables.Add(table2);
try
{
userControlTableDocument1.SaveToDocument(
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
dialog.FileName,
tables
);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
2024-10-16 01:47:44 +04:00
private void button2_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog
{
Filter = "pdf|*.pdf",
};
if (dialog.ShowDialog() == DialogResult.OK)
{
List<TestUser> users = new List<TestUser>
{
new TestUser(1, "user 1", 20, 50000),
new TestUser(2, "user 2", 19, 30000),
new TestUser(3, "user 3", 26, 70000)
};
try
{
userControlConfigurableTableDocument1.SaveToDocument(
dialog.FileName,
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
new List<(double width, string header, string propName)>
{
(2.0, "ID", "Id"),
(6.0, "<22><><EFBFBD>", "Name"),
(2.0, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "Age"),
(6.0, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "Salary"),
},
7.0,
2.0,
users
);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
private void button3_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog
{
Filter = "pdf|*.pdf",
};
if (dialog.ShowDialog() == DialogResult.OK)
{
Dictionary<string, int[]> data = new Dictionary<string, int[]>
{
{ "test 1", new int[] {1, 2, 3, 6, 7, 9} },
{ "test 2", new int[] {6, 8, 11, 16, 4, 2} },
};
try
{
userControlHist1.CreateHist(dialog.FileName, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "Test", LegendAlignment.Bottom, data);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
2024-10-04 11:22:00 +04:00
}
}