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


C# Form.AutoScroll属性代码示例

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


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

示例1: DisplayMyScrollableForm

private void DisplayMyScrollableForm()
{
   // Create a new form.
   Form form2 = new Form();
   // Create a button to add to the new form.
   Button button1 = new Button();
   // Set text for the button.
   button1.Text = "Scrolled Button";
   // Set the size of the button.
   button1.Size = new Size(100,30);
   // Set the location of the button to be outside the form's client area.
   button1.Location = new Point(form2.Size.Width + 200, form2.Size.Height + 200);

   // Add the button control to the new form.
   form2.Controls.Add(button1);
   // Set the AutoScroll property to true to provide scrollbars.
   form2.AutoScroll = true;

   // Display the new form as a dialog box.
   form2.ShowDialog();
}
开发者ID:.NET开发者,项目名称:System.Windows.Forms,代码行数:21,代码来源:Form.AutoScroll

示例2: Form1

//引入命名空间
using System;
  using System.Drawing;
  using System.Collections;
  using System.ComponentModel;
  using System.Windows.Forms;
  using System.Data;

  public class Form1 : System.Windows.Forms.Form
  {
    private System.Windows.Forms.Label label1;
    private System.ComponentModel.Container components;
  
    public Form1()
    {
      InitializeComponent();
    }

    protected override void Dispose( bool disposing )
    {
      if( disposing )
      {
        if (components != null) 
        {
          components.Dispose();
        }
      }
      base.Dispose( disposing );
    }

    private void InitializeComponent()
    {
      this.label1 = new System.Windows.Forms.Label();
      this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F);
      this.label1.Location = new System.Drawing.Point(16, 16);
      this.label1.Size = new System.Drawing.Size(376, 224);
      this.label1.TabIndex = 0;
      this.label1.Text = "Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text ";
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
      this.AutoScroll = true;
      this.AutoScrollMinSize = new System.Drawing.Size(300, 300);
      this.ClientSize = new System.Drawing.Size(403, 256);
      this.Controls.AddRange(new System.Windows.Forms.Control[] {this.label1});
      this.Text = "Form1";

    }

    [STAThread]
    static void Main() 
    {
      Application.Run(new Form1());
    }
  }
开发者ID:C#程序员,项目名称:System.Windows.Forms,代码行数:53,代码来源:Form.AutoScroll


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