Beispiel #1
0
        // TODO: font, etc....

        public static void Apply(Control control, ThemeButtonBase themer)
        {
            // FIXME: doesn't seem to work on toolstrip items...
            control.Padding = themer.Padding;
            control.Margin  = themer.Margin;

            if (!themer.Size.IsEmpty)
            {
                control.Size = themer.Size;
            }
        }
Beispiel #2
0
        public static void Apply(ButtonBase button, ThemeButtonBase themer)
        {
            ThemeControl.Apply(button, themer);

            if (themer.TextImageFlags.HasFlag(TextImageFlags.Image))
            {
                if (string.IsNullOrEmpty(themer.Image.Path))
                {
                    return;
                }

                if (!File.Exists(themer.Image.Path))
                {
                    return;
                }

                Bitmap bitmap = new Bitmap(themer.Image.Path);

                if (!themer.Image.Size.IsEmpty)
                {
                    Bitmap oldBitmap = bitmap;

                    bitmap = new Bitmap(oldBitmap, themer.Image.Size);

                    oldBitmap.Dispose();
                }

                if (bitmap == null)
                {
                    return;
                }

                button.TextImageRelation = themer.TextImageRelation;

                if (!themer.TextImageFlags.HasFlag(TextImageFlags.Text))
                {
                    button.Text = "";
                }

                button.MinimumSize = bitmap.Size;
                button.Image       = (Bitmap)bitmap.Clone();
                bitmap.Dispose();
            }
        }