public ListView () { background_color = Color.White;//ThemeEngine.Current.ColorWindow; groups = new ListViewGroupCollection (this); items = new ListViewItemCollection (this); items.Changed += new CollectionChangedHandler (OnItemsChanged); checked_indices = new CheckedIndexCollection (this); checked_items = new CheckedListViewItemCollection (this); columns = new ColumnHeaderCollection (this); foreground_color = SystemColors.WindowText; selected_indices = new SelectedIndexCollection (this); selected_items = new SelectedListViewItemCollection (this); items_location = new Point [16]; items_matrix_location = new ItemMatrixLocation [16]; reordered_items_indices = new int [16]; item_tooltip = new ToolTip (); item_tooltip.Active = false; insertion_mark = new ListViewInsertionMark (this); InternalBorderStyle = BorderStyle.Fixed3D; header_control = new HeaderControl (this); header_control.Visible = false; Controls.AddImplicit (header_control); item_control = new ItemControl (this); Controls.AddImplicit (item_control); h_marker = v_marker = 0; keysearch_tickcnt = 0; // scroll bars are disabled initially h_scroll.Visible = false; //h_scroll.ValueChanged += new EventHandler(HorizontalScroller); v_scroll.Visible = false; //v_scroll.ValueChanged += new EventHandler(VerticalScroller); // event handlers base.KeyDown += new KeyEventHandler(ListView_KeyDown); SizeChanged += new EventHandler (ListView_SizeChanged); //GotFocus += new EventHandler (FocusChanged); //LostFocus += new EventHandler (FocusChanged); //MouseWheel += new MouseEventHandler(ListView_MouseWheel); //MouseEnter += new EventHandler (ListView_MouseEnter); Invalidated += new InvalidateEventHandler (ListView_Invalidated); BackgroundImageTiled = false; this.SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick | ControlStyles.UseTextForAccessibility , false); }
public CheckedListBox() { checked_indices = new CheckedIndexCollection(this); checked_items = new CheckedItemCollection(this); SetStyle(ControlStyles.ResizeRedraw, true); }
public CheckedListBox () { checked_indices = new CheckedIndexCollection (this); checked_items = new CheckedItemCollection (this); SetStyle (ControlStyles.ResizeRedraw, true); }
/// <summary> /// Initialize a new instance of the KryptonCheckedListBox class. /// </summary> public KryptonCheckedListBox() { // Contains another control and needs marking as such for validation to work SetStyle(ControlStyles.ContainerControl, true); // Cannot select this control, only the child CheckedListBox and does not generate a click event SetStyle(ControlStyles.Selectable | ControlStyles.StandardClick, false); // Default fields _alwaysActive = true; _style = ButtonStyle.ListItem; _lastSelectedIndex = -1; base.Padding = new Padding(1); // Create the palette storage _images = new CheckBoxImages(NeedPaintDelegate); _paletteCheckBoxImages = new PaletteRedirectCheckBox(Redirector, _images); _stateCommon = new PaletteListStateRedirect(Redirector, PaletteBackStyle.InputControlStandalone, PaletteBorderStyle.InputControlStandalone, NeedPaintDelegate); _stateFocus = new PaletteListItemTripleRedirect(Redirector, PaletteBackStyle.ButtonListItem, PaletteBorderStyle.ButtonListItem, PaletteContentStyle.ButtonListItem, NeedPaintDelegate); _stateDisabled = new PaletteListState(_stateCommon, NeedPaintDelegate); _stateActive = new PaletteDouble(_stateCommon, NeedPaintDelegate); _stateNormal = new PaletteListState(_stateCommon, NeedPaintDelegate); _stateTracking = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate); _statePressed = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate); _stateCheckedNormal = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate); _stateCheckedTracking = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate); _stateCheckedPressed = new PaletteListItemTriple(_stateCommon.Item, NeedPaintDelegate); // Create the override handling classes _overrideNormal = new PaletteTripleOverride(_stateFocus.Item, _stateNormal.Item, PaletteState.FocusOverride); _overrideTracking = new PaletteTripleOverride(_stateFocus.Item, _stateTracking.Item, PaletteState.FocusOverride); _overridePressed = new PaletteTripleOverride(_stateFocus.Item, _statePressed.Item, PaletteState.FocusOverride); _overrideCheckedNormal = new PaletteTripleOverride(_stateFocus.Item, _stateCheckedNormal.Item, PaletteState.FocusOverride); _overrideCheckedTracking = new PaletteTripleOverride(_stateFocus.Item, _stateCheckedTracking.Item, PaletteState.FocusOverride); _overrideCheckedPressed = new PaletteTripleOverride(_stateFocus.Item, _stateCheckedPressed.Item, PaletteState.FocusOverride); // Create the check box image drawer and place inside element so it is always centered _drawCheckBox = new ViewDrawCheckBox(_paletteCheckBoxImages); _layoutCenter = new ViewLayoutCenter(); _layoutCenter.Add(_drawCheckBox); // Create the draw element for owner drawing individual items _contentValues = new FixedContentValue(); _drawButton = new ViewDrawButton(StateDisabled.Item, _overrideNormal, _overrideTracking, _overridePressed, _overrideCheckedNormal, _overrideCheckedTracking, _overrideCheckedPressed, new PaletteMetricRedirect(Redirector), _contentValues, VisualOrientation.Top, false); // Place check box on the left and the label in the remainder _layoutDocker = new ViewLayoutDocker(); _layoutDocker.Add(new ViewLayoutSeparator(1), ViewDockStyle.Left); _layoutDocker.Add(_layoutCenter, ViewDockStyle.Left); _layoutDocker.Add(new ViewLayoutSeparator(2), ViewDockStyle.Left); _layoutDocker.Add(_drawButton, ViewDockStyle.Fill); // Create the internal list box used for containing content _listBox = new InternalCheckedListBox(this); _listBox.DrawItem += new DrawItemEventHandler(OnListBoxDrawItem); _listBox.MeasureItem += new MeasureItemEventHandler(OnListBoxMeasureItem); _listBox.TrackMouseEnter += new EventHandler(OnListBoxMouseChange); _listBox.TrackMouseLeave += new EventHandler(OnListBoxMouseChange); _listBox.SelectedIndexChanged += new EventHandler(OnListBoxSelectedIndexChanged); _listBox.SelectedValueChanged += new EventHandler(OnListBoxSelectedValueChanged); _listBox.Format += new ListControlConvertEventHandler(OnListBoxFormat); _listBox.FormatInfoChanged += new EventHandler(OnListBoxFormatInfoChanged); _listBox.FormatStringChanged += new EventHandler(OnListBoxFormatStringChanged); _listBox.FormattingEnabledChanged += new EventHandler(OnListBoxFormattingEnabledChanged); _listBox.GotFocus += new EventHandler(OnListBoxGotFocus); _listBox.LostFocus += new EventHandler(OnListBoxLostFocus); _listBox.KeyDown += new KeyEventHandler(OnListBoxKeyDown); _listBox.KeyUp += new KeyEventHandler(OnListBoxKeyUp); _listBox.KeyPress += new KeyPressEventHandler(OnListBoxKeyPress); _listBox.PreviewKeyDown += new PreviewKeyDownEventHandler(OnListBoxPreviewKeyDown); _listBox.Validating += new CancelEventHandler(OnListBoxValidating); _listBox.Validated += new EventHandler(OnListBoxValidated); // Create extra collections for storing checked state and checked items _checkedItems = new CheckedItemCollection(this); _checkedIndices = new CheckedIndexCollection(this); // Create the element that fills the remainder space and remembers fill rectange _layoutFill = new ViewLayoutFill(_listBox); _layoutFill.DisplayPadding = new Padding(1); // Create inner view for placing inside the drawing docker _drawDockerInner = new ViewLayoutDocker(); _drawDockerInner.Add(_layoutFill, ViewDockStyle.Fill); // Create view for the control border and background _drawDockerOuter = new ViewDrawDocker(_stateNormal.Back, _stateNormal.Border); _drawDockerOuter.Add(_drawDockerInner, ViewDockStyle.Fill); // Create the view manager instance ViewManager = new ViewManager(this, _drawDockerOuter); // We need to create and cache a device context compatible with the display _screenDC = PI.CreateCompatibleDC(IntPtr.Zero); // Add text box to the controls collection ((KryptonReadOnlyControls)Controls).AddInternal(_listBox); }