/// <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 _captionValues = new CaptionValues(NeedPaintDelegate); _captionValues.TextChanged += new EventHandler(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, new NeedPaintHandler(OnGroupPanelPaint)); // Make sure the panel back style always mimics our back style _panel.PanelBackStyle = PaletteBackStyle.ControlGroupBox; _drawContent = new ViewDrawContent(_stateNormal.Content, _captionValues, 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 = new EventHandler(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; }