/// <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> /// 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 property 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 _action = (bool)checkedProp.GetValue(_checkButton) ? "Uncheck the button" : "Check the button"; } } // Cache service used to notify when a property has changed _service = (IComponentChangeService)GetService(typeof(IComponentChangeService)); }
/// <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> /// 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) { // ReSharper disable RedundantBaseQualifier return(base.List.Contains(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) { // ReSharper disable RedundantBaseQualifier return(base.List.IndexOf(checkButton)); // ReSharper restore RedundantBaseQualifier }
/// <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; }