コード例 #1
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(formErrorMessage));
        this.buttonClose = new System.Windows.Forms.Button();
        this.labelErrorMessage = new System.Windows.Forms.Label();
        this.textErrorMessage = new hMailServer.Shared.ucText();
        this.textErrorDetails = new hMailServer.Shared.ucText();
        this.labelErrorDetails = new System.Windows.Forms.Label();
        this.SuspendLayout();
        //
        // buttonClose
        //
        this.buttonClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
        this.buttonClose.Location = new System.Drawing.Point(375, 284);
        this.buttonClose.Name = "buttonClose";
        this.buttonClose.Size = new System.Drawing.Size(107, 27);
        this.buttonClose.TabIndex = 0;
        this.buttonClose.Text = "&Close";
        this.buttonClose.UseVisualStyleBackColor = true;
        this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click);
        //
        // labelErrorMessage
        //
        this.labelErrorMessage.AutoSize = true;
        this.labelErrorMessage.Location = new System.Drawing.Point(14, 16);
        this.labelErrorMessage.Name = "labelErrorMessage";
        this.labelErrorMessage.Size = new System.Drawing.Size(74, 13);
        this.labelErrorMessage.TabIndex = 1;
        this.labelErrorMessage.Text = "Error message";
        //
        // textErrorMessage
        //
        this.textErrorMessage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                | System.Windows.Forms.AnchorStyles.Right)));
        this.textErrorMessage.Location = new System.Drawing.Point(17, 32);
        this.textErrorMessage.Multiline = true;
        this.textErrorMessage.Name = "textErrorMessage";
        this.textErrorMessage.Number = 0;
        this.textErrorMessage.Numeric = false;
        this.textErrorMessage.ReadOnly = true;
        this.textErrorMessage.ScrollBars = System.Windows.Forms.ScrollBars.Both;
        this.textErrorMessage.Size = new System.Drawing.Size(465, 40);
        this.textErrorMessage.TabIndex = 3;
        //
        // textErrorDetails
        //
        this.textErrorDetails.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                | System.Windows.Forms.AnchorStyles.Left)
                | System.Windows.Forms.AnchorStyles.Right)));
        this.textErrorDetails.Location = new System.Drawing.Point(17, 105);
        this.textErrorDetails.Multiline = true;
        this.textErrorDetails.Name = "textErrorDetails";
        this.textErrorDetails.Number = 0;
        this.textErrorDetails.Numeric = false;
        this.textErrorDetails.ReadOnly = true;
        this.textErrorDetails.ScrollBars = System.Windows.Forms.ScrollBars.Both;
        this.textErrorDetails.Size = new System.Drawing.Size(465, 170);
        this.textErrorDetails.TabIndex = 4;
        //
        // labelErrorDetails
        //
        this.labelErrorDetails.AutoSize = true;
        this.labelErrorDetails.Location = new System.Drawing.Point(14, 89);
        this.labelErrorDetails.Name = "labelErrorDetails";
        this.labelErrorDetails.Size = new System.Drawing.Size(39, 13);
        this.labelErrorDetails.TabIndex = 5;
        this.labelErrorDetails.Text = "Details";
        //
        // formErrorMessage
        //
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(494, 323);
        this.Controls.Add(this.labelErrorDetails);
        this.Controls.Add(this.textErrorDetails);
        this.Controls.Add(this.textErrorMessage);
        this.Controls.Add(this.labelErrorMessage);
        this.Controls.Add(this.buttonClose);
        this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
        this.Name = "formErrorMessage";
        this.Text = "hMailServer Administrator";
        this.Shown += new System.EventHandler(this.formErrorMessage_Shown);
        this.ResumeLayout(false);
        this.PerformLayout();
 }
コード例 #2
0
        private static bool IterateControls(Control parentControl, Action action, EventHandler ev)
        {
            foreach (Control c in parentControl.Controls)
            {
                if (c.GetType() == typeof(System.Windows.Forms.TabControl))
                {
                    TabControl tabControl = c as TabControl;

                    foreach (TabPage tp in tabControl.TabPages)
                    {
                        if (IterateControls(tp, action, ev))
                        {
                            return(true);
                        }
                    }
                }

                if (c.GetType() == typeof(System.Windows.Forms.Panel))
                {
                    Panel panel = c as Panel;

                    if (IterateControls(panel, action, ev))
                    {
                        return(true);
                    }
                }

                System.Type editorType = c.GetType();
                if (editorType == typeof(ucText) ||
                    editorType == typeof(ucRadioButton) ||
                    editorType == typeof(ucCheckbox) ||
                    editorType == typeof(ucComboBox) ||
                    editorType == typeof(ucEmailEdit) ||
                    editorType == typeof(ucDateTimePicker) ||
                    editorType == typeof(ucPassword) ||
                    editorType == typeof(ucIPAddress))
                {
                    IPropertyEditor editor = c as IPropertyEditor;

                    if (action == Action.CheckDirty)
                    {
                        if (editor.Dirty)
                        {
                            return(true);
                        }
                    }
                    else if (action == Action.SetClean)
                    {
                        editor.SetClean();
                    }
                    else if (action == Action.SubscribeToChange)
                    {
                        if (editorType == typeof(ucText))
                        {
                            ucText edit = c as ucText;
                            edit.TextChanged += ev;
                        }
                        else if (editorType == typeof(ucCheckbox))
                        {
                            ucCheckbox edit = c as ucCheckbox;
                            edit.CheckedChanged += ev;
                        }
                        else if (editorType == typeof(ucComboBox))
                        {
                            ucComboBox edit = c as ucComboBox;
                            edit.SelectedIndexChanged += ev;
                        }
                        else if (editorType == typeof(ucRadioButton))
                        {
                            ucRadioButton edit = c as ucRadioButton;
                            edit.CheckedChanged += ev;
                        }
                        else if (editorType == typeof(ucEmailEdit))
                        {
                            ucEmailEdit edit = c as ucEmailEdit;
                            edit.ContentChanged += ev;
                        }
                        else if (editorType == typeof(ucDateTimePicker))
                        {
                            ucDateTimePicker dateTimePicker = c as ucDateTimePicker;
                            dateTimePicker.ValueChanged += ev;
                        }
                        else if (editorType == typeof(ucPassword))
                        {
                            ucPassword passwordEdit = c as ucPassword;
                            passwordEdit.TextChanged += ev;
                        }
                        else if (editorType == typeof(ucIPAddress))
                        {
                            ucIPAddress passwordEdit = c as ucIPAddress;
                            passwordEdit.TextChanged += ev;
                        }
                    }
                }
            }

            return(false);
        }