Ejemplo n.º 1
0
 protected override LayoutOptions Layout(PaintEventArgs e) {
     LayoutOptions layout = PaintPopupLayout(e, /* up = */ true);
     Debug.Assert(layout.GetPreferredSizeCore(LayoutUtils.MaxSize)
         == PaintPopupLayout(e, /* up = */ false).GetPreferredSizeCore(LayoutUtils.MaxSize),
         "The state of show3D should not effect PreferredSize");
     return layout;
 }
Ejemplo n.º 2
0
        protected override LayoutOptions Layout(PaintEventArgs e)
        {
            LayoutOptions layout = PaintLayout(e, up: false);

            Debug.Assert(layout.GetPreferredSizeCore(LayoutUtils.s_maxSize) == PaintLayout(e, /* up = */ true).GetPreferredSizeCore(LayoutUtils.s_maxSize),
                         "The state of up should not effect PreferredSize");
            return(layout);
        }
Ejemplo n.º 3
0
        internal override Size GetPreferredSizeCore(Size proposedSize)
        {
            if (Appearance == Appearance.Button)
            {
                return(ButtonAdapter.GetPreferredSizeCore(proposedSize));
            }

            using (Graphics measurementGraphics = WindowsFormsUtils.CreateMeasurementGraphics()) {
                using (PaintEventArgs pe = new PaintEventArgs(measurementGraphics, new Rectangle())) {
                    LayoutOptions options = Layout(pe);
                    return(options.GetPreferredSizeCore(proposedSize));
                }
            }
        }
Ejemplo n.º 4
0
        protected override LayoutOptions Layout(PaintEventArgs e)
        {
            LayoutOptions layout = PaintFlatLayout(e, /* up = */ false, /* check = */ true, Control.FlatAppearance.BorderSize);

#if DEBUG
            Size prefSize = layout.GetPreferredSizeCore(LayoutUtils.MaxSize);
            Debug.Assert(
                prefSize == PaintFlatLayout(e, /* up = */ false, /* check = */ false, Control.FlatAppearance.BorderSize).GetPreferredSizeCore(LayoutUtils.MaxSize) &&
                prefSize == PaintFlatLayout(e, /* up = */ true, /* check = */ false, Control.FlatAppearance.BorderSize).GetPreferredSizeCore(LayoutUtils.MaxSize) &&
                prefSize == PaintFlatLayout(e, /* up = */ true, /* check = */ true, Control.FlatAppearance.BorderSize).GetPreferredSizeCore(LayoutUtils.MaxSize),
                "The state of up and check should not effect PreferredSize");
#endif
            return(layout);
        }
Ejemplo n.º 5
0
        internal override Size GetPreferredSizeCore(Size proposedSize)
        {
            if (Appearance == Appearance.Button)
            {
                return(ButtonAdapter.GetPreferredSizeCore(proposedSize));
            }

            LayoutOptions options = default;

            using (var screen = GdiCache.GetScreenHdc())
                using (PaintEventArgs pe = new PaintEventArgs(screen, new Rectangle()))
                {
                    options = Layout(pe);
                }

            return(options.GetPreferredSizeCore(proposedSize));
        }
        internal override Size GetPreferredSizeCore(Size proposedSize)
        {
            if (Control.Appearance == Appearance.Button)
            {
                ButtonStandardAdapter adapter = new ButtonStandardAdapter(Control);
                return(adapter.GetPreferredSizeCore(proposedSize));
            }
            else
            {
                LayoutOptions options = default;
                using (var screen = GdiCache.GetScreenHdc())
                    using (PaintEventArgs pe = new PaintEventArgs(screen, new Rectangle()))
                    {
                        options = Layout(pe);
                    }

                return(options.GetPreferredSizeCore(proposedSize));
            }
        }