Exemple #1
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (edSvc != null)
         {
             EasyGridDetail dg = context.Instance as EasyGridDetail;
             if (dg != null)
             {
                 UserControlSelectFieldNames fns = new UserControlSelectFieldNames();
                 string[] ss = value as string[];
                 fns.LoadData(edSvc, dg.GetFieldNames(context.PropertyDescriptor.Name), ss);
                 edSvc.DropDownControl(fns);
                 if (fns.SelectedStrings != null)
                 {
                     value = fns.SelectedStrings;
                 }
             }
             else
             {
                 EasyDataSet eds = context.Instance as EasyDataSet;
                 if (eds != null)
                 {
                     EasyDataSet master = eds.Master as EasyDataSet;
                     if (master != null)
                     {
                         if (eds.Field_Name != null && master.Field_Name != null)
                         {
                             List <string> commonFlds = new List <string>();
                             for (int i = 0; i < master.Field_Name.Length; i++)
                             {
                                 for (int j = 0; j < eds.Field_Name.Length; j++)
                                 {
                                     if (string.Compare(eds.Field_Name[j], master.Field_Name[i], StringComparison.OrdinalIgnoreCase) == 0)
                                     {
                                         commonFlds.Add(master.Field_Name[i]);
                                         break;
                                     }
                                 }
                             }
                             if (commonFlds.Count > 0)
                             {
                                 UserControlSelectFieldNames fns = new UserControlSelectFieldNames();
                                 string[] ss = value as string[];
                                 fns.LoadData(edSvc, commonFlds.ToArray(), ss);
                                 edSvc.DropDownControl(fns);
                                 if (fns.SelectedStrings != null)
                                 {
                                     value = fns.SelectedStrings;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return(value);
 }
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form4));
     this.TextBox1        = new System.Windows.Forms.TextBox();
     this.EasyGridDetail1 = new LimnorDatabase.EasyGridDetail();
     this.components      = new System.ComponentModel.Container();
     ((System.ComponentModel.ISupportInitialize)(EasyGridDetail1)).BeginInit();
     this.SuspendLayout();
     //
     // TextBox1
     //
     this.TextBox1.AutoCompleteCustomSource.AddRange(new string[] {
         "3-4 70",
         "8-9 90"
     });
     this.TextBox1.Location = new System.Drawing.Point(71, 214);
     this.TextBox1.Name     = "TextBox1";
     this.TextBox1.Size     = new System.Drawing.Size(100, 20);
     this.TextBox1.TabIndex = 0;
     //
     // EasyGridDetail1
     //
     this.EasyGridDetail1.AutoGenerateColumns         = false;
     this.EasyGridDetail1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
     this.EasyGridDetail1.DataPreparer        = null;
     this.EasyGridDetail1.DetailsKeyColumns   = null;
     this.EasyGridDetail1.Field_DataSize      = new int[0];
     this.EasyGridDetail1.Field_Editor        = null;
     this.EasyGridDetail1.Field_Expression    = new string[0];
     this.EasyGridDetail1.Field_FieldCaption  = new string[0];
     this.EasyGridDetail1.Field_FieldText     = new string[0];
     this.EasyGridDetail1.Field_FromTableName = new string[0];
     this.EasyGridDetail1.Field_Indexed       = new bool[0];
     this.EasyGridDetail1.Field_Iscalculated  = new bool[0];
     this.EasyGridDetail1.Field_IsIdentity    = new bool[0];
     this.EasyGridDetail1.Field_Name          = new string[0];
     this.EasyGridDetail1.Field_OleDbType     = new System.Data.OleDb.OleDbType[0];
     this.EasyGridDetail1.Field_ReadOnly      = new bool[0];
     this.EasyGridDetail1.From             = null;
     this.EasyGridDetail1.GroupBy          = null;
     this.EasyGridDetail1.Having           = null;
     this.EasyGridDetail1.Limit            = null;
     this.EasyGridDetail1.Location         = new System.Drawing.Point(12, 44);
     this.EasyGridDetail1.Master           = null;
     this.EasyGridDetail1.MasterKeyColumns = null;
     this.EasyGridDetail1.Name             = "EasyGridDetail1";
     this.EasyGridDetail1.OrderBy          = null;
     this.EasyGridDetail1.Param_Name       = new string[0];
     this.EasyGridDetail1.Param_OleDbType  = new System.Data.OleDb.OleDbType[0];
     this.EasyGridDetail1.Param_Value      = new string[0];
     this.EasyGridDetail1.RowIndex         = -1;
     this.EasyGridDetail1.Size             = new System.Drawing.Size(240, 150);
     this.EasyGridDetail1.SqlTop           = 0;
     this.EasyGridDetail1.TabIndex         = 1;
     this.EasyGridDetail1.TableName        = "Table920273386";
     this.EasyGridDetail1.TableToUpdate    = null;
     this.EasyGridDetail1.Where            = null;
     //
     // Form4
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.ClientSize          = new System.Drawing.Size(282, 257);
     this.Controls.Add(this.TextBox1);
     this.Controls.Add(this.EasyGridDetail1);
     this.DrawingLayerList = ((Limnor.Drawing2D.DrawingLayerHeaderList)(resources.GetObject("$this.DrawingLayerList")));
     this.Name             = "Form4";
     this.Text             = "Form4";
     EasyGridDetail1.CreateDataTable();
     EasyGridDetail1.Query();
     ((System.ComponentModel.ISupportInitialize)(EasyGridDetail1)).EndInit();
     this.ResumeLayout(false);
     this.PerformLayout();
 }