Use the attached sample project and click the button:
at Telerik.WinControls.TelerikPaintHelper.GenerateSnapShotWithBitBlt(Control control) at Telerik.WinControls.UI.RadWaitingBar.AddBackgroundImageToAssociatedControlCoverPanel() at Telerik.WinControls.UI.RadWaitingBar.ShowCover() at Telerik.WinControls.UI.RadWaitingBar.StartWaiting() at TelerikWinFormsApp1.RadForm1.radButton1_Click(Object sender, EventArgs e) in C:\Projects\1564934_telerikwinformsapp1\TelerikWinFormsApp1\RadForm1.cs:line 31
Workaround:
public class CustomWaitingBar : RadWaitingBar
{
protected override void AddBackgroundImageToAssociatedControlCoverPanel()
{
Size associatedControlSize = this.AssociatedControl.Size;
if (associatedControlSize.Width <= 0 || associatedControlSize.Height <= 0)
{
return;
}
Bitmap controlImage = new Bitmap(associatedControlSize.Width, associatedControlSize.Height);
this.AssociatedControl.DrawToBitmap(controlImage, new Rectangle(Point.Empty, associatedControlSize));
SolidBrush semiTransBrush = new SolidBrush(this.AssociatedControlCoverPanel.BackColor); // Color.FromArgb(128, 255, 255, 255) Default color
Graphics g = Graphics.FromImage(controlImage);
g.FillRectangle(semiTransBrush, new Rectangle(Point.Empty, controlImage.Size));
this.AssociatedControlCoverPanel.BackgroundImage = controlImage;
}
public override string ThemeClassName
{
get
{
return typeof(RadWaitingBar).FullName;
}
}
}
Run the attached project, click the button and minimize the form.
StackTrace:
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format) at System.Drawing.Bitmap..ctor(Int32 width, Int32 height) at Telerik.WinControls.TelerikPaintHelper.GenerateSnapShotWithBitBlt(Control control) at Telerik.WinControls.UI.RadWaitingBar.AddBackgroundImageToAssociatedControlCoverPanel() at Telerik.WinControls.UI.RadWaitingBar.UpdateAssociatedControlLocations() at Telerik.WinControls.UI.RadWaitingBar.associatedControlCover_Layout(Object sender, LayoutEventArgs e) at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent) at System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent) at Telerik.WinControls.RadControl.OnLayout(LayoutEventArgs e) at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args) at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty) at System.Windows.Forms.Control.OnResize(EventArgs e) at System.Windows.Forms.Control.OnSizeChanged(EventArgs e) at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight) at System.Windows.Forms.Control.UpdateBounds() at System.Windows.Forms.Control.WmWindowPosChanged(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at Telerik.WinControls.RadControl.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
When the AssociatedControl property is set to form. It makes a screenshot and places it as a background. However, when Form is set, the image will be placed under the Form title bar and duplicates the title bar. The following image demonstrates this.
As a workaround, you can place a panel as the first child of the form and construct your layout. After you can set this panel to the AssociatedControl property.