I need to add a scroll bar for a component when the user changes his font size to 125% or 150%. To do this, I added a method to the component that sets the AutoScroll property to true.
protected override void OnSizeChanged(EventArgs e) { if (SystemFonts.DefaultFont.Size < 8) { this.AutoScroll = true; } if (this.Handle != null) { this.BeginInvoke((MethodInvoker) delegate { base.OnSizeChanged(e); }); } }
This works well, but one of the components should not have a scroll bar.
The above method will be launched upon initialization of such controllers:
this.ultraExpandableGroupBoxPanel1.Controls.Add(this.pnlViewMode); this.ultraExpandableGroupBoxPanel1.Controls.Add(this.ucASNSearchCriteria); resources.ApplyResources(this.ultraExpandableGroupBoxPanel1, "ultraExpandableGroupBoxPanel1"); this.ultraExpandableGroupBoxPanel1.Name = "ultraExpandableGroupBoxPanel1";
The method will be activated when added to the controls, after which the resource will be applied. The component that I do not want to change relates to ucASNSearchCriteria in the above code.
Now I want to set the AutoScroll property 'ucASNSearchCriteria' to false after the resource has been applied. I have little information about the rendering process of C # ui controls. Is it possible to dynamically change properties after application?
source share