1. Set HDPI on your monitor (for example 150%)
2. Set RadDataEntry data source in RunTime
You will see that RadDataEntry hosted controls are not scaled correctly.
Note that there is a related problem if the data source is set in design time. Controls themselves will be scaled correctly, however, text box hosted control's High will not be scaled correctly.
Workaround:
You can subscribe to ItemInitializing event before you set the DataSource and proceed by scaling RadDataEntry hosted controls manually as shown in the following code snipped.
private void radButton1_Click(object sender, EventArgs e)
{
this.radDataEntry1.ItemInitializing += RadDataEntry1_ItemInitializing;
this.radDataEntry1.ItemDefaultSize = new Size(200, 26);
radDataEntry1.DataSource = new Employee
{
FirstName = "Sarah",
LastName = "Blake",
Occupation = "Supplied Manager",
StartingDate = new DateTime(2005, 04, 12),
IsMarried = true,
Salary = 3500,
Gender = Gender.Female
};
}
private void RadDataEntry1_ItemInitializing(object sender, ItemInitializingEventArgs e)
{
if (this.radDataEntry1.RootElement.DpiScaleFactor.Width != 1)
{
foreach (Control control in e.Panel.Controls)
{
control.Scale(this.radDataEntry1.RootElement.DpiScaleFactor);
}
}
}
1. Set the DPI of your main monitor to 150% and the DPI of your secondary monitor to 100%.
2. Start your main form containing RadDataEntry on your secondary monitor.
You will see that that hosted controls inside RadDataEntry are not scaled correctly.
Workaround:
Start your main form on your secondary monitor inside OnShown event.
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
this.Location = new Point(-800, 100);
}
I have a form which contains TreeView control. I need to convert it to RadTreeView. So I replaced TreeView control with RadTreeView and TreeNode with RadTreeNode in the code. I found that the events in both are different, so tried to replace the events with similar events in RadTree.
Following are the events that I have replaced in my code :
1.
Private Sub TreeView1_AfterExpand(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvMain.AfterExpand
Replaced by -
Private Sub TreeView1_AfterExpand(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.RadTreeViewEventArgs) Handles tvMain.NodeExpandedChanged
2.
Private Sub TreeView1_AfterCollapse(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvMain.AfterCollapse
Replaced by -
Private Sub TreeView1_AfterCollapse(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.RadTreeViewEventArgs) Handles tvMain.NodeExpandedChanged
and included Expanded flag to check if it is expand or collapse.
Here, I noticed unwanted firing of this replaced event when compared to the old event, but I handled it using the Expanded flag.
3.
Private Sub tvMain_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvMain.AfterSelect
Replaced by -
Private Sub tvMain_AfterSelect(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.RadTreeViewEventArgs) Handles tvMain.SelectedNodesChanged
This event gets fired twice while clicking on a node.
My main issues are,
How to reproduce: enabled High DPI scaling and create a form as an MDI child with a RadDataEntry control in it Workaround: handle the Shown event of the MDI child and manually perform the scaling private void radButtonElement1_Click(object sender, EventArgs e) { var view = new RadForm1 { MdiParent = this }; view.Shown += View_Shown; view.Show(); } private void ScaleRadControls(Control c) { foreach (var item in c.Controls) { Control control = item as Control; if (control == null) { continue; } this.mi.Invoke(control, new object[] { this.FormElement.DpiScaleFactor, BoundsSpecified.All }); ScaleRadControls(control); } } MethodInfo mi; private void View_Shown(object sender, EventArgs e) { this.mi = typeof(Control).GetMethod("ScaleControl", BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[] { typeof(SizeF), typeof(BoundsSpecified) }, null); RadForm1 v = sender as RadForm1; if (v != null) { ScaleRadControls(v.radDataEntry1.PanelContainer); } }
Use attached to reproduce.
Workaround:
public RadForm1()
Hi Dess,
I have encountered some other issue here. text of the button is not displaying in this case.
I have set DrawText property as true, UseCompatibleTextRendering as true and TextImageRelation as true. still the text is not displaying only the image is showing. Could you please go thruogh the same project again
attaching the previous link https://feedback.telerik.com/winforms/1480197-event-not-firing-in-commandbar-button-in-radcommandbar-button
Thanks
Binshidha
HI,
Exploring the Demo Winforms FilterView component a bug is present.
When you expand several categories ,the automatic Vertical Scroll bar is showed but the "Maximum" property value is wrong.
You can't see all the items inside. Some items are hidden at bottom.
But if you collapse some category the new "Maximum" values takes the right previous value before collapsing showing more space as expected
I have a workaround to prevent this situation calling CategoryExpandedChanged event.
Firstly I need to call Application.DoEvents() in order to resizing internally by the component all the StackLayoutPanels connaining the Category Items
After that, I call the private method UpdateScrollBars (Suggested by support) and the ScrollBar takes the right size for its content.
Now I can show all the contained items inside the FilterView panel.
FRC
public partial class RadForm1 : Telerik.WinControls.UI.RadForm
{
public RadForm1()
{
InitializeComponent();
DataTable dt = new DataTable();
for (int i = 0; i < 20; i++)
{
dt.Columns.Add("col" + i, typeof(string));
}
for (int i = 0; i < 10; i++)
{
DataRow r = dt.NewRow();
foreach (DataColumn col in dt.Columns)
{
r[col.ColumnName] = Guid.NewGuid().ToString();
}
dt.Rows.Add(r);
}
this.radFilterView1.DataSource = dt;
}
private void radFilterView1_CategoryCreated(object sender, Telerik.WinControls.UI.FilterView.FilterViewCategoryCreatedEventArgs e)
{
e.Category.ExpandedChanged += Category_ExpandedChanged;
e.Category.Expanded = false;
}
private void Category_ExpandedChanged(object? sender, EventArgs e)
{
// You need pass the control to Windows main loop to perform the pending telerik events after property Expanded change in order to resize internally
// the StackLayoutPanel Containers before calling UpdateScrollBars
Application.DoEvents();
// Now your code
MethodInfo mi = typeof(RadFilterViewElement).GetMethod("UpdateScrollbars", BindingFlags.Instance | BindingFlags.NonPublic);
mi.Invoke(this.radFilterView1.FilterViewElement, new object[] { this.radFilterView1.FilterViewElement.ElementsPanel.Size });
// Hide the horizontal scrolll bar
radFilterView1.FilterViewElement.HorizontalScrollBar.Visibility =ElementVisibility.Collapsed;
}
}
When we have start position set to center screen:
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
RadForm does not calculate the correct location of the form on HDPI devices.
As workaround please, rename the controls with Find & Replace from VS Editor.
Setting the SyntaxEditorElement.HorizontalScrollBar.Visibility property to Collapsed indeed hides the horizontal scrollbar but it is still measured and arranged and overlaps the view if you shrink the view: