void SetPadding(string l, PropertyExpr pe, bool bMinus) //Josh: Eddited to allow negative padding on top and left
 {
     if (!_pri.IsExpression(pe.Expression))
     {
         DesignerUtility.ValidateSize(pe.Expression, true, /*false*/ bMinus);
     }
     SetStyleValue(l, pe.Expression);
 }
        public override object ConvertTo(ITypeDescriptorContext context,
                                         CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string) && value is PropertyExpr)
            {
                PropertyExpr pe = value as PropertyExpr;
                return(pe.Expression);
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider,
                                         object value)
        {
            if ((context == null) || (provider == null))
            {
                return(base.EditValue(context, provider, value));
            }

            // Access the Property Browser's UI display service
            IWindowsFormsEditorService editorService =
                (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (editorService == null)
            {
                return(base.EditValue(context, provider, value));
            }

            // Create an instance of the UI editor form
            IReportItem iri = context.Instance as IReportItem;

            if (iri == null)
            {
                return(base.EditValue(context, provider, value));
            }
            PropertyReportItem pri = iri.GetPRI();

            PropertyExpr pe = value as PropertyExpr;

            if (pe == null)
            {
                return(base.EditValue(context, provider, value));
            }

            using (DialogExprEditor de = new DialogExprEditor(pri.Draw, pe.Expression, pri.Node))
            {
                // Display the UI editor dialog
                if (editorService.ShowDialog(de) == DialogResult.OK)
                {
                    // Return the new property value from the UI editor form
                    return(new PropertyExpr(de.Expression));
                }

                return(base.EditValue(context, provider, value));
            }
        }