| |||||||||||
Image.ImageAlign PropertySystem.Web.UI.WebControls Namespace Image Class Sets or retrieves the alignment of the image in relation to other Web page elements. Syntax
Property Value
The property is read/write with a default value of Both. Exceptions
RemarksUse the ImageAlign property to specify or determine the alignment of the image in relation to other elements on the Web page. ExampleThe following example shows how to declaratively set the ImageAlign property of an Image control at design time. <asp:image imageurl = "~/shared/aspxtreme.jpg" width=100 height=30 border=0 alternatetext = "Simply awesome" imagealign = "right" runat = "server" /> The example below shows how to programmatically set the ImageAlign property at run time, depending on user input. The code also demonstrates how simple it is to retrieve the available system alignment styles and dynamically add each to a selectable list. void Page_Load ( Object src, EventArgs e ) {
if ( !IsPostBack ) {
ICollection alignEnum =
TypeDescriptor.GetConverter ( typeof ( ImageAlign ) ).GetStandardValues ( );
foreach ( ImageAlign a in alignEnum ) {
alignSelect.Items.Add ( a.ToString ( ) );
}
}
theImg.ImageAlign = ( ImageAlign ) alignSelect.SelectedIndex;
}
See Also |
| ||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme