/// <summary> /// UI删除 /// </summary> /// <param name="uic"></param> private void DeleteImage(UiControl uic) { this.list_UI.Remove(uic); this.tabControl1.TabPages[0].Controls.Remove(uic); list_UI.ForEach(x => { x.TabIndex = list_UI.IndexOf(x); x.Location = CalculateUiLoca(x.TabIndex); }); }
/// <summary> /// ui修改 /// </summary> /// <param name="uic"></param> private void FixImage(UiControl uic) { this.Hide(); CaptureForm capture = GetCaptureForm(); if (capture.ShowDialog() == DialogResult.OK) { uic.uiInfo = new UiInfo(capture._captureImg, capture._captureLoca, capture._clickLoca); uic.UiImage = capture._captureImg; } this.Show(); }
/* * * * 5678 * 3478 * 2468 * * * 000 1 * 001 2 * 010 3 * 011 4 * 100 5 * 101 6 * 110 7 * 111 8 * */ #region ==============================方法 /// <summary> /// 添加UI /// </summary> /// <param name="ui"></param> private void AddNewUI(Bitmap img, Point img_loca, Point click_loca, bool isLoad) { UiInfo ui = new UiInfo(img.Clone() as Bitmap, img_loca, click_loca); if (isLoad) { ui._img._relativeLocal = img_loca; ui._clickLoca = click_loca; } UiControl ui_ctr = new UiControl(); ui_ctr.TabIndex = list_UI.Count; ui_ctr.Location = CalculateUiLoca(list_UI.Count); ui_ctr.uiInfo = ui; ui_ctr.DoFixImage = FixImage; ui_ctr.DoDeleteImage = DeleteImage; ui_ctr.TextLoca = ui._clickLoca.X + "," + ui._clickLoca.Y; ui_ctr.UiImage = ui._img._img; this.tabControl1.TabPages[0].Controls.Add(ui_ctr); this.list_UI.Add(ui_ctr); }