using SelfHelpClient.BO; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace SelfHelpClient { public partial class ItemSelect : Template { List list; ReadCardForm form; public ItemSelect(List mlist, ReadCardForm mForm) { InitializeComponent(); form = mForm; list = mlist; this.WindowState = FormWindowState.Maximized; } protected override void OnLoad(EventArgs e) { base.OnLoad(e); uDataGridView1.DataSource = list; uDataGridView1.ClearSelection(); uDataGridView1.Refresh(); } private void uDataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) return; form.VEntity = uDataGridView1.CurrentRow.DataBoundItem as ViewEntity; DialogResult = DialogResult.OK; } private void backBtn_Click(object sender, EventArgs e) { this.Close(); } Pen penSelected = new Pen(Color.FromArgb(215, 218, 243)); private void uDataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { var rec = e.RowBounds; Point pTopStart = new Point(rec.X, rec.Y + 1); Point pTopEnd = new Point(rec.X + rec.Width, rec.Y + 1); e.Graphics.DrawLine(penSelected, pTopStart, pTopEnd); Point pLeftStart = new Point(rec.X + 1, rec.Y); Point pLeftEnd = new Point(rec.X + 1, rec.Y + rec.Height); e.Graphics.DrawLine(penSelected, pLeftStart, pLeftEnd); Point pRightStart = new Point(rec.X + rec.Width - 1, rec.Y); Point pRightEnd = new Point(rec.X + rec.Width - 1, rec.Y + rec.Height); e.Graphics.DrawLine(penSelected, pRightStart, pRightEnd); } } }