/// <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> /// set child visibility for choice control /// </summary> /// <param name="parentControl"></param> private void SetChildrenVisibilityForControl(Control parentControl, int currentVisiableLayer) { ControlDesignerInfo controlDesignerInfo = parentControl.Tag as ControlDesignerInfo; if (controlDesignerInfo != null && controlDesignerInfo.LinkedIds != null) { foreach (int controlId in controlDesignerInfo.LinkedIds) { if (ControlDictionary.ContainsKey(controlId)) { Control linkedControl = ControlDictionary[controlId]; if (ComponentsDictionary.ContainsKey(linkedControl)) { int valueLayer = (int)ComponentsDictionary[linkedControl].PropertiesDescriptors[Constants.WinPropLayer].GetValue(linkedControl); if (parentControl.Visible) { PropertyDescriptor prop = ComponentsDictionary[linkedControl].PropertiesDescriptors[Constants.WinPropVisible]; bool visible = prop == null ? true : (bool)prop.GetValue(linkedControl); linkedControl.Visible = (valueLayer == 0 || valueLayer == currentVisiableLayer + 1) && visible; } else { linkedControl.Visible = false; } HandleVisibility(linkedControl); } } else { MessageBox.Show("try to use control that didn't created", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } } }
public ThirdPartyDependency this[[CanBeNull] ThirdPartyDependency component] => ComponentsDictionary.TryGetValue(GetComponentKey(component), out var value) ? value : null;