예제 #1
0
        /// <summary>
        /// Edits the specified object's value using the editor style indicated by GetEditStyle.
        /// </summary>
        /// <param name="context">An ITypeDescriptorContext that can be used to gain additional context information.</param>
        /// <param name="provider">An IServiceProvider that this editor can use to obtain services.</param>
        /// <param name="value">The object to edit.</param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if ((context?.Instance != null) && (provider != null))
            {
                // Must use the editor service for showing dialogs
                IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                if (editorService != null)
                {
                    // Cast the value to the correct type
                    KryptonCheckSet checkSet = (KryptonCheckSet)context.Instance;

                    // Create the dialog used to edit the set of KryptonCheckButtons
                    KryptonCheckButtonCollectionForm dialog = new KryptonCheckButtonCollectionForm(checkSet);

                    if (editorService.ShowDialog(dialog) == DialogResult.OK)
                    {
                        // Notify container that value has been changed
                        context.OnComponentChanged();
                    }
                }
            }

            // Return the original value
            return(value);
        }
예제 #2
0
        private void OnCheckedButtonChanged(object sender, EventArgs e)
        {
            KryptonCheckSet checkset = (KryptonCheckSet)sender;
            DisplayMode     mode;

            switch (checkset.CheckedButton.Text)
            {
            case "ANSI":
                mode = DisplayMode.Ansi;
                break;

            case "Unicode":
                mode = DisplayMode.Unicode;
                break;

            //case "Hex":
            default:
                mode = DisplayMode.Hexdump;
                break;
            }
            // Sets the display mode.
            if (_byteViewer != null && _byteViewer.GetDisplayMode() != mode)
            {
                _byteViewer.SetDisplayMode(mode);
            }
        }
예제 #3
0
        /// <summary>
        /// Initialize a new instance of the KryptonCheckButtonCollectionForm class.
        /// </summary>
        public KryptonCheckButtonCollectionForm(KryptonCheckSet checkSet)
        {
            // Remember the owning control
            _checkSet = checkSet;

            InitializeComponent();
        }
예제 #4
0
 /// <summary>
 /// Initialize a new instance of the KryptonCheckSetActionList class.
 /// </summary>
 /// <param name="owner">Designer that owns this action list instance.</param>
 public KryptonCheckSetActionList(KryptonCheckSetDesigner owner)
     : base(owner.Component)
 {
     // Remember the check set component instance
     _set = owner.Component as KryptonCheckSet;
 }
예제 #5
0
        /// <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>
 /// Initialize a new instance of the KryptonCheckButtonCollection class.
 /// </summary>
 /// <param name="owner">Owning component</param>
 public KryptonCheckButtonCollection(KryptonCheckSet owner)
 {
     Debug.Assert(owner != null);
     _owner = owner;
 }