/// <summary> /// Initialize a new instance of the KryptonGroup class. /// </summary> public KryptonGroup() { // Create the palette storage StateCommon = new PaletteDoubleRedirect(Redirector, PaletteBackStyle.ControlClient, PaletteBorderStyle.ControlClient, NeedPaintDelegate); StateDisabled = new PaletteDouble(StateCommon, NeedPaintDelegate); StateNormal = new PaletteDouble(StateCommon, NeedPaintDelegate); // Create the internal panel used for containing content Panel = new KryptonGroupPanel(this, StateCommon, StateDisabled, StateNormal, OnGroupPanelPaint) { // Make sure the panel back style always mimics our back style PanelBackStyle = PaletteBackStyle.ControlClient }; // Create the element that fills the remainder space and remembers fill rectange _layoutFill = new ViewLayoutFill(Panel); // Create view for the control border and background _drawDocker = new ViewDrawDocker(StateNormal.Back, StateNormal.Border) { { _layoutFill, ViewDockStyle.Fill } }; // Create the view manager instance ViewManager = new ViewManager(this, _drawDocker); // We want to default to shrinking and growing (base class defaults to GrowOnly) AutoSizeMode = AutoSizeMode.GrowAndShrink; // Add panel to the controls collection ((KryptonReadOnlyControls)Controls).AddInternal(Panel); }
/// <summary> /// Initialize a new instance of the KryptonGroup class. /// </summary> public KryptonGroup() { // Create the palette storage _stateCommon = new PaletteDoubleRedirect(Redirector, PaletteBackStyle.ControlClient, PaletteBorderStyle.ControlClient, NeedPaintDelegate); _stateDisabled = new PaletteDouble(_stateCommon, NeedPaintDelegate); _stateNormal = new PaletteDouble(_stateCommon, NeedPaintDelegate); // Create the internal panel used for containing content _panel = new KryptonGroupPanel(this, _stateCommon, _stateDisabled, _stateNormal, new NeedPaintHandler(OnGroupPanelPaint)); // Make sure the panel back style always mimics our back style _panel.PanelBackStyle = PaletteBackStyle.ControlClient; // Create the element that fills the remainder space and remembers fill rectange _layoutFill = new ViewLayoutFill(_panel); // Create view for the control border and background _drawDocker = new ViewDrawDocker(_stateNormal.Back, _stateNormal.Border); _drawDocker.Add(_layoutFill, ViewDockStyle.Fill); // Create the view manager instance ViewManager = new ViewManager(this, _drawDocker); // We want to default to shrinking and growing (base class defaults to GrowOnly) AutoSizeMode = AutoSizeMode.GrowAndShrink; // Add panel to the controls collection ((KryptonReadOnlyControls)Controls).AddInternal(_panel); }
/// <summary> /// Initialize a new instance of the KryptonGroupBox class. /// </summary> public KryptonGroupBox() { // Set default values _captionStyle = LabelStyle.GroupBoxCaption; _captionEdge = VisualOrientation.Top; _captionOrientation = ButtonOrientation.Auto; _captionVisible = true; // Create storage objects Values = new CaptionValues(NeedPaintDelegate); Values.TextChanged += OnValuesTextChanged; // Create the palette storage StateCommon = new PaletteGroupBoxRedirect(Redirector, NeedPaintDelegate); StateDisabled = new PaletteGroupBox(StateCommon, NeedPaintDelegate); StateNormal = new PaletteGroupBox(StateCommon, NeedPaintDelegate); // Create the internal panel used for containing content Panel = new KryptonGroupPanel(this, StateCommon, StateDisabled, StateNormal, OnGroupPanelPaint) { // Make sure the panel back style always mimics our back style PanelBackStyle = PaletteBackStyle.ControlGroupBox }; _drawContent = new ViewDrawContent(StateNormal.Content, Values, VisualOrientation.Top); // Create view for the control border and background _drawDocker = new ViewDrawGroupBoxDocker(StateNormal.Back, StateNormal.Border); // Create the element that fills the remainder space and remembers fill rectange _layoutFill = new ViewLayoutFill(Panel); // Add caption into the docker with initial dock edges defined _drawDocker.Add(_drawContent, ViewDockStyle.Top); _drawDocker.Add(_layoutFill, ViewDockStyle.Fill); // Create the view manager instance ViewManager = new ViewManager(this, _drawDocker); // We want to default to shrinking and growing (base class defaults to GrowOnly) AutoSizeMode = AutoSizeMode.GrowAndShrink; // Create the delegate used when we need to ensure obscurer is removed _removeObscurer = OnRemoveObscurer; // Need to prevent the AddInternal from causing a layout, otherwise the // layout will probably try to measure text which causes the handle for the // control to be created which means the handle is created at the wrong time // and so child controls are not added properly in the future! (for the TabControl // at the very least). _ignoreLayout = true; // Add panel to the controls collection ((KryptonReadOnlyControls)Controls).AddInternal(Panel); _ignoreLayout = false; }
/// <summary> /// Initializes the designer with the specified component. /// </summary> /// <param name="component">The IComponent to associate with the designer.</param> public override void Initialize(IComponent component) { // Perform common base class initializating base.Initialize(component); // Remember references to components involved in design _panel = component as KryptonGroupPanel; // Acquire service interfaces _selectionService = (ISelectionService)GetService(typeof(ISelectionService)); // If inside a Krypton group container then always lock the component from user size/location change if (_panel != null) { PropertyDescriptor descriptor = TypeDescriptor.GetProperties(component)["Locked"]; if ((descriptor != null) && ((_panel.Parent is KryptonGroup) || (_panel.Parent is KryptonHeaderGroup))) { descriptor.SetValue(component, true); } } }
/// <summary> /// Initializes the designer with the specified component. /// </summary> /// <param name="component">The IComponent to associate with the designer.</param> public override void Initialize(IComponent component) { // Perform common base class initializating base.Initialize(component); // Remember references to components involved in design _panel = component as KryptonGroupPanel; // Acquire service interfaces _selectionService = (ISelectionService)GetService(typeof(ISelectionService)); // If inside a Krypton group container then always lock the component from user size/location change if (_panel != null) { PropertyDescriptor descriptor = TypeDescriptor.GetProperties(component)["Locked"]; if ((descriptor != null) && ((_panel.Parent is KryptonGroup) || (_panel.Parent is KryptonHeaderGroup))) descriptor.SetValue(component, true); } }
private void CreateChildControl() { // Create the internal panel used for containing content _childPanel = new KryptonGroupPanel(this, _stateCommon.HeaderGroup, _stateDisabled.HeaderGroup, _stateNormal.HeaderGroup, new NeedPaintHandler(OnGroupPanelPaint)); // Make sure the panel back style always mimics our back style _childPanel.PanelBackStyle = PaletteBackStyle.ControlClient; // We need to know whenever a control is removed from the child panel _childPanel.ControlRemoved += new ControlEventHandler(OnChildPanelControlRemoved); // Add panel to the controls collection ((KryptonReadOnlyControls)Controls).AddInternal(_childPanel); }