当前位置: 首页>>代码示例>>C#>>正文


C# Button.SuspendLayout方法代码示例

本文整理汇总了C#中System.Windows.Forms.Button.SuspendLayout方法的典型用法代码示例。如果您正苦于以下问题:C# Button.SuspendLayout方法的具体用法?C# Button.SuspendLayout怎么用?C# Button.SuspendLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Button的用法示例。


在下文中一共展示了Button.SuspendLayout方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeComponents

        private void InitializeComponents()
        {
            const int FORM_WIDTH = 400;
              const int FORM_HEIGHT = 400;

              propertyGrid = new PropertyGrid();
              okButton = new Button();
              cancelButton = new Button();
              propertyGrid.SuspendLayout();
              okButton.SuspendLayout();
              cancelButton.SuspendLayout();

              propertyGrid.Location = new Point(5, 5);
              propertyGrid.Size = new Size(FORM_WIDTH-20, FORM_HEIGHT-80);
              propertyGrid.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
              propertyGrid.ToolbarVisible = false;

              okButton.Location = new Point(FORM_WIDTH-75*2-40, FORM_HEIGHT-60);
              okButton.Size = new Size(75, 23);
              okButton.Text = "OK";
              okButton.FlatStyle = FlatStyle.Flat;
              okButton.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
              okButton.Click += delegate {
            this.DialogResult = DialogResult.OK;
            this.Close();
              };

              cancelButton.Location = new Point(FORM_WIDTH-75-20, FORM_HEIGHT-60);
              cancelButton.Size = new Size(75, 23);
              cancelButton.Text = "Cancel";
              cancelButton.FlatStyle = FlatStyle.Flat;
              cancelButton.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
              cancelButton.Click += delegate {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
              };

              this.Size = new Size(FORM_WIDTH, FORM_HEIGHT);
              this.FormBorderStyle = FormBorderStyle.SizableToolWindow;
              this.Text = "Settings";
              this.Controls.AddRange(new Control[]{
            propertyGrid,
            okButton,
            cancelButton
              });

              propertyGrid.ResumeLayout(false);
              okButton.ResumeLayout(false);
              cancelButton.ResumeLayout(false);
              this.ResumeLayout(false);
              this.PerformLayout();
        }
开发者ID:hazychill,项目名称:oog,代码行数:52,代码来源:SettingsForm.cs

示例2: InitializeComponents

        private void InitializeComponents()
        {
            nameLabel = new Label();
              pathLabel = new Label();
              nameTextBox = new TextBox();
              pathTextBox = new TextBox();
              okButton = new Button();
              cancelButton = new Button();

              this.SuspendLayout();
              nameLabel.SuspendLayout();
              pathLabel.SuspendLayout();
              nameTextBox.SuspendLayout();
              pathTextBox.SuspendLayout();
              okButton.SuspendLayout();
              cancelButton.SuspendLayout();

              nameLabel.Text = "Name";
              nameLabel.AutoSize = true;
              nameLabel.Location = new Point(3, 3);

              pathLabel.Text = "Path";
              pathLabel.AutoSize = true;
              pathLabel.Location = new Point(3, 30);

              nameTextBox.Size = new Size(250, 19);
              nameTextBox.Location = new Point(40, 2);
              nameTextBox.BorderStyle = BorderStyle.FixedSingle;

              pathTextBox.Size = new Size(250, 19);
              pathTextBox.Location = new Point(40, 29);
              pathTextBox.BorderStyle = BorderStyle.FixedSingle;

              okButton.Text = "OK";
              okButton.Size = new Size(75, 23);
              okButton.Location = new Point((300-75)/2, 60);
              okButton.FlatStyle = FlatStyle.Flat;
              okButton.Click += delegate {
            this.DialogResult = DialogResult.OK;
            this.Close();
              };

              cancelButton.Text = "Cancel";
              cancelButton.Size = new Size(75, 23);
              cancelButton.Location = new Point(215, 60);
              cancelButton.FlatStyle = FlatStyle.Flat;
              cancelButton.Click += delegate {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
              };

              this.Size = new Size(300, 120);
              this.FormBorderStyle = FormBorderStyle.FixedSingle;
              this.Text = "Jump target";
              this.Controls.AddRange(new Control[]{
            nameLabel,
            pathLabel,
            nameTextBox,
            pathTextBox,
            okButton,
            cancelButton
              });

              nameLabel.ResumeLayout(false);
              pathLabel.ResumeLayout(false);
              nameTextBox.ResumeLayout(false);
              pathTextBox.ResumeLayout(false);
              okButton.ResumeLayout(false);
              cancelButton.ResumeLayout(false);
              this.ResumeLayout(false);
              this.PerformLayout();
        }
开发者ID:hazychill,项目名称:oog,代码行数:72,代码来源:AddJumpForm.cs

示例3: SetLinkedButtonsImage

 private void SetLinkedButtonsImage(Button localButton, Bitmap image)
 {
     localButton.SuspendLayout();
     localButton.Image = image;
     localButton.ResumeLayout();
     if(_chordFormButton != null)
     {
         _chordFormButton.SuspendLayout();
         _chordFormButton.Image = image;
         _chordFormButton.ResumeLayout();
     }
 }
开发者ID:suvjunmd,项目名称:Moritz,代码行数:12,代码来源:PaletteButtonsControl.cs

示例4: DrawForegroundFromButton

 private void DrawForegroundFromButton(PaintEventArgs pevent)
 {
     if (_imageButton == null) {
         _imageButton = new Button();
         _imageButton.Parent = new TransparentControl();
         _imageButton.SuspendLayout();
         _imageButton.BackColor = Color.Transparent;
         _imageButton.FlatAppearance.BorderSize = 0;
         _imageButton.FlatStyle = FlatStyle.Flat;
     }
     else {
         _imageButton.SuspendLayout();
     }
     _imageButton.AutoEllipsis = AutoEllipsis;
     if (Enabled) {
         _imageButton.ForeColor = ForeColor;
     }
     else {
         _imageButton.ForeColor = Color.FromArgb((3 * ForeColor.R + _backColor.R) >> 2,
             (3 * ForeColor.G + _backColor.G) >> 2,
             (3 * ForeColor.B + _backColor.B) >> 2);
     }
     _imageButton.Font = Font;
     _imageButton.RightToLeft = RightToLeft;
     _imageButton.Image = Image;
     if (Image != null && !Enabled) {
         Size size = Image.Size;
         float[][] newColorMatrix = new float[5][];
         newColorMatrix[0] = new float[] { 0.2125f, 0.2125f, 0.2125f, 0f, 0f };
         newColorMatrix[1] = new float[] { 0.2577f, 0.2577f, 0.2577f, 0f, 0f };
         newColorMatrix[2] = new float[] { 0.0361f, 0.0361f, 0.0361f, 0f, 0f };
         float[] arr = new float[5];
         arr[3] = 1f;
         newColorMatrix[3] = arr;
         newColorMatrix[4] = new float[] { 0.38f, 0.38f, 0.38f, 0f, 1f };
         System.Drawing.Imaging.ColorMatrix matrix = new System.Drawing.Imaging.ColorMatrix(newColorMatrix);
         System.Drawing.Imaging.ImageAttributes disabledImageAttr = new System.Drawing.Imaging.ImageAttributes();
         disabledImageAttr.ClearColorKey();
         disabledImageAttr.SetColorMatrix(matrix);
         _imageButton.Image = new Bitmap(Image.Width, Image.Height);
         using (Graphics gr = Graphics.FromImage(_imageButton.Image)) {
             gr.DrawImage(Image, new Rectangle(0, 0, size.Width, size.Height), 0, 0, size.Width, size.Height, GraphicsUnit.Pixel, disabledImageAttr);
         }
     }
     _imageButton.ImageAlign = ImageAlign;
     _imageButton.ImageIndex = ImageIndex;
     _imageButton.ImageKey = ImageKey;
     _imageButton.ImageList = ImageList;
     _imageButton.Padding = Padding;
     _imageButton.Size = Size;
     _imageButton.Text = Text;
     _imageButton.TextAlign = TextAlign;
     _imageButton.TextImageRelation = TextImageRelation;
     _imageButton.UseCompatibleTextRendering = UseCompatibleTextRendering;
     _imageButton.UseMnemonic = UseMnemonic;
     _imageButton.ResumeLayout();
     InvokePaint(_imageButton, pevent);
     if (_imageButton.Image != null && _imageButton.Image != Image) {
         _imageButton.Image.Dispose();
         _imageButton.Image = null;
     }
 }
开发者ID:andyhebear,项目名称:winforms-modernui,代码行数:62,代码来源:GlassButton.cs

示例5: MenuButton

        public static Button MenuButton(IXsdPart part, ToolTip tooltip = null)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(part.Name))
                {
                    throw new ArgumentNullException();
                }
                var button = new Button();
                button.SuspendLayout();
                //button.AutoSize = true;
                button.BackColor = System.Drawing.Color.FromArgb(234, 234, 234);
                button.FlatAppearance.BorderSize = 0;
                button.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
                button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
                button.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                button.Font = Methods.BaseFont;
                button.UseVisualStyleBackColor = false;
                button.Size = new System.Drawing.Size(152, 23);
                button.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0);
                button.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                button.Name = "b" + part.Name;
                button.Text = part.Name;
                button.Tag = part;

                if (tooltip != null)
                {
                    tooltip.SetToolTip(button, part.Documentation);
                }

                button.Click += new System.EventHandler(Methods.MenuButton_Click);
                button.MouseEnter += new System.EventHandler(Methods.MenuButton_MouseEnter);
                button.MouseLeave += new System.EventHandler(Methods.MenuButton_MouseLeave);

                button.ResumeLayout();
                return button;
            }
            catch (Exception ex)
            {
                return null;
            }
        }
开发者ID:jaffinito,项目名称:dotnet_configuration,代码行数:42,代码来源:Controls.cs

示例6: Password

        /// <summary>
        /// force means ignore any cache and require the user to enter a password
        /// </summary>
        /// <param name="prompt"></param>
        /// <param name="force"></param>
        /// <returns></returns>
        public static string Password(string prompt, bool requireEntry)
        {
            string passwordFileName;
            if (!string.IsNullOrWhiteSpace(prompt))
            {
                if (ProcessFunctions.KeplerProcess != null)
                {
                    passwordFileName = SwishFunctions.GeneratePasswordFileName(prompt, ProcessFunctions.KeplerProcess);
                    passwordFileName = Path.Combine(Path.GetTempPath(), passwordFileName);

                    if (!requireEntry && FileFunctions.FileExists(passwordFileName))
                    {
                        string _encodedPassword = File.ReadAllText(passwordFileName);
                        string _password = SwishFunctions.DecodePassword(_encodedPassword, ProcessFunctions.KeplerProcess);
                        return _password;
                    }
                } else
                {
                    passwordFileName = string.Empty;
                }
            } else
            {
                prompt = "Please enter password";
                passwordFileName = string.Empty;
            }

            string password;

            using (MaskedTextBox textBox = new MaskedTextBox())
            using (Panel panel = new Panel())
            using (Button buton = new Button())
            using (Form form = new Form())
            {
                textBox.SuspendLayout();
                buton.SuspendLayout();
                panel.SuspendLayout();
                form.SuspendLayout();

                textBox.UseSystemPasswordChar = true;
                textBox.Multiline = true;
                textBox.SelectionStart = 0;
                textBox.SelectionLength = 0;
                textBox.Size = new Size(300, textBox.Height);
                textBox.Dock = DockStyle.Top;
                textBox.Font = new Font(textBox.Font, FontStyle.Bold);
                textBox.TabIndex = 0;

                buton.Click += new EventHandler(buton_Click);
                buton.Dock = DockStyle.Left;
                buton.Text = "Ok";
                buton.Size = new Size(75, 23);
                buton.TabIndex = 0;

                panel.Height = 23;
                panel.Controls.Add(buton);
                panel.Dock = DockStyle.Fill;
                panel.TabIndex = 1;

                form.ControlBox = false;
                form.Text = prompt;
                form.ClientSize = new Size(300, 43);
                form.Controls.Add(panel);
                form.Controls.Add(textBox);
                form.AcceptButton = buton;

                textBox.ResumeLayout();
                buton.ResumeLayout();
                panel.ResumeLayout();
                form.ResumeLayout();

                textBox.Focus();
                form.ShowDialog();

                password = textBox.Text;
            }

            if (string.IsNullOrWhiteSpace(password))
            {
                return string.Empty;
            }

            if (string.IsNullOrWhiteSpace(passwordFileName))
            {
                return password;
            }

            string encodedPassword = SwishFunctions.EncodePassword(password, ProcessFunctions.KeplerProcess);
            if (File.Exists(passwordFileName))
            {
                FileFunctions.DeleteFile(passwordFileName, null);
            }
            File.WriteAllText(passwordFileName, encodedPassword);

            return password;
//.........这里部分代码省略.........
开发者ID:swish-climate-impact-assessment,项目名称:swish-kepler-actors,代码行数:101,代码来源:AdapterFunctions.cs

示例7: MakeTallyRow

 public override Control MakeTallyRow(Control container, SubPop subPop)
 {
     Button tallyButton = new Button();
     tallyButton.SuspendLayout();
     tallyButton.Text = subPop.TDV.Species;
     tallyButton.Click += new EventHandler(base.OnSpeciesButtonClick);
     tallyButton.Tag = subPop;
     tallyButton.Parent = container;
     tallyButton.Dock = DockStyle.Top;
     tallyButton.ResumeLayout(false);
     return tallyButton;
 }
开发者ID:FMSC-Measurements,项目名称:FScruiserV2,代码行数:12,代码来源:LayoutTreeBased.cs


注:本文中的System.Windows.Forms.Button.SuspendLayout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。