Hi there!
I've created a custom control to visualise some data. I want my control to take on the appearance of the Infragistics controls in my app.
These controls are styled at runtime using an .isl file.
How can I determine for example what the border of an UltraTextEditor control is at runtime, as its Appearance doesn't seem to contain this info!
Cheers,
James
Hi James,
The appearance resolution process is actually quite complicated. The UltraTextEditor considers many factors: the Application style library, it's own appearances, and it's current state (edit mode, hottracking, etc.).
So getting the colors for every possible state really isn't practical.
If you just want to get the basic color, then what I would do is place an UltraTextEditor on the form (or use one that is already on the form, if you already have one). Then you can use the ResolveAppearance method to get the resolved appearance for the control in the normal state:
AppearanceData appearanceData = new AppearanceData(); AppearancePropFlags appearancePropFlags = AppearancePropFlags.AllRender; this.ultraTextEditor1.ResolveAppearance(ref appearanceData, ref appearancePropFlags);
There's no way to get the state-specific appearances, though. So you won't be able to get the HotTracking appearance, for example, unless you call the ResolveAppearance method while the control is currently HotTracked, which would be very difficult, if not impossible.
Mike Saltzman said: Hi James, The appearance resolution process is actually quite complicated. The UltraTextEditor considers many factors: the Application style library, it's own appearances, and it's current state (edit mode, hottracking, etc.). So getting the colors for every possible state really isn't practical. If you just want to get the basic color, then what I would do is place an UltraTextEditor on the form (or use one that is already on the form, if you already have one). Then you can use the ResolveAppearance method to get the resolved appearance for the control in the normal state: AppearanceData appearanceData = new AppearanceData(); AppearancePropFlags appearancePropFlags = AppearancePropFlags.AllRender; this.ultraTextEditor1.ResolveAppearance(ref appearanceData, ref appearancePropFlags); There's no way to get the state-specific appearances, though. So you won't be able to get the HotTracking appearance, for example, unless you call the ResolveAppearance method while the control is currently HotTracked, which would be very difficult, if not impossible.
Hi Mike,
This looked promising for a while, but still doesn't see to work. perhaps I need to explain a bit more...
When I call ResolveAppearance on a text editor, I get nothing back in BorderColor, BorderColor2, BackColor, BackColor2 etc.
All I get is SystemColors.Control for the BorderColor3DBase property, which certainly doesn't match what I can see on screen!!
BTW... I am using v12.1 of the controls (stuck with a corporate standard build that doesn't support .net 4.0)
Hello James,
We strongly recommend that your custom control is derived from UltraTextEditor to match the appearance of your application.
public partial class CustomControl1 : UltraTextEditor { public CustomControl1() { InitializeComponent(); } protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); } }
public partial class CustomControl1 : UltraTextEditor
{ public CustomControl1() { InitializeComponent();
} protected override void OnPaint(PaintEventArgs pe)
{ base.OnPaint(pe);
}
What does your custom control derive from? If it derives from TextBox or anther inbox control then you can use the InboxControlStyler component found in the toolbox in VS to enable styling on your custom control without deriving from an Infragistics control. Styling options set in AppStylist will be applied to the custom control. Let me know if you have any questions regarding this matter.
Hi Michael,
That really doesn't work for me... I don't want any of the text editor's functionality... I just want to grab it's background color and border color and use them in my own custom paint event.
I don't want any editing features, I don't want a whole load of properties exposed to the designers.
And even then, I tried the approach, and my controls didn't get styled anyway!