本文整理汇总了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();
}
示例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());
}
}