Hello
I have some problem with displaying RadGroupBox on HDPI that host in UserControl/System.Windows.Form and must be AutoSize = true.
In our scenario, the RadGroupBox contains RadLabel and must change size depending on the size of the text. So we set AutoSize = true. However such RadGroupBox have incorrect font scaling in the header, the font becomes at least 2 times larger than it should be, and if GB is in the scrolling container (like in the example below) even larger.
If groupbox is hosted in RadForm the bug is not reproducible.
I use Telerik 2018.3.1016.20 with .Net 3.5
I very much rely on your help and advice.
Here are examples of my code and screenshots from different DPI.
100% (Form) https://c2n.me/3Z4oYcS
100% (RadForm) https://c2n.me/3Z4p2L0
200% (Form) https://clip2net.com/s/3Z4pjSv
200% (RadForm) https://clip2net.com/s/3Z4pbV0
using
System.ComponentModel;
using
System.Drawing;
using
System.Drawing.Drawing2D;
using
System.Windows.Forms;
using
Telerik.WinControls;
using
Telerik.WinControls.Primitives;
using
Telerik.WinControls.UI;
namespace
PP.DesignExamples.BugsForTelerik
{
public
class
Form6 : Form
{
private
RadScrollablePanel actionsScroll;
private
RadGroupBox gbAutosizeTrue;
private
RadLabel lblAutosizeTrueContent;
private
RadGroupBox gbAutosizeFalse;
private
RadLabel lblAutosizeFalseContent;
public
Form6()
{
InitializeComponent();
}
private
void
InitializeComponent()
{
actionsScroll =
new
RadScrollablePanel();
gbAutosizeTrue =
new
RadGroupBox();
lblAutosizeTrueContent =
new
RadLabel();
gbAutosizeFalse =
new
RadGroupBox();
lblAutosizeFalseContent =
new
RadLabel();
((ISupportInitialize)(actionsScroll)).BeginInit();
actionsScroll.PanelContainer.SuspendLayout();
actionsScroll.SuspendLayout();
((ISupportInitialize)(gbAutosizeTrue)).BeginInit();
gbAutosizeTrue.SuspendLayout();
((ISupportInitialize)(lblAutosizeTrueContent)).BeginInit();
((ISupportInitialize)(gbAutosizeFalse)).BeginInit();
gbAutosizeFalse.SuspendLayout();
((ISupportInitialize)(lblAutosizeFalseContent)).BeginInit();
SuspendLayout();
//
// actionsScroll
//
actionsScroll.BackColor = Color.Transparent;
actionsScroll.Dock = DockStyle.Fill;
actionsScroll.ForeColor = Color.Transparent;
actionsScroll.Location =
new
Point(0, 0);
actionsScroll.Margin =
new
Padding(0);
actionsScroll.MaximumSize =
new
Size(205, 0);
actionsScroll.MinimumSize =
new
Size(205, 0);
actionsScroll.Name =
"actionsScroll"
;
actionsScroll.Padding =
new
Padding(0);
//
// actionsScroll.PanelContainer
//
actionsScroll.PanelContainer.BackColor = Color.Transparent;
actionsScroll.PanelContainer.Controls.Add(gbAutosizeTrue);
actionsScroll.PanelContainer.Controls.Add(gbAutosizeFalse);
actionsScroll.PanelContainer.Location =
new
Point(0, 0);
actionsScroll.PanelContainer.Margin =
new
Padding(0);
actionsScroll.PanelContainer.Size =
new
Size(205, 423);
//
//
//
actionsScroll.RootElement.MaxSize =
new
Size(205, 0);
actionsScroll.RootElement.MinSize =
new
Size(205, 0);
actionsScroll.Size =
new
Size(205, 423);
actionsScroll.TabIndex = 4;
((RadScrollablePanelElement)(actionsScroll.GetChildAt(0))).Padding =
new
Padding(0);
((FillPrimitive)(actionsScroll.GetChildAt(0).GetChildAt(0))).Visibility = ElementVisibility.Hidden;
((BorderPrimitive)(actionsScroll.GetChildAt(0).GetChildAt(1))).Width = 0F;
((BorderPrimitive)(actionsScroll.GetChildAt(0).GetChildAt(1))).LeftWidth = 0F;
((BorderPrimitive)(actionsScroll.GetChildAt(0).GetChildAt(1))).TopWidth = 0F;
((BorderPrimitive)(actionsScroll.GetChildAt(0).GetChildAt(1))).RightWidth = 0F;
((BorderPrimitive)(actionsScroll.GetChildAt(0).GetChildAt(1))).BottomWidth = 0F;
((BorderPrimitive)(actionsScroll.GetChildAt(0).GetChildAt(1))).Visibility = ElementVisibility.Hidden;
//
// gbAutosizeTrue
//
gbAutosizeTrue.AccessibleRole = AccessibleRole.Grouping;
gbAutosizeTrue.AutoSize =
true
;
gbAutosizeTrue.BackColor = Color.Transparent;
gbAutosizeTrue.Controls.Add(lblAutosizeTrueContent);
gbAutosizeTrue.Dock = DockStyle.Top;
gbAutosizeTrue.GroupBoxStyle = RadGroupBoxStyle.Office;
gbAutosizeTrue.HeaderText =
"AutoSize = true"
;
gbAutosizeTrue.Location =
new
Point(0, 100);
gbAutosizeTrue.MinimumSize =
new
Size(0, 100);
gbAutosizeTrue.Name =
"gbAutosizeTrue"
;
gbAutosizeTrue.Padding =
new
Padding(4, 28, 4, 0);
//
//
//
gbAutosizeTrue.RootElement.AutoSize =
false
;
gbAutosizeTrue.RootElement.MinSize =
new
Size(0, 100);
gbAutosizeTrue.Size =
new
Size(205, 100);
gbAutosizeTrue.TabIndex = 8;
gbAutosizeTrue.Text =
"AutoSize = true"
;
((RadGroupBoxElement)(gbAutosizeTrue.GetChildAt(0))).Padding =
new
Padding(4, 28, 4, 0);
((FillPrimitive)(gbAutosizeTrue.GetChildAt(0).GetChildAt(0).GetChildAt(0))).BackColor = Color.FromArgb(176, 223, 226);
((GroupBoxHeader)(gbAutosizeTrue.GetChildAt(0).GetChildAt(1))).GroupBoxStyle = RadGroupBoxStyle.Office;
((GroupBoxHeader)(gbAutosizeTrue.GetChildAt(0).GetChildAt(1))).ForeColor = Color.DodgerBlue;
((FillPrimitive)(gbAutosizeTrue.GetChildAt(0).GetChildAt(1).GetChildAt(0))).BackColor = Color.Transparent;
((FillPrimitive)(gbAutosizeTrue.GetChildAt(0).GetChildAt(1).GetChildAt(0))).SmoothingMode = SmoothingMode.None;
((FillPrimitive)(gbAutosizeTrue.GetChildAt(0).GetChildAt(1).GetChildAt(0))).AutoSize =
true
;
((FillPrimitive)(gbAutosizeTrue.GetChildAt(0).GetChildAt(1).GetChildAt(0))).Margin =
new
Padding(0);
((TextPrimitive)(gbAutosizeTrue.GetChildAt(0).GetChildAt(1).GetChildAt(2).GetChildAt(1))).Text =
"AutoSize = true"
;
((TextPrimitive)(gbAutosizeTrue.GetChildAt(0).GetChildAt(1).GetChildAt(2).GetChildAt(1))).LineLimit =
false
;
((TextPrimitive)(gbAutosizeTrue.GetChildAt(0).GetChildAt(1).GetChildAt(2).GetChildAt(1))).Font =
new
Font(
"Arial"
, 11.25F, FontStyle.Bold, GraphicsUnit.Point, 0);
((TextPrimitive)(gbAutosizeTrue.GetChildAt(0).GetChildAt(1).GetChildAt(2).GetChildAt(1))).Margin =
new
Padding(7, 0, 0, 0);
((TextPrimitive)(gbAutosizeTrue.GetChildAt(0).GetChildAt(1).GetChildAt(2).GetChildAt(1))).Alignment = ContentAlignment.MiddleLeft;
//
// lblAutosizeTrueContent
//
lblAutosizeTrueContent.Dock = DockStyle.Top;
lblAutosizeTrueContent.Location =
new
Point(4, 28);
lblAutosizeTrueContent.Margin =
new
Padding(16);
lblAutosizeTrueContent.Name =
"lblAutosizeTrueContent"
;
//
//
//
lblAutosizeTrueContent.RootElement.MaxSize =
new
Size(0, 0);
lblAutosizeTrueContent.Size =
new
Size(197, 18);
lblAutosizeTrueContent.TabIndex = 2;
lblAutosizeTrueContent.Text =
"description will be here"
;
((RadLabelElement)(lblAutosizeTrueContent.GetChildAt(0))).TextAlignment = ContentAlignment.MiddleLeft;
((RadLabelElement)(lblAutosizeTrueContent.GetChildAt(0))).Text =
"description will be here"
;
((FillPrimitive)(lblAutosizeTrueContent.GetChildAt(0).GetChildAt(0))).AutoSizeMode = RadAutoSizeMode.Auto;
((FillPrimitive)(lblAutosizeTrueContent.GetChildAt(0).GetChildAt(0))).StretchHorizontally =
false
;
//
// gbAutosizeFalse
//
gbAutosizeFalse.AccessibleRole = AccessibleRole.Grouping;
gbAutosizeFalse.BackColor = Color.Transparent;
gbAutosizeFalse.Controls.Add(lblAutosizeFalseContent);
gbAutosizeFalse.Dock = DockStyle.Top;
gbAutosizeFalse.GroupBoxStyle = RadGroupBoxStyle.Office;
gbAutosizeFalse.HeaderText =
"AutoSize = false"
;
gbAutosizeFalse.Location =
new
Point(0, 0);
gbAutosizeFalse.MinimumSize =
new
Size(0, 100);
gbAutosizeFalse.Name =
"gbAutosizeFalse"
;
gbAutosizeFalse.Padding =
new
Padding(4, 28, 4, 0);
//
//
//
gbAutosizeFalse.RootElement.AutoSize =
false
;
gbAutosizeFalse.RootElement.MinSize =
new
Size(0, 100);
gbAutosizeFalse.Size =
new
Size(205, 100);
gbAutosizeFalse.TabIndex = 8;
gbAutosizeFalse.Text =
"AutoSize = false"
;
((RadGroupBoxElement)(gbAutosizeFalse.GetChildAt(0))).Padding =
new
Padding(4, 28, 4, 0);
((FillPrimitive)(gbAutosizeFalse.GetChildAt(0).GetChildAt(0).GetChildAt(0))).BackColor = Color.FromArgb(176, 223, 226);
((GroupBoxHeader)(gbAutosizeFalse.GetChildAt(0).GetChildAt(1))).GroupBoxStyle = RadGroupBoxStyle.Office;
((GroupBoxHeader)(gbAutosizeFalse.GetChildAt(0).GetChildAt(1))).ForeColor = Color.DodgerBlue;
((FillPrimitive)(gbAutosizeFalse.GetChildAt(0).GetChildAt(1).GetChildAt(0))).BackColor = Color.Transparent;
((FillPrimitive)(gbAutosizeFalse.GetChildAt(0).GetChildAt(1).GetChildAt(0))).SmoothingMode = SmoothingMode.None;
((FillPrimitive)(gbAutosizeFalse.GetChildAt(0).GetChildAt(1).GetChildAt(0))).AutoSize =
true
;
((FillPrimitive)(gbAutosizeFalse.GetChildAt(0).GetChildAt(1).GetChildAt(0))).Margin =
new
Padding(0);
((TextPrimitive)(gbAutosizeFalse.GetChildAt(0).GetChildAt(1).GetChildAt(2).GetChildAt(1))).Text =
"AutoSize = false"
;
((TextPrimitive)(gbAutosizeFalse.GetChildAt(0).GetChildAt(1).GetChildAt(2).GetChildAt(1))).LineLimit =
false
;
((TextPrimitive)(gbAutosizeFalse.GetChildAt(0).GetChildAt(1).GetChildAt(2).GetChildAt(1))).Font =
new
Font(
"Arial"
, 11.25F, FontStyle.Bold, GraphicsUnit.Point, 0);
((TextPrimitive)(gbAutosizeFalse.GetChildAt(0).GetChildAt(1).GetChildAt(2).GetChildAt(1))).Margin =
new
Padding(7, 0, 0, 0);
((TextPrimitive)(gbAutosizeFalse.GetChildAt(0).GetChildAt(1).GetChildAt(2).GetChildAt(1))).Alignment = ContentAlignment.MiddleLeft;
//
// lblAutosizeFalseContent
//
lblAutosizeFalseContent.Dock = DockStyle.Top;
lblAutosizeFalseContent.Location =
new
Point(4, 28);
lblAutosizeFalseContent.Margin =
new
Padding(16);
lblAutosizeFalseContent.Name =
"lblAutosizeFalseContent"
;
//
//
//
lblAutosizeFalseContent.RootElement.MaxSize =
new
Size(0, 0);
lblAutosizeFalseContent.Size =
new
Size(197, 18);
lblAutosizeFalseContent.TabIndex = 2;
lblAutosizeFalseContent.Text =
"description will be here"
;
((RadLabelElement)(lblAutosizeFalseContent.GetChildAt(0))).TextAlignment = ContentAlignment.MiddleLeft;
((RadLabelElement)(lblAutosizeFalseContent.GetChildAt(0))).Text =
"description will be here"
;
((FillPrimitive)(lblAutosizeFalseContent.GetChildAt(0).GetChildAt(0))).AutoSizeMode = RadAutoSizeMode.Auto;
((FillPrimitive)(lblAutosizeFalseContent.GetChildAt(0).GetChildAt(0))).StretchHorizontally =
false
;
//
// Form6
//
AutoScaleDimensions =
new
SizeF(6F, 13F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize =
new
Size(311, 423);
Controls.Add(actionsScroll);
Name =
"Form6"
;
Text =
"Form6"
;
actionsScroll.PanelContainer.ResumeLayout(
false
);
actionsScroll.PanelContainer.PerformLayout();
((ISupportInitialize)(actionsScroll)).EndInit();
actionsScroll.ResumeLayout(
false
);
((ISupportInitialize)(gbAutosizeTrue)).EndInit();
gbAutosizeTrue.ResumeLayout(
false
);
gbAutosizeTrue.PerformLayout();
((ISupportInitialize)(lblAutosizeTrueContent)).EndInit();
((ISupportInitialize)(gbAutosizeFalse)).EndInit();
gbAutosizeFalse.ResumeLayout(
false
);
gbAutosizeFalse.PerformLayout();
((ISupportInitialize)(lblAutosizeFalseContent)).EndInit();
ResumeLayout(
false
);
}
}
}