Share via


ImageFieldValue.Alignment Property

Gets or sets the alignment of the Image object in relation to other elements on the Web page.

Namespace:  Microsoft.SharePoint.Publishing.Fields
Assembly:  Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)

Syntax

'Declaration
Public Property Alignment As String
    Get
    Set
'Usage
Dim instance As ImageFieldValue
Dim value As String

value = instance.Alignment

instance.Alignment = value
public string Alignment { get; set; }

Property Value

Type: System.String
The alignment of the Image in relation to other elements on the Web page.
Default is an empty string.

Remarks

The value of this property is the align attribute in the <IMG> tag in the ToString method output.

Valid values for alignment include right, left, top, and bottom.

Examples

// You can change any of the following data that are set into the ImageFieldValue
private const string NewImageUrl = "/SiteCollectionImages/SampleImage.jpg";
private const string NewHyperlink = "/Pages/SamplePage.aspx";
private const bool NewOpenHyperlinkInNewWindow = true;
private const string NewAlignment = "right";
private const string NewAlternateText = "Sample alternate text for the image";
private const int NewBorderWidth = 4;
private const int NewHeight = 100;
private const int NewWidth = 150;
private const int NewHorizontalSpacing = 10;
private const int NewVerticalSpacing = 15;

Note

This example is part of the larger ImageFieldValue sample in the ImageFieldValue topic.

See Also

Reference

ImageFieldValue Class

ImageFieldValue Members

Microsoft.SharePoint.Publishing.Fields Namespace