/// <summary> /// if background color is reset then reset also the gradient style /// </summary> /// <param name="control"></param> /// <param name="propeKey"></param> private void UpdateGradientStyleProperty(Control control, string propeKey) { if (propeKey == null || propeKey.Equals(Constants.WinPropBackColor)) { if (ComponentsDictionary.ContainsKey(control) && ComponentsDictionary[control].PropertiesDescriptors[Constants.WinPropGradientStyle] != null) { RTDesignerPropertyDescriptor propertyDescriptor = ComponentsDictionary[control].PropertiesDescriptors[Constants.WinPropGradientStyle] as RTDesignerPropertyDescriptor; ((IGradientColorProperty)control).GradientStyle = (GradientStyle)propertyDescriptor.DefaultValue; // for tab control reset the panel of the tab control MgPanel mgPanel = BackgroundColorStrategy.GetMgPanelOfTabControl(control); if (mgPanel != null) { ((IGradientColorProperty)mgPanel).GradientStyle = (GradientStyle)propertyDescriptor.DefaultValue; } control.Invalidate(); } } }
/// <summary> /// returns the SetPropertyData strategy for this control and property /// </summary> /// <param name="keyProp"></param> /// <param name="valueItem"></param> /// <param name="controlDesignerInfo"></param> /// <param name="setPropertyData"></param> /// <param name="component"></param> private static ISetPropertyData GetSetDataStrategy(ref KeyValuePair <string, DesignerPropertyInfo> keyProp, ref object valueItem, ControlDesignerInfo controlDesignerInfo, object component) { ISetPropertyData setPropertyData = null; if (ComponentWrapper.IsCoordinateProperty(keyProp.Key)) { valueItem = ((int)valueItem) + controlDesignerInfo.GetPlacementForProp(keyProp.Key); setPropertyData = new RuntimeControlCoordinateStrategy((Control)component, keyProp.Key); } else if (keyProp.Key.Equals(Constants.WinPropBackColor)) { setPropertyData = new BackgroundColorStrategy((Control)component); } else if (keyProp.Key.Equals(Constants.WinPropForeColor)) { setPropertyData = new ForegroundColorStrategy((Control)component); } else if (keyProp.Key.Equals(Constants.WinPropFont)) { setPropertyData = new FontStrategy((Control)component); } return(setPropertyData); }