Completed
Last Updated: 08 Oct 2014 14:47 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 14 Jul 2014 10:51
Category: RibbonBar
Type: Bug Report
0
FIX. RadRibbonBar - Buttons with images are not rendered correctly when the form is maximized
To reproduce:
1. Add a RadRibbonBar and add several buttons with images as follows:

public Form1()
{
    InitializeComponent();

    RibbonTab tabItem1 = new RibbonTab();
    tabItem1.Text = "Manage";
    radRibbonBar1.CommandTabs.Add(tabItem1);

    RadRibbonBarGroup radRibbonBarGroup1 = new RadRibbonBarGroup();
    radRibbonBarGroup1.Text = "radRibbonBarGroup1";
    tabItem1.Items.Add(radRibbonBarGroup1);

    RadButtonElement radButtonElement1 = new RadButtonElement();
    radButtonElement1.Image = Properties.Resources.about;
    radButtonElement1.TextImageRelation = TextImageRelation.ImageBeforeText;
    radButtonElement1.Text = "First Button";
    radRibbonBarGroup1.Items.Add(radButtonElement1);

    RadButtonElement radButtonElement2 = new RadButtonElement();
    radButtonElement2.Image = Properties.Resources.about;
    radButtonElement2.TextImageRelation = TextImageRelation.ImageBeforeText;
    radButtonElement2.Text = "Second Button";
    radRibbonBarGroup1.Items.AddRange(new RadItem[] { radButtonElement1, radButtonElement2 });

    RadRibbonBarButtonGroup radRibbonBarButtonGroup1 = new RadRibbonBarButtonGroup();
    radRibbonBarButtonGroup1.Orientation = System.Windows.Forms.Orientation.Vertical;
    radRibbonBarButtonGroup1.ShowBorder = true;

    RadButtonElement radButtonElement3 = new RadButtonElement();
    radButtonElement3.Text = "Button One";
    radButtonElement3.Image = Properties.Resources.about;
    radButtonElement3.TextImageRelation = TextImageRelation.ImageBeforeText;

    RadButtonElement radButtonElement4 = new RadButtonElement();
    radButtonElement4.Text = "Button Two";
    radButtonElement4.Image = Properties.Resources.about;
    radButtonElement4.TextImageRelation = TextImageRelation.ImageBeforeText;
  
    radRibbonBarButtonGroup1.Items.AddRange(new RadItem[] { radButtonElement3, radButtonElement4 });
    radRibbonBarGroup1.Items.Add(radRibbonBarButtonGroup1);
}

2. Run the applications, re-size the form horizontally until all buttons are collapsed to smallest size, then click the form's maximize button. As a result all buttons are drawn without text.

Workaround:
protected override void WndProc(ref Message message)
{
    const int WM_SYSCOMMAND = 0x0112;
    const int SC_MAXIMIZE = 0xF030; 

    switch (message.Msg)
    {
        case WM_SYSCOMMAND:
            int command = message.WParam.ToInt32() & 0xfff0;
            if (command == SC_MAXIMIZE) 
            {
                this.Size = new System.Drawing.Size(300, 300);
            }
            break;
    }
    base.WndProc(ref message);
}
0 comments