コード例 #1
0
        /// <summary>
        /// 给GroupBox_To控件更换一条数据
        /// </summary>
        /// <param name="itemStruct"></param>
        private void ChangedDataToGroupBox_To(SynthesisDataStruct.SynthesisItemStruct itemStruct)
        {
            GroupBox_To.Controls.Clear();
            SynthesisItemControl synthesisItemControl = new SynthesisItemControl(itemStruct);

            GroupBox_To.Controls.Add(synthesisItemControl);
            synthesisItemControl.Location = new Point(3, 23);
            synthesisItemControl.Size     = new Size(GroupBox_From.Size.Width - 6, 30);
            synthesisItemControl.Anchor   = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
        }
コード例 #2
0
        /// <summary>
        /// 给GroupBox_From控件添加一条数据
        /// </summary>
        /// <param name="itemStruct"></param>
        private void AddDataToGroupBox_From(SynthesisDataStruct.SynthesisItemStruct itemStruct)
        {
            SynthesisDataStruct.SynthesisItemStruct _itemStruct = itemStruct;
            SynthesisItemControl synthesisItemControl           = new SynthesisItemControl(_itemStruct);
            Button closeBtn = new Button();

            closeBtn.Text   = "×";
            closeBtn.Click += (sender, e) =>
            {
                GroupBox_From.Controls.Remove(synthesisItemControl);
                GroupBox_From.Controls.Remove(closeBtn);
                synthesisDataStruct.inputStruct = synthesisDataStruct.inputStruct.Where(temp => !temp.Equals(_itemStruct)).ToArray();
                UpdateGroupBox_From();
            };
            synthesisItemControl.Tag = closeBtn;
            closeBtn.Tag             = synthesisItemControl;
            GroupBox_From.Controls.Add(synthesisItemControl);
            GroupBox_From.Controls.Add(closeBtn);
            UpdateGroupBox_From();
        }