Exemplo n.º 1
0
 public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (null != context && null != context.Instance && null != context.Container)
     {
         IElement element = context.Instance as IElement;
         if (null != element)
         {
             SourceField sf = GetSourceField(element);
             using (FieldBindDialog fbd = new FieldBindDialog(sf, null != value ? value.ToString() : null))
             {
                 if (sf == null)
                 {
                     fbd.BindingSourceField = false;
                 }
                 if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     IPmsReportDataBind dataBind = element as IPmsReportDataBind;
                     if (null != dataBind)
                     {
                         //Label要求知道数据源
                         dataBind.SourceField = fbd.SourceField;
                     }
                     fbd.Close();
                     return(fbd.Value);
                 }
             }
         }
     }
     return(base.EditValue(context, provider, value));
 }
Exemplo n.º 2
0
        private void FieldBindAction()
        {
            SourceField sf = GetSourceField(this);

            using (FieldBindDialog fbd = new FieldBindDialog(sf, null != DbField ? DbField : null))
            {
                if (sf == null)
                {
                    fbd.BindingSourceField = false;
                }
                if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    IPmsReportDataBind dataBind = this as IPmsReportDataBind;
                    if (null != dataBind)
                    {
                        dataBind.SourceField = fbd.SourceField;
                    }
                    DbField = fbd.Value;
                    NotifyDesignSurfaceChange();
                }
            }
        }