ButtonBase.ImageAlign Propiedad

Definición

Obtiene o establece la alineación de la imagen en el control de botón.

public:
 property System::Drawing::ContentAlignment ImageAlign { System::Drawing::ContentAlignment get(); void set(System::Drawing::ContentAlignment value); };
public System.Drawing.ContentAlignment ImageAlign { get; set; }
member this.ImageAlign : System.Drawing.ContentAlignment with get, set
Public Property ImageAlign As ContentAlignment

Valor de propiedad

ContentAlignment

Uno de los valores de ContentAlignment. El valor predeterminado es MiddleCenter.

Excepciones

El valor asignado no es uno de los valores de ContentAlignment.

Ejemplos

En el ejemplo de código siguiente se usa la clase Button derivada y se establecen algunas de sus propiedades comunes. El resultado será un botón plano con texto a la izquierda y una imagen a la derecha. Este código requiere que tenga una imagen de mapa de bits denominada MyBitMap.bmp almacenada en el C:\Graphics directorio y que se incluya una referencia al System.Drawing espacio de nombres.

private:
   void SetMyButtonProperties()
   {
      // Assign an image to the button.
      button1->Image = Image::FromFile( "C:\\Graphics\\MyBitmap.bmp" );
      // Align the image and text on the button.
      button1->ImageAlign = ContentAlignment::MiddleRight;
      button1->TextAlign = ContentAlignment::MiddleLeft;
      // Give the button a flat appearance.
      button1->FlatStyle = FlatStyle::Flat;
   }
private void SetMyButtonProperties()
 {
    // Assign an image to the button.
    button1.Image = Image.FromFile("C:\\Graphics\\MyBitmap.bmp");
    // Align the image and text on the button.
    button1.ImageAlign = ContentAlignment.MiddleRight;    
    button1.TextAlign = ContentAlignment.MiddleLeft;
    // Give the button a flat appearance.
    button1.FlatStyle = FlatStyle.Flat;
 }
Private Sub SetMyButtonProperties()
    ' Assign an image to the button.
    button1.Image = Image.FromFile("C:\Graphics\MyBitmap.bmp")
    ' Align the image and text on the button.
    button1.ImageAlign = ContentAlignment.MiddleRight
    button1.TextAlign = ContentAlignment.MiddleLeft
    ' Give the button a flat appearance.
    button1.FlatStyle = FlatStyle.Flat
End Sub

Se aplica a

Consulte también