Personas que lo han encontrado útil: 1 de 1 - Valorar este tema

ScrollBars (Enumeración)

Actualización: noviembre 2007

Especifica qué barras de desplazamiento serán visibles en un control.

Espacio de nombres:  System.Windows.Forms
Ensamblado:  System.Windows.Forms (en System.Windows.Forms.dll)
public enum ScrollBars
public enum ScrollBars
public enum ScrollBars
Nombre de miembro Descripción
ez19zfwd.CFW(es-es,VS.90).gif None No se muestra ninguna barra de desplazamiento.
ez19zfwd.CFW(es-es,VS.90).gif Horizontal Se muestran sólo las barras de desplazamiento horizontal.
ez19zfwd.CFW(es-es,VS.90).gif Vertical Se muestran sólo las barras de desplazamiento vertical.
ez19zfwd.CFW(es-es,VS.90).gif Both Se muestran las barras de desplazamiento horizontal y vertical.

TextBox.ScrollBars utiliza esta enumeración.

No todos los controles admiten barras de desplazamiento. Utilice esta enumeración para especificar qué barras de desplazamiento serán visibles en un control, en todas o en algunas circunstancias.

El ejemplo de código siguiente muestra cómo utilizar la enumeración ScrollBars.Para ejecutar el ejemplo, pegue el código siguiente en un formulario. Llame al método SetFourDifferentScrollBars en el constructor del formulario o en el método de control de eventos Load.


	// Declare four textboxes.
	internal System.Windows.Forms.TextBox vertical;
	internal System.Windows.Forms.TextBox horizontal;
	internal System.Windows.Forms.TextBox both;
	internal System.Windows.Forms.TextBox none;

	private void SetFourDifferentScrollBars()
	{
		
		this.vertical = new System.Windows.Forms.TextBox();
		this.horizontal = new System.Windows.Forms.TextBox();
		this.both = new System.Windows.Forms.TextBox();
		this.none = new System.Windows.Forms.TextBox();

		// Create a string for the Text property.
		string startString = "The scroll bar style for my textbox is: ";

		// Set the location of the four textboxes.
		horizontal.Location = new Point(10, 10);
		vertical.Location = new Point(10, 70);
		none.Location = new Point(10, 170);
		both.Location = new Point(10, 110);

		// For horizonal scroll bars, the Multiline property must
		// be true and the WordWrap property must be false.
		// Increase the size of the Height property to ensure the 
		// scroll bar is visible.
		horizontal.ScrollBars = ScrollBars.Horizontal;
		horizontal.Multiline = true;
		horizontal.WordWrap = false;
		horizontal.Height = 40;
		horizontal.Text = startString + 
			ScrollBars.Horizontal.ToString();

		// For the vertical scroll bar, Multiline must be true.
		vertical.ScrollBars = ScrollBars.Vertical;
		vertical.Multiline = true;
		vertical.Text = startString + ScrollBars.Vertical.ToString();

		// For both scroll bars, the Multiline property 
		// must be true, and the WordWrap property must be false.
		// Increase the size of the Height property to ensure the 
		// scroll bar is visible.
		both.ScrollBars = ScrollBars.Both;
		both.Multiline = true;
		both.WordWrap = false;
		both.Height = 40;
		both.AcceptsReturn = true;
		both.Text = startString + ScrollBars.Both.ToString();

		// The none scroll bar does not require specific 
		// property settings.
		none.ScrollBars = ScrollBars.None;
		none.Text = startString + ScrollBars.None.ToString();

		// Add the textboxes to the form.
		this.Controls.Add(this.vertical);
		this.Controls.Add(this.horizontal);
		this.Controls.Add(this.both);
		this.Controls.Add(this.none);

	}


// Declare four textboxes.
System.Windows.Forms.TextBox vertical;
System.Windows.Forms.TextBox horizontal;
System.Windows.Forms.TextBox both;
System.Windows.Forms.TextBox none;

private void SetFourDifferentScrollBars()
{
    this.vertical = new System.Windows.Forms.TextBox();
    this.horizontal = new System.Windows.Forms.TextBox();
    this.both = new System.Windows.Forms.TextBox();
    this.none = new System.Windows.Forms.TextBox();
    // Create a string for the Text property.
    String startString = "The scroll bar style for my textbox is: ";
    // Set the location of the four textboxes.
    horizontal.set_Location(new Point(10, 10));
    vertical.set_Location(new Point(10, 70));
    none.set_Location(new Point(10, 170));
    both.set_Location(new Point(10, 110));
    // For horizonal scroll bars, the Multiline property must
    // be true and the WordWrap property must be false.
    // Increase the size of the Height property to ensure the 
    // scroll bar is visible.
    horizontal.set_ScrollBars(ScrollBars.Horizontal);
    horizontal.set_Multiline(true);
    horizontal.set_WordWrap(false);
    horizontal.set_Height(40);
    horizontal.set_Text(startString + ScrollBars.Horizontal.ToString());
    // For the vertical scroll bar, Multiline must be true.
    vertical.set_ScrollBars(ScrollBars.Vertical);
    vertical.set_Multiline(true);
    vertical.set_Text(startString + ScrollBars.Vertical.ToString());
    // For both scroll bars, the Multiline property 
    // must be true, and the WordWrap property must be false.
    // Increase the size of the Height property to ensure the 
    // scroll bar is visible.
    both.set_ScrollBars(ScrollBars.Both);
    both.set_Multiline(true);
    both.set_WordWrap(false);
    both.set_Height(40);
    both.set_AcceptsReturn(true);
    both.set_Text(startString + ScrollBars.Both.ToString());
    // The none scroll bar does not require specific 
    // property settings.
    none.set_ScrollBars(ScrollBars.None);
    none.set_Text(startString + ScrollBars.None.ToString());
    // Add the textboxes to the form.
    this.get_Controls().Add(this.vertical);
    this.get_Controls().Add(this.horizontal);
    this.get_Controls().Add(this.both);
    this.get_Controls().Add(this.none);
} //SetFourDifferentScrollBars 


Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile para Smartphone, Windows Mobile para Pocket PC

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

.NET Framework

Compatible con: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Compatible con: 3.5, 2.0, 1.0
¿Le ha resultado útil?
(Caracteres restantes: 1500)
Contenido de la comunidad Agregar