To reproduce:
1.Add a RadButton and on its Click event, show a RadMessageBox.
2.Add a RadDropDownList .
3.Drag several themes from the toolbox and drop them onto the form (e.g. Office2010Black, Office2010Blue, TelerikMetro, Windows8)
4.Use the following code:
public Form1()
{
InitializeComponent();
this.radDropDownList1.Items.Add("Office2010Black");
this.radDropDownList1.Items.Add("Office2010Blue");
this.radDropDownList1.Items.Add("TelerikMetro");
this.radDropDownList1.Items.Add("Windows8");
this.radDropDownList1.SelectedIndexChanged += radDropDownList1_SelectedIndexChanged;
this.radDropDownList1.SelectedItem = this.radDropDownList1.Items[0];
}
private void radDropDownList1_SelectedIndexChanged(object sender,
Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
{
string itemText = this.radDropDownList1.Items[e.Position].Text;
ThemeResolutionService.ApplicationThemeName = itemText;
}
private void radButton1_Click(object sender, EventArgs e)
{
RadMessageBox.Show("Some message", "Confirmation", MessageBoxButtons.OKCancel);
}
When you select a new item from the RadDropDownList, the theme for the entire application is changed. But when you click the button to show a RadMessageBox, the RadMessageBox has incorrect style for its buttons.
Workaround: set the RadMessageBox.ThemeName before showing it:
RadMessageBox.ThemeName = ThemeResolutionService.ApplicationThemeName;
RadMessageBox.Show("Some message", "Confirmation", MessageBoxButtons.OKCancel);
To reproduce: Create a RadFrom, make it MDIParent and add MDI children Set the RightToLeft property of the MDIParent to Yes and you will see that the the left side of the child forms is a little cut off. This can be seen by comparing the distance between the end of the form and the X button.
RadMessageBox - Buttons are not arranged correctly in RTL
Workaround: use RadRibbonForm instead or set minimum and maximum size
To reproduce:
1. Open a RadForm
2. Maximize the form.
3. Restore the form. Then we can see odd line on the bottom of title bar / top of the form. If you resize the form (make it bigger), new visible areas of form doesn't contain this weird line.
Workaround:
protected override void WndProc(ref Message m)
{
FormWindowState currentWindowState = this.WindowState;
base.WndProc(ref m);
if (currentWindowState == FormWindowState.Maximized && this.WindowState== FormWindowState.Normal)
{
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
}
}
To reproduce:
Create a RadForm and set the property as follows:
public Form1()
{
InitializeComponent();
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
}
Workaround:
Set the ShowIcon property to false:
public Form1()
{
InitializeComponent();
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.ShowIcon = false;
}
To reproduce: Show RadMessageBox as follows: RadMessageBox.Show(this, "מסר כלשהו", "Caption", MessageBoxButtons.OKCancel, RadMessageIcon.Error, MessageBoxDefaultButton.Button1, RightToLeft.Yes, "מסר2 כלשהו"); Open the details button and you will see that the text is כלשהו מסר2
To reproduce:
Create a RadForm and use the following code:
public Form1()
{
InitializeComponent();
var theme = new Telerik.WinControls.Themes.Windows7Theme();
ThemeResolutionService.ApplicationThemeName = theme.ThemeName;// "Windows7";
this.AllowTheming = false;
}
Start the application on Windows 7, you will see that the close/minimize/maximize buttons cannot be clicked.
Workaround:
Do not set the AllowTheming property or set it to true
Please refer to the attached screenshot. Workaround: use a RadForm without RadRibbonFormBehavior and hide the FormElement.TitleBar.
To reproduce:
private void radButton1_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
RadMessageBox.Show("Do you want to exit?", "Confirmation", MessageBoxButtons.YesNo);
}
Workaround: Show the RadMessageBox first and then call the Application.Exit method according to the DialogResult.
DECLINED:
When Application.Exit() is called it iterates through all forms and for each of them calls the FormClosing event. Currently the RadMessageBox is shown in a new form. So in this case during the iterating forms collection a new form is added and this causes the exception "Collection was modified; enumeration operation may not execute.".
This is expected behavior and there are two possible solutions to prevent application from throwing exception:
- Use this.Close(); to close the application.
- Make your checks, show RadMessageBox and after that, if needed call Application.Exit();
To reproduce:
public partial class Form1 : RadForm
{
public Form1()
{
InitializeComponent();
this.IsMdiContainer = true;
}
private void radButton1_Click(object sender, EventArgs e)
{
RadForm childForm = new RadForm();
childForm.Text = "MDI Child " + DateTime.Now.ToShortTimeString();
childForm.MdiParent = this;
childForm.WindowState = FormWindowState.Maximized;
childForm.Show();
}
}
To reproduce: - Create blank WinForms RadForm Application. - Set WindowState property to Maximized. - Add RadGroupBox to the form. Set equal space on all sides. - Anchor the group box to all sides. - Launch application - spacing around outside of group box is incorrect. - Restore form to normal size - spacing around group box is incorrect. Workaround: radGroupBox1.Dock = DockStyle.Fill; radGroupBox1.GroupBoxElement.Margin = new Padding(20);
For the time being to show the grid I would recommend you to use an empty RadStatusStrip.
To reproduce:
1. Use the following code snippet:
RadMessageBox.Show("RadMessageBox Some message box text", "Caption", MessageBoxButtons.OK, RadMessageIcon.Error);
2. The text is not aligned with the icon
When you have a RadPageViewPage with a TableLayoutPanel inside a RadForm, by changing the theme the TableLayoutPanel is shrinking. Pleas find attached a sample project. Workaround: use a ShapedForm instead of RadForm/RadRibbonForm.
To reproduce: - Add form and set its AutoScroll property to true. add some controls so the scrollbars appear. - Dock the form in a smaller window as a MDI child. Workaround - Use scrollable panel.
Broken in Q2 2015 Workaround: get current dpi settings and resize the form float dpiX = 0; float dpiY = 0; Graphics graphics = this.CreateGraphics(); dpiX = graphics.DpiX; dpiY = graphics.DpiY; this.Width *= dpiX / 96; this.Height *= dpiY / 96;
To reproduce:
- Set the MaximizedBounds property so the form takes the entire right part of the screen, the change the windows state at runtime:
private void radButton1_Click(object sender, EventArgs e)
{
setFormMaximizedBounds(200);
}
private void radButton2_Click(object sender, EventArgs e)
{
setFormMaximizedBounds(-1);
}
private void setFormMaximizedBounds(int distance)
{
if (distance >= 0)
{
var ownerScreen = Screen.FromControl(this);
var workingArea = ownerScreen.WorkingArea;
var x = workingArea.X + distance;
var y = workingArea.Y;
var w = workingArea.Width - distance;
var h = workingArea.Height;
this.MaximizedBounds = new Rectangle(x, y, w, h);
}
else
{
this.MaximizedBounds = new Rectangle(0, 0, 0, 0);
}
if (this.WindowState == FormWindowState.Maximized)
{
this.WindowState = FormWindowState.Normal;
this.WindowState = FormWindowState.Maximized;
}
}
How to reproduce:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.IsMdiContainer = true;
this.Load += Form1_Load;
}
private void Form1_Load(object sender, EventArgs e)
{
RadForm form = new RadForm();
form.Text = "MDI Child 1";
form.MdiParent = this;
form.Show();
}
private void radButton1_Click(object sender, EventArgs e)
{
RadForm activeChild = this.ActiveMdiChild as RadForm;
if (activeChild == null)
{
MessageBox.Show("no active form child found!");
return;
}
else
{
SaveAsBitmap(activeChild, activeChild + ".Jpeg");
MessageBox.Show("Screen Captured successfully.");
}
}
public void SaveAsBitmap(Form form, string fileName)
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif";
if (dialog.ShowDialog() == DialogResult.OK)
{
Bitmap bmp = new Bitmap(form.Width, form.Height);
form.DrawToBitmap(bmp, new Rectangle(0, 0, form.Width, form.Height));
bmp.Save(dialog.FileName, ImageFormat.Jpeg);
}
}
}
Workaround:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.IsMdiContainer = true;
this.Load += Form1_Load;
}
private void Form1_Load(object sender, EventArgs e)
{
RadForm form = new RadForm();
form.Text = "MDI Child 1";
form.MdiParent = this;
form.Show();
}
private void radButton1_Click(object sender, EventArgs e)
{
RadForm activeChild = this.ActiveMdiChild as RadForm;
if (activeChild == null)
{
MessageBox.Show("no active form child found!");
return;
}
else
{
SaveAsBitmap(activeChild, activeChild + ".Jpeg");
MessageBox.Show("Screen Captured successfully.");
}
}
public void SaveAsBitmap(Form form, string fileName)
{
Bitmap bmpScreenshot = new Bitmap(form.Bounds.Width, form.Bounds.Height, PixelFormat.Format32bppArgb);
Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot);
Point pt = form.Parent.PointToScreen(form.Location);
gfxScreenshot.CopyFromScreen(pt.X, pt.Y, 0, 0, form.Bounds.Size, CopyPixelOperation.SourceCopy);
SaveFileDialog saveImageDialog = new SaveFileDialog();
saveImageDialog.Title = "Select output file:";
saveImageDialog.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif";
if (saveImageDialog.ShowDialog() == DialogResult.OK)
{
bmpScreenshot.Save(saveImageDialog.FileName, ImageFormat.Png);
}
}
}