Beispiel #1
0
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider, object Value)
        {
            Hyperlink hyperlink = context.Instance is Hyperlink ?
                                  context.Instance as Hyperlink : ((object[])context.Instance)[0] as Hyperlink;

            if (hyperlink != null)
            {
                edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                ComponentRefListBox lb = new ComponentRefListBox();
                lb.PopulateList(hyperlink.Report, typeof(ReportPage), hyperlink.Parent.Page);
                if (Value != null)
                {
                    lb.SelectedIndex = lb.Items.IndexOf(Value);
                }
                lb.Click += new EventHandler(lb_Click);
                if (FSize.Width > 0)
                {
                    lb.Size = FSize;
                }

                edSvc.DropDownControl(lb);
                FSize = lb.Size;
                ReportPage page = lb.SelectedObject as ReportPage;
                if (page != null)
                {
                    page.Visible = false;
                }
                return(page == null ? "" : page.Name);
            }
            return(Value);
        }
Beispiel #2
0
        /// <inheritdoc/>
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider, object Value)
        {
            // this method is called when we click on drop-down arrow
            if (context != null && context.Instance is ReportComponentBase)
            {
                edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                ComponentRefListBox lb = new ComponentRefListBox();
                lb.PopulateList((context.Instance as ReportComponentBase).Band, context.Instance.GetType(), context.Instance);
                if (Value != null)
                {
                    lb.SelectedIndex = lb.Items.IndexOf(Value);
                }
                lb.Click += new EventHandler(lb_Click);
                if (FSize.Width > 0)
                {
                    lb.Size = FSize;
                }

                edSvc.DropDownControl(lb);
                FSize = lb.Size;

                return(lb.SelectedObject);
            }
            return(Value);
        }