BulletStyle Enumeração
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Especifica os estilos de marcadores que podes aplicar para listar itens num BulletedList controlo.
public enum class BulletStyle
public enum BulletStyle
type BulletStyle =
Public Enum BulletStyle
- Herança
Campos
| Name | Valor | Description |
|---|---|---|
| NotSet | 0 | O estilo da bala não está definido. O navegador que renderiza o BulletedList controlo determinará o estilo de marcador a mostrar. |
| Numbered | 1 | O estilo de bala é um número (1, 2, 3, ...). |
| LowerAlpha | 2 | O estilo das balas é uma letra minúscula (a, b, c, ...). |
| UpperAlpha | 3 | O estilo de bala é uma letra maiúscula (A, B, C, ...). |
| LowerRoman | 4 | O estilo das balas é um numeral romano minúsculo (i, ii, iii, ...). |
| UpperRoman | 5 | O estilo das balas é um numeral romano maiúsculo (I, II, III, ...). |
| Disc | 6 | O estilo da bala é um círculo preenchido. |
| Circle | 7 | O estilo da bala é uma forma de círculo vazio. |
| Square | 8 | O estilo da bala é um formato quadrado preenchido. |
| CustomImage | 9 | O estilo da bala é uma imagem personalizada. |
Exemplos
O exemplo seguinte demonstra como criar um BulletedList controlo. Um ListBox controlo é preenchido com todos os valores de enumeração disponíveis BulletStyle . O estilo do marcador muda consoante o estilo que o utilizador seleciona na caixa da lista.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>
BulletStyle Example</title>
<script runat="server">
protected void Index_Changed(object sender, EventArgs e)
{
// Change the message displayed, based on
// the style selected from the list box.
if (BulletStylesListBox.SelectedIndex > -1)
{
Message.Text = "You selected bullet style: " +
BulletStylesListBox.SelectedItem.Text;
}
// Change the bullet style used, based on
// the style selected from the list box.
switch (BulletStylesListBox.SelectedIndex)
{
case 0:
ItemsBulletedList.BulletStyle = BulletStyle.Numbered;
break;
case 1:
ItemsBulletedList.BulletStyle = BulletStyle.LowerAlpha;
break;
case 2:
ItemsBulletedList.BulletStyle = BulletStyle.UpperAlpha;
break;
case 3:
ItemsBulletedList.BulletStyle = BulletStyle.LowerRoman;
break;
case 4:
ItemsBulletedList.BulletStyle = BulletStyle.UpperRoman;
break;
case 5:
ItemsBulletedList.BulletStyle = BulletStyle.Disc;
break;
case 6:
ItemsBulletedList.BulletStyle = BulletStyle.Circle;
break;
case 7:
ItemsBulletedList.BulletStyle = BulletStyle.Square;
break;
case 8:
ItemsBulletedList.BulletStyle = BulletStyle.CustomImage;
// Specify the path to the custom image to use for the bullet.
ItemsBulletedList.BulletImageUrl = "Images/image1.jpg";
break;
case 9:
Message.Text = "You selected NotSet. The browser will determine the bullet style.";
break;
default:
throw new Exception("You did not select a valid bullet style.");
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<h3>
BulletStyle Example</h3>
<asp:BulletedList ID="ItemsBulletedList" DisplayMode="Text" BulletStyle="NotSet"
runat="server">
<asp:ListItem Value="0">Coho Winery</asp:ListItem>
<asp:ListItem Value="1">Contoso, Ltd.</asp:ListItem>
<asp:ListItem Value="2">Tailspin Toys</asp:ListItem>
</asp:BulletedList>
<hr />
<h4>
Select a bullet type:</h4>
<asp:ListBox ID="BulletStylesListBox" SelectionMode="Single" Rows="1" OnSelectedIndexChanged="Index_Changed"
AutoPostBack="True" runat="server">
<asp:ListItem Value="Numbered">Numbered</asp:ListItem>
<asp:ListItem Value="LowerAlpha">LowerAlpha</asp:ListItem>
<asp:ListItem Value="UpperAlpha">UpperAlpha</asp:ListItem>
<asp:ListItem Value="LowerRoman">LowerRoman</asp:ListItem>
<asp:ListItem Value="UpperRoman">UpperRoman</asp:ListItem>
<asp:ListItem>Disc</asp:ListItem>
<asp:ListItem>Circle</asp:ListItem>
<asp:ListItem>Square</asp:ListItem>
<asp:ListItem>CustomImage</asp:ListItem>
<asp:ListItem Value="NotSet">NotSet</asp:ListItem>
</asp:ListBox>
<hr />
<asp:Label ID="Message" runat="server" AssociatedControlID="BulletStylesListBox" />
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>BulletStyle Example</title>
<script runat="server">
Sub Index_Changed(ByVal sender As Object, ByVal e As System.EventArgs)
' Change the message displayed, based on
' the style selected from the list box.
If BulletStylesListBox.SelectedIndex > -1 Then
Message.Text = "You selected bullet style: " & BulletStylesListBox.SelectedItem.Text
End If
' Change the bullet style used, based on
' the style selected from the list box.
Select Case (BulletStylesListBox.SelectedIndex)
Case 0
ItemsBulletedList.BulletStyle = BulletStyle.Numbered
Case 1
ItemsBulletedList.BulletStyle = BulletStyle.LowerAlpha
Case 2
ItemsBulletedList.BulletStyle = BulletStyle.UpperAlpha
Case 3
ItemsBulletedList.BulletStyle = BulletStyle.LowerRoman
Case 4
ItemsBulletedList.BulletStyle = BulletStyle.UpperRoman
Case 5
ItemsBulletedList.BulletStyle = BulletStyle.Disc
Case 6
ItemsBulletedList.BulletStyle = BulletStyle.Circle
Case 7
ItemsBulletedList.BulletStyle = BulletStyle.Square
Case 8
ItemsBulletedList.BulletStyle = BulletStyle.CustomImage
' Specify the path to the custom image to use for the bullet.
ItemsBulletedList.BulletImageUrl = "Images/image1.jpg"
Case 9
Message.Text = "You selected NotSet. The browser will determine the bullet style."
Case Else
Throw New Exception("You did not select a valid bullet style.")
End Select
End Sub
</script>
</head>
<body>
<form id="form1" runat="server">
<h3>BulletStyle Example</h3>
<asp:BulletedList id="ItemsBulletedList"
DisplayMode="Text"
BulletStyle="NotSet"
runat="server">
<asp:ListItem Value="0">Coho Winery</asp:ListItem>
<asp:ListItem Value="1">Contoso, Ltd.</asp:ListItem>
<asp:ListItem Value="2">Tailspin Toys</asp:ListItem>
</asp:BulletedList>
<hr />
<h4>Select a bullet type:</h4>
<asp:ListBox id="BulletStylesListBox"
SelectionMode="Single"
Rows="1"
OnSelectedIndexChanged="Index_Changed"
AutoPostBack="True"
runat="server">
<asp:ListItem Value="Numbered">Numbered</asp:ListItem>
<asp:ListItem Value="LowerAlpha">LowerAlpha</asp:ListItem>
<asp:ListItem Value="UpperAlpha">UpperAlpha</asp:ListItem>
<asp:ListItem Value="LowerRoman">LowerRoman</asp:ListItem>
<asp:ListItem Value="UpperRoman">UpperRoman</asp:ListItem>
<asp:ListItem>Disc</asp:ListItem>
<asp:ListItem>Circle</asp:ListItem>
<asp:ListItem>Square</asp:ListItem>
<asp:ListItem>CustomImage</asp:ListItem>
<asp:ListItem Value="NotSet">NotSet</asp:ListItem>
</asp:ListBox>
<hr />
<asp:Label id="Message"
runat="server"
AssociatedControlID="BulletStylesListBox"/>
</form>
</body>
</html>
Observações
A BulletStyle enumeração representa os estilos de pontos que pode aplicar aos itens da lista num BulletedList controlo. A BulletStyle propriedade utiliza estes valores de enumeração para definir os estilos de pontos num BulletedList controlo. Por exemplo, se definir a BulletStyle propriedade para Disc, cada item da lista num BulletedList controlo irá renderizar um círculo preenchido antes do conteúdo do item da lista da seguinte forma:
Item da Lista 1
Item da Lista 2
Item da Lista 3
Especificar o estilo da CustomImage bala permite-te fornecer a tua própria imagem para a bala. Se especificar o CustomImage estilo de tópicos, também deve definir a BulletImageUrl propriedade para o URL da imagem personalizada a usar.
Se especificar NotSet, o navegador onde o controlo é renderizado determinará o estilo de marcador a mostrar com os itens da lista no BulletedList controlo.