I was hoping to edit the style of the checkmark in the UltraCheckboxEditor for WindowsForms. Can anyone help me with this?
NOTE: The information in this post show's the "hard way", read Mike's response to find out how to use the CheckedAppearance.Image property to acheive the same thing.
I suspect you're looking to replace the checkmark with a custom glyph? If this is the case, you will need to use a DrawFilter to take over painting of the checkbox area. DrawFilters are basically hooks into the painting routine for any given UIElement. In this case, you'll want to use the CheckIndicatorUIElement and either override the BeforeDrawElement phase, or paint over top of the checkmark using the AfterDrawElement phase. Here's a stubbed out version that takes complete control over painting the checkbox.
private void Form1_Load(object sender, EventArgs e)
{
this.ultraCheckEditor1.DrawFilter = this;
}
#region IUIElementDrawFilter Members
public bool DrawElement(Infragistics.Win.DrawPhase drawPhase, ref Infragistics.Win.UIElementDrawParams drawParams)
//get the rectangle we need to draw in
Rectangle elementRect = drawParams.Element.Rect;
//T"ODO Draw Custom checkbox and glyph here
return true;
public Infragistics.Win.DrawPhase GetPhasesToFilter(ref Infragistics.Win.UIElementDrawParams drawParams)
//Use the CheckIndicatorUIElement and listen for the BeforeDrawElement phase
if (drawParams.Element is Infragistics.Win.CheckIndicatorUIElement)
return Infragistics.Win.DrawPhase.BeforeDrawElement;
return Infragistics.Win.DrawPhase.None;
Actually... there is a much easier way. Simply set the Style of the Control to Custom. Then specify the Image property on the Appearance (for unchecked) and CheckAppearance (for checked).
Thx, the first suggestion works perfect.
Can't use the GlyphInfo, since we are stuck with v7.2 for the moment being...
Yes. Put an UltraCheckEditor control on the form with the grid and do the same thing I described above - set the Style to Custom and apply images to the CheckedAppearance (for checked) and Appearance (for unchecked). Then set the grid's Column's EditorControl property to the UltraCheckEditor.
If you are using v8.2, you have even more control using the new GlyphInfo feature. Instead of setting the CheckBox Style to custom, just go to the GlyphInfo property and you can edit the checkbox images inevery possible state.
Can the same thing be done in an UltraGrid with a checkbox column?
Oh right.. the easy way. I just assumed everyone wanted to do it the hard way.