2023-09-22 03:59:56 +04:00

61 lines
1.8 KiB
C#

using CustomComponents.Classes;
using System.Text;
namespace TestForms
{
public partial class TestFrame : Form
{
public TestFrame()
{
InitializeComponent();
}
private void clearButton_Click(object sender, EventArgs e)
{
listBox.Clear();
}
private void fillButton_Click(object sender, EventArgs e)
{
listBox.PopulateList(new List<string> { "SILENT", "RIZZ", "BLSSDY", "YUEEJKE" });
}
private void buttonConfigureGridView_Click(object sender, EventArgs e)
{
frameCustomGridView1.ColumnConfiguration(5,
new List<string>() { "ID", "Login", "LoginTimes", "Town", "Creation" },
new List<int>() { 50, 50, 50, 50, 50 },
new List<bool> { true, true, true, true, true },
new List<string> { "ID", "Login", "LoginTimes", "Town", "Creation" });
buttonConfigureGridView.Visible = false;
fillGridViewButton.Visible = true;
getSelectedRowButton.Visible = true;
}
private void fillGridViewButton_Click(object sender, EventArgs e)
{
frameCustomGridView1.AddRows(new List<Account>()
{
new Account(1,"boba","idk"),
new Account(2,"biba","idk"),
new Account(3,"buba","idk")
});
}
private void getSelectedRowButton_Click(object sender, EventArgs e)
{
var obj = frameCustomGridView1.GetAccount<Account>();
var properties = obj.GetType().GetProperties();
StringBuilder sb = new StringBuilder();
foreach(var prop in properties)
{
sb.Append($"{prop.Name}: {prop.GetValue(obj)}\n");
}
MessageBox.Show( sb.ToString() );
}
}
}