/// <summary> /// Initialize a new instance of the KryptonCheckButtonActionList class. /// </summary> /// <param name="owner">Designer that owns this action list instance.</param> public KryptonCheckButtonActionList(KryptonCheckButtonDesigner owner) : base(owner) { // Remember the button instance _checkButton = owner.Component as KryptonCheckButton; // Assuming we were correctly passed an actual component... if (_checkButton != null) { // Get access to the actual Orientation propertry PropertyDescriptor checkedProp = TypeDescriptor.GetProperties(_checkButton)["Checked"]; // If we succeeded in getting the property if (checkedProp != null) { // Decide on the next action to take given the current setting if ((bool)checkedProp.GetValue(_checkButton)) { _action = "Uncheck the button"; } else { _action = "Check the button"; } } } // Cache service used to notify when a property has changed _service = (IComponentChangeService)GetService(typeof(IComponentChangeService)); }
private void KryptonCheckButtonCollectionForm_Load(object sender, EventArgs e) { // Get access to the container of the check set IContainer container = _checkSet.Container; // Assuming we manage to find a container if (container != null) { // Find all the check buttons inside the container foreach (object obj in container.Components) { // We are only interested in check buttons if (obj is KryptonCheckButton) { // Cast to the correct type KryptonCheckButton checkButton = (KryptonCheckButton)obj; // Add a new entry to the list box but only check it if // it is already present in the check buttons collection checkedListBox.Items.Add(new ListEntry(checkButton), _checkSet.CheckButtons.Contains(checkButton)); } } } }
private void CheckButtonAdded(KryptonCheckButton checkButton) { // If the incoming button is already checked if (checkButton.Checked) { // If we already have a button checked if (_checkedButton != null) { // Then uncheck the incoming button checkButton.Checked = false; } else { // Remember this as the currently checked instance _checkedButton = checkButton; // Generate event to show the value has changed OnCheckedButtonChanged(EventArgs.Empty); } } // Need to monitor and control the change of checked state checkButton.CheckedChanging += new CancelEventHandler(OnCheckedChanging); checkButton.CheckedChanged += new EventHandler(OnCheckedChanged); }
private KryptonCheckButton CreatePageLink( PagingLink link) { var button = new KryptonCheckButton(); button.ButtonStyle = ComponentFactory.Krypton.Toolkit.ButtonStyle.LowProfile; button.Cursor = System.Windows.Forms.Cursors.Hand; button.Location = new System.Drawing.Point(0, 0); button.Margin = new System.Windows.Forms.Padding(0); button.Size = link.Text.Length == 1 ? new System.Drawing.Size(29, 25) : new System.Drawing.Size(10 + ( link.Text.Length * 10), 25); button.StateCommon.Border.DrawBorders = ((ComponentFactory.Krypton.Toolkit.PaletteDrawBorders)((((ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Top | ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Bottom) | ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Left) | ComponentFactory.Krypton.Toolkit.PaletteDrawBorders.Right))); button.StateCommon.Border.Width = 1; button.StateCommon.Content.ShortText.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0))); button.Values.Text = link.Text; button.Tag = link; button.Checked = link.IsSelected; button.CheckedChanged += delegate(object sender, EventArgs e) { var b = (KryptonCheckButton)sender; if (b.Checked) { OnPageSelected(this, new GalleryPageSelectedEventArgs(link)); UpdatePagingButtons(b); } }; return button; }
private void OnCheckedChanged(object sender, EventArgs e) { // Are we allowed to process the event? if (!_ignoreEvents) { // Cast to the correct type KryptonCheckButton checkedButton = (KryptonCheckButton)sender; if (checkedButton.Checked) { // Uncheck the currently checked button if (_checkedButton != null) { // Prevent processing events caused by ourself _ignoreEvents = true; _checkedButton.Checked = false; _ignoreEvents = false; } // Remember the newly checked button _checkedButton = checkedButton; } else { // No check button is checked anymore _checkedButton = null; } // Generate event to show the value has changed OnCheckedButtonChanged(EventArgs.Empty); } }
private void OnCheckedChanging(object sender, CancelEventArgs e) { // Are we allowed to process the event? if (!_ignoreEvents) { // Cast to the correct type KryptonCheckButton checkedButton = (KryptonCheckButton)sender; // Prevent the checked button becoming unchecked unless AllowUncheck is defined e.Cancel = checkedButton.Checked && !AllowUncheck; } }
private void CheckButtonRemoved(KryptonCheckButton checkButton) { // Unhook from monitoring events checkButton.CheckedChanging -= new CancelEventHandler(OnCheckedChanging); checkButton.CheckedChanged -= new EventHandler(OnCheckedChanged); // If the removed button is the currently checked one if (_checkedButton == checkButton) { // Then we no longer have a currently checked button _checkedButton = null; // Generate event to show the value has changed OnCheckedButtonChanged(EventArgs.Empty); } }
/// <summary> /// Removes a KryptonCheckButton from the collection. /// </summary> /// <param name="checkButton">The KryptonCheckButton to remove.</param> public void Remove(KryptonCheckButton checkButton) { Debug.Assert(checkButton != null); if (checkButton == null) { throw new ArgumentNullException("checkButton"); } if (!Contains(checkButton)) { throw new ArgumentException("No matching reference to remove"); } base.List.Remove(checkButton); }
/// <summary> /// Adds the specifies KryptonCheckButton to the collection. /// </summary> /// <param name="checkButton">The KryptonCheckButton object to add to the collection.</param> /// <returns>The index of the new entry.</returns> public int Add(KryptonCheckButton checkButton) { Debug.Assert(checkButton != null); if (checkButton == null) { throw new ArgumentNullException("checkButton"); } if (Contains(checkButton)) { throw new ArgumentException("Reference already exists in the collection"); } base.List.Add(checkButton); return(base.List.Count - 1); }
/// <summary> /// Removes a KryptonCheckButton from the collection. /// </summary> /// <param name="checkButton">The KryptonCheckButton to remove.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception> public void Remove(KryptonCheckButton checkButton) { Debug.Assert(checkButton != null); if (checkButton == null) { throw new ArgumentNullException(nameof(checkButton)); } if (!Contains(checkButton)) { throw new ArgumentException("No matching reference to remove"); } // ReSharper disable RedundantBaseQualifier base.List.Remove(checkButton); // ReSharper restore RedundantBaseQualifier }
/// <summary> /// Adds the specifies KryptonCheckButton to the collection. /// </summary> /// <param name="checkButton">The KryptonCheckButton object to add to the collection.</param> /// <exception cref="ArgumentNullException"></exception> /// <returns>The index of the new entry.</returns> public int Add(KryptonCheckButton checkButton) { Debug.Assert(checkButton != null); if (checkButton == null) { throw new ArgumentNullException(nameof(checkButton)); } if (Contains(checkButton)) { throw new ArgumentException("Reference already exists in the collection"); } // ReSharper disable RedundantBaseQualifier base.List.Add(checkButton); return(base.List.Count - 1); // ReSharper restore RedundantBaseQualifier }
/// <summary> /// Inserts a KryptonCheckButton reference into the collection at the specified location. /// </summary> /// <param name="index">Index of position to insert.</param> /// <param name="checkButton">The KryptonCheckButton reference to insert.</param> public void Insert(int index, KryptonCheckButton checkButton) { Debug.Assert(checkButton != null); if (checkButton == null) { throw new ArgumentNullException("checkButton"); } if ((index < 0) || (index > Count)) { throw new ArgumentOutOfRangeException("index"); } if (Contains(checkButton)) { throw new ArgumentException("Reference already in collection"); } base.List.Insert(index, checkButton); }
/// <summary> /// Inserts a KryptonCheckButton reference into the collection at the specified location. /// </summary> /// <param name="index">Index of position to insert.</param> /// <param name="checkButton">The KryptonCheckButton reference to insert.</param> /// <exception cref="ArgumentException"></exception> /// <exception cref="ArgumentNullException"></exception> public void Insert(int index, KryptonCheckButton checkButton) { Debug.Assert(checkButton != null); if (checkButton == null) { throw new ArgumentNullException(nameof(checkButton)); } if ((index < 0) || (index > Count)) { throw new ArgumentOutOfRangeException(nameof(index)); } if (Contains(checkButton)) { throw new ArgumentException("Reference already in collection"); } // ReSharper disable RedundantBaseQualifier base.List.Insert(index, checkButton); // ReSharper restore RedundantBaseQualifier }
/// <summary> /// Returns the index of the KryptonCheckButton reference. /// </summary> /// <param name="checkButton">The KryptonCheckButton to locate.</param> /// <returns>Index of reference; otherwise -1.</returns> public int IndexOf(KryptonCheckButton checkButton) { return(base.List.IndexOf(checkButton)); }
/// <summary> /// Initialize a new instance of the ListEntry class. /// </summary> /// <param name="checkButton">CheckButton to encapsulate.</param> public ListEntry(KryptonCheckButton checkButton) { Debug.Assert(checkButton != null); CheckButton = checkButton; }
/// <summary> /// Determines whether a KryptonCheckButton is in the collection. /// </summary> /// <param name="checkButton">The KryptonCheckButton to locate in the collection.</param> /// <returns>True if found in collection; otherwise false.</returns> public bool Contains(KryptonCheckButton checkButton) { // ReSharper disable RedundantBaseQualifier return(base.List.Contains(checkButton)); // ReSharper restore RedundantBaseQualifier }
// found 3 places private KryptonCheckButton CreateLoadingListButton(long listId, String index) { KryptonCheckButton button = new KryptonCheckButton(); //button.ContextMenuStrip = cmsLoadingListBtn; button.Tag = listId; button.Name = "l" + listId; button.Text = LL_DeserializeName(index); button.CheckedChanged += new System.EventHandler(LoadingListItem_CheckedChanged); csLoadingList.CheckButtons.Add(button); return button; }
/// <summary> /// Adds the specifies KryptonCheckButton to the collection. /// </summary> /// <param name="checkButton">The KryptonCheckButton object to add to the collection.</param> /// <returns>The index of the new entry.</returns> public int Add(KryptonCheckButton checkButton) { Debug.Assert(checkButton != null); if (checkButton == null) throw new ArgumentNullException("checkButton"); if (Contains(checkButton)) throw new ArgumentException("Reference already exists in the collection"); base.List.Add(checkButton); return base.List.Count - 1; }
/// <summary> /// Determines whether a KryptonCheckButton is in the collection. /// </summary> /// <param name="checkButton">The KryptonCheckButton to locate in the collection.</param> /// <returns>True if found in collection; otherwise false.</returns> public bool Contains(KryptonCheckButton checkButton) { return base.List.Contains(checkButton); }
/// <summary> /// Returns the index of the KryptonCheckButton reference. /// </summary> /// <param name="checkButton">The KryptonCheckButton to locate.</param> /// <returns>Index of reference; otherwise -1.</returns> public int IndexOf(KryptonCheckButton checkButton) { return base.List.IndexOf(checkButton); }
/// <summary> /// Inserts a KryptonCheckButton reference into the collection at the specified location. /// </summary> /// <param name="index">Index of position to insert.</param> /// <param name="checkButton">The KryptonCheckButton reference to insert.</param> public void Insert(int index, KryptonCheckButton checkButton) { Debug.Assert(checkButton != null); if (checkButton == null) throw new ArgumentNullException("checkButton"); if ((index < 0) || (index > Count)) throw new ArgumentOutOfRangeException("index"); if (Contains(checkButton)) throw new ArgumentException("Reference already in collection"); base.List.Insert(index, checkButton); }
private void UpdatePagingButtons(KryptonCheckButton button) { foreach (KryptonCheckButton b in this.flowLayoutPanelPaging.Controls) b.Checked = b == button ? true : false; }
private int DBSelect_LoadingLists_Reset() { DataTable openedLists = new DataTable(); using (OleDbDataAdapter adapter = new OleDbDataAdapter("Select * from LoadingListOpened_View", conn)) { adapter.SelectCommand.Parameters.Add("@stock_id", OleDbType.Integer).Value = getStockId(); adapter.Fill(openedLists); } openedLists.PrimaryKey = new DataColumn[] { openedLists.Columns[openedLists.Columns.IndexOf("id")] }; //checking for contained buttons, remove not existing in db KryptonCheckButton[] buttons = new KryptonCheckButton[openedLists.Rows.Count]; ToolStripMenuItem[] items = new ToolStripMenuItem[openedLists.Rows.Count]; foreach (DataRow row in openedLists.Rows) { long listId = long.Parse(row.ItemArray[openedLists.Columns.IndexOf("id")].ToString()); string index = (string)row.ItemArray[openedLists.Columns.IndexOf("index")]; KryptonCheckButton button = CreateLoadingListButton(listId, index); if (!flpControls.Controls.ContainsKey(button.Name)) { //buttons[openedLists.Rows.IndexOf(row)] = button; flpControls.Controls.Add(button); tsmiLL.DropDownItems.Insert(tsmiLL.DropDownItems.IndexOf(tsmiHistorySeparator), newLoadingListMenuItem(listId, index)); newLoadingListToolStripItem(listId, index); } } ToolStripItemCollection col2 = new ToolStripItemCollection(cmsLoadingLists, ((ToolStripItem[])cmsLoadingLists.Tag)); foreach (Control control in flpControls.Controls) { if (!openedLists.Rows.Contains(control.Tag)) { flpControls.Controls.RemoveAt(flpControls.Controls.IndexOfKey(control.Name)); col2.RemoveAt(col2.IndexOfKey(csLoadingList.CheckedButton.Name)); col2.CopyTo((ToolStripItem[])cmsLoadingLists.Tag, 0); tsmiLL.DropDownItems.RemoveAt(tsmiLL.DropDownItems.IndexOfKey(control.Name)); } } //flpControls.Controls.AddRange(buttons); return openedLists.Rows.Count; }
/// <summary> /// Returns the index of the KryptonCheckButton reference. /// </summary> /// <param name="checkButton">The KryptonCheckButton to locate.</param> /// <returns>Index of reference; otherwise -1.</returns> public int IndexOf(KryptonCheckButton checkButton) { // ReSharper disable RedundantBaseQualifier return(base.List.IndexOf(checkButton)); // ReSharper restore RedundantBaseQualifier }
public KryptonCheckButtonProxy(KryptonCheckButton checkButton) { _checkButton = checkButton; }
/// <summary> /// Removes a KryptonCheckButton from the collection. /// </summary> /// <param name="checkButton">The KryptonCheckButton to remove.</param> public void Remove(KryptonCheckButton checkButton) { Debug.Assert(checkButton != null); if (checkButton == null) throw new ArgumentNullException("checkButton"); if (!Contains(checkButton)) throw new ArgumentException("No matching reference to remove"); base.List.Remove(checkButton); }
/// <summary> /// Initialize a new instance of the ListEntry class. /// </summary> /// <param name="checkButton">CheckButton to encapsulate.</param> public ListEntry(KryptonCheckButton checkButton) { Debug.Assert(checkButton != null); _checkButton = checkButton; }
/// <summary> /// Initializes the Form's components. /// </summary> private void InitializeComponent() { components = new Container(); _byteViewer = new KryptonByteViewer(); KryptonPanel bottomPanel = new KryptonPanel(); KryptonPanel topPanel = new KryptonPanel(); KryptonGroupBox groupBox = new KryptonGroupBox(); KryptonCheckButton unicodeButton = new KryptonCheckButton(); KryptonCheckButton hexButton = new KryptonCheckButton(); KryptonCheckButton ansiButton = new KryptonCheckButton(); KryptonCheckButton export = new KryptonCheckButton(); KryptonCheckSet displayModeCheckset = new KryptonCheckSet(components); ((ISupportInitialize)(topPanel)).BeginInit(); topPanel.SuspendLayout(); ((ISupportInitialize)(groupBox)).BeginInit(); groupBox.Panel.BeginInit(); groupBox.Panel.SuspendLayout(); groupBox.SuspendLayout(); ((ISupportInitialize)(displayModeCheckset)).BeginInit(); ((ISupportInitialize)(bottomPanel)).BeginInit(); SuspendLayout(); // // topPanel // topPanel.AutoSize = true; topPanel.Controls.Add(groupBox); topPanel.Controls.Add(export); topPanel.Dock = DockStyle.Top; topPanel.Location = new System.Drawing.Point(0, 0); topPanel.Name = "topPanel"; topPanel.Padding = new Padding(5); topPanel.Size = new System.Drawing.Size(639, 65); topPanel.TabIndex = 0; // // groupBox // groupBox.AutoSize = true; groupBox.Location = new System.Drawing.Point(5, 0); groupBox.Name = "groupBox"; // // groupBox.Panel // groupBox.Panel.Controls.Add(unicodeButton); groupBox.Panel.Controls.Add(hexButton); groupBox.Panel.Controls.Add(ansiButton); groupBox.Size = new System.Drawing.Size(280, 57); groupBox.TabIndex = 0; groupBox.Values.Heading = @"Display Mode"; // // unicodeButton // unicodeButton.Location = new System.Drawing.Point(141, 3); unicodeButton.Name = "unicodeButton"; unicodeButton.Size = new System.Drawing.Size(63, 25); unicodeButton.TabIndex = 3; unicodeButton.Values.Text = @"Unicode"; // // hexButton // hexButton.Checked = true; hexButton.Location = new System.Drawing.Point(3, 3); hexButton.Name = "hexButton"; hexButton.Size = new System.Drawing.Size(63, 25); hexButton.TabIndex = 2; hexButton.Values.Text = @"Hex"; // // ansiButton // ansiButton.Location = new System.Drawing.Point(72, 3); ansiButton.Name = "ansiButton"; ansiButton.Size = new System.Drawing.Size(63, 25); ansiButton.TabIndex = 1; ansiButton.Values.Text = @"ANSI"; // // displayModeCheckset // displayModeCheckset.CheckButtons.Add(ansiButton); displayModeCheckset.CheckButtons.Add(hexButton); displayModeCheckset.CheckButtons.Add(unicodeButton); displayModeCheckset.CheckedButton = hexButton; displayModeCheckset.CheckedButtonChanged += OnCheckedButtonChanged; // // export // export.Location = new System.Drawing.Point(535, 22); export.Name = "export"; export.Size = new System.Drawing.Size(80, 25); export.TabIndex = 4; export.Values.Text = @"Export..."; export.Click += OnClickExport; // // bottomPanel // bottomPanel.Dock = DockStyle.Fill; bottomPanel.Location = new System.Drawing.Point(0, 65); bottomPanel.Name = "bottomPanel"; bottomPanel.Size = new System.Drawing.Size(639, 401); bottomPanel.TabIndex = 1; bottomPanel.Controls.Add(_byteViewer); // // byteViewer // _byteViewer.Dock = DockStyle.Fill; _byteViewer.CellBorderStyle = TableLayoutPanelCellBorderStyle.None; // // Form1 // AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new System.Drawing.Size(639, 466); Controls.Add(bottomPanel); Controls.Add(topPanel); FormBorderStyle = FormBorderStyle.FixedToolWindow; StartPosition = FormStartPosition.CenterParent; Name = @"Binary Viewer"; Text = @"Binary Viewer"; ((ISupportInitialize)(topPanel)).EndInit(); topPanel.ResumeLayout(false); topPanel.PerformLayout(); groupBox.Panel.EndInit(); groupBox.Panel.ResumeLayout(false); ((ISupportInitialize)(groupBox)).EndInit(); groupBox.ResumeLayout(false); ((ISupportInitialize)(displayModeCheckset)).EndInit(); ((ISupportInitialize)(bottomPanel)).EndInit(); ResumeLayout(false); PerformLayout(); }
/// <summary> /// Determines whether a KryptonCheckButton is in the collection. /// </summary> /// <param name="checkButton">The KryptonCheckButton to locate in the collection.</param> /// <returns>True if found in collection; otherwise false.</returns> public bool Contains(KryptonCheckButton checkButton) { return(base.List.Contains(checkButton)); }