예제 #1
0
        public GridSettingForm()
        {
            InitializeComponent();
            this.dataGridView1.Rows.Add(new object[] { "幅", "5" });
            this.dataGridView1.Rows.Add(new object[] { "高さ", "5" });
            this.dataGridView1.Rows.Add(new object[] { "Xオフセット", "0" });
            this.dataGridView1.Rows.Add(new object[] { "Yオフセット", "0" });
            var row = new DataGridViewRow();
            var c   = new DataGridViewTextBoxCell
            {
                Value = "色"
            };

            row.Cells.Add(c);
            var cell = new ExDataGridViewComboBoxCell();

            cell.SelectIndexChanged += cell_SelectIndexChanged;
            cell.Items.Add(selectcolor);
            row.Cells.Add(cell);
            this.dataGridView1.Rows.Add(row);
            cell.ColumnName = "Column2";
            cell.SetEvent();
        }
예제 #2
0
 public void ChangeFlowSource(FlowDrawPanel flowDrawPanel, FlowSourceObjectBase source, Dictionary <string, string> data)
 {
     this.currentFlowDrawPanel = flowDrawPanel;
     try
     {
         while (dataGridView1.RowCount > 0)
         {
             if (dataGridView1[1, dataGridView1.RowCount - 1] is ExDataGridViewComboBoxCell exCell)
             {
                 exCell.ResetEvent();
             }
             dataGridView1.RowCount--;
         }
         if (flowDrawPanel != null && source != null && data != null)
         {
             foreach (CustomMemberInfo <PropertyInfo> propertyInfo in source.InProperties)
             {
                 var row  = new DataGridViewRow();
                 var cell = new DataGridViewTextBoxCell
                 {
                     Value       = propertyInfo.MemberInfo.Name,
                     ToolTipText = propertyInfo.ToolTipText
                 };
                 row.Cells.Add(cell);
                 var formatter          = TypeFormatterManager.GetFormatter(propertyInfo.MemberInfo.PropertyType);
                 DataGridViewCell cell2 = null;
                 if (formatter != null)
                 {
                     if (formatter.AllowedPropertyString != null && formatter.AllowedPropertyString.Length > 0)
                     {
                         var exCell = new ExDataGridViewComboBoxCell();
                         cell2 = exCell;
                         exCell.Items.AddRange(formatter.AllowedPropertyString);
                         exCell.Value = formatter.AllowedPropertyString[0];
                         row.Cells.Add(cell2);
                         this.dataGridView1.Rows.Add(row);
                         exCell.SetEvent();
                     }
                     else
                     {
                         if (CanValueButtonClick(source.Name, propertyInfo.MemberInfo.Name, propertyInfo.MemberInfo.PropertyType))
                         {
                             var buttonCell = new ButtonCell(source.Name, propertyInfo.MemberInfo.Name, propertyInfo.MemberInfo.PropertyType);
                             buttonCell.ButtonClick += buttonCell_ButtonClick;
                             cell2 = buttonCell;
                         }
                         else
                         {
                             cell2 = new DataGridViewTextBoxCell();
                         }
                         row.Cells.Add(cell2);
                         this.dataGridView1.Rows.Add(row);
                     }
                     if (data.ContainsKey(propertyInfo.MemberInfo.Name))
                     {
                         cell2.Value = data[propertyInfo.MemberInfo.Name];
                     }
                     cell2.ReadOnly = false;
                     cell2.Tag      = formatter;
                 }
                 else
                 {
                     cell2 = new DataGridViewTextBoxCell();
                     row.Cells.Add(cell2);
                     cell2.ReadOnly = true;
                     this.dataGridView1.Rows.Add(row);
                 }
             }
         }
     }
     catch (Exception)
     {
     }
 }