/// <summary></summary> /// <param name="control"></param> /// <param name="gradientColor"></param> public static void SetGradientColor(Control control, GradientColor gradientColor) { if (IsMdiClient(control)) { control = control.Parent; } if (control is IGradientColorProperty) { IGradientColorProperty gradientColorProperty = (IGradientColorProperty)control; if ((gradientColorProperty.GradientColor != gradientColor)) { gradientColorProperty.GradientColor = gradientColor; control.Refresh(); } } }
/// <summary></summary> /// <param name="control"></param> /// <param name="gradientStyle"></param> public static void SetGradientStyle(Control control, GradientStyle gradientStyle) { if (IsMdiClient(control)) { control = control.Parent; } if (control is IGradientColorProperty) { IGradientColorProperty gradientColorProperty = (IGradientColorProperty)control; if (gradientColorProperty.GradientStyle != gradientStyle) { gradientColorProperty.GradientStyle = gradientStyle; control.Refresh(); } } }
private void ResetGradientStyle(Control control) { // Fixed defect #127250 : For all controls that support Gradient, while color is set in runtime designer // it's mean the Gradient color will be reset to NONE // Note in Reset command: * The solid color will be seen on the control. // * The Gradient color will be show while re execute the form again. // * It is because we don't have Gradient color property on property grid, // * PM deiced to go with that way because if it will be impotent we will add the property // to property grid but for now we will not do it if (control is IGradientColorProperty) { IGradientColorProperty gradientColorProperty = control as IGradientColorProperty; gradientColorProperty.GradientStyle = com.magicsoftware.util.GradientStyle.None; MgPanel panel = GetMgPanelOfTabControl(control); if (panel != null) { ResetGradientStyle(panel); } } }