Does OnPaintAdornments work with DesignSurface? -
10-03-2007
, 05:20 PM
I've been trying to figure out ControlDesigners of late... I have a
custom design surface in which I've used the OnPaint event to change
the visual appearance of my user controls. When I add a
ControlDesigner, all of the custom paint work goes away. So I added
an OnPaintAdornments and did the same work and nothing happens...
Apparently I'm missing something, just not sure what.
The original OnPaint is:
protected override void OnPaint(PaintEventArgs e) {
base.OnPaint(e);
PaintHelper.PaintBorder(e, this, borderColor, borderType,
borderSize);
}
The OnPaintAdornments is:
protected override void OnPaintAdornments(PaintEventArgs pe) {
base.OnPaintAdornments(pe);
KcRepeaterPanel ctrl = (KcRepeaterPanel)Control;
if (ctrl == null) return;
PaintHelper.PaintBorder(pe, ctrl, ctrl.BorderColor,
ctrl.BorderType, ctrl.BorderSize);
}
The parent class declaration and attribs:
[Designer(typeof(RepeaterPanelControlDesigner))]
[PropertyIncludeList(new string[] {
"Font",
"FontColor",
"BackgroundColor",
"PanelHeight",
//"ViewOnly", // Inverse of IsEnabled and stores out as
IsEnabled
//"IsVisible",
"AlphaTransparency",
"StartGradientColor",
"BorderColor",
"BorderSize",
"BorderType",
"HiddenControlList"
})]
[XmlClass(typeof(ControlSerializer))]
[XmlClassFieldInclude(new string[] {
"Font",
"FontColor",
"Location",
"Size",
"BackgroundColor",
"TabIndex",
"Controls",
"IsEnabled",
"IsVisible",
"AlphaTransparency",
"StartGradientColor",
"BorderColor",
"BorderSize",
"BorderType",
"HiddenControlList"
})]
public class KcRepeaterPanel : Panel, IAdditionalParsing,
IControlSerializationXmlType, IID, IVisible,
IControlBindingRelink, IConformance, IHiddenControls,
IViewOnly, IFormatColor, IBorder
{ |