当前位置: 首页 > article >正文

asp:DropDownList 的一些属性

使用 BorderStyle 属性为 Web 服务器控件指定边框样式。 使用一个 BorderStyle 枚举值设置此属性。 下表列出了可能的值。

边框样式

说明

NotSet

不设置边框样式。

None

无边框

Dotted

虚线边框。

Dashed

点划线边框。

Solid

实线边框。

Double

双实线边框。

Groove

用于凹陷边框外观的凹槽状边框。

Ridge

用于凸起边框外观的突起边框。

Inset

用于凹陷控件外观的内嵌边框。

Outset

用于凸起控件外观的外嵌边框。

 

<%@ Page language="c#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Drawing" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
// Determine whether this is the first time the page is loaded;
// if so, load the drop-down lists with data.
if (!Page.IsPostBack)
{
// Create a ListItemCollection and add names of colors.
ListItemCollection colors = new ListItemCollection();
colors.Add(Color.Black.Name);
colors.Add(Color.Blue.Name);
colors.Add(Color.Green.Name);
colors.Add(Color.Orange.Name);
colors.Add(Color.Purple.Name);
colors.Add(Color.Red.Name);
colors.Add(Color.White.Name);
colors.Add(Color.Yellow.Name);
// Bind the colors collection to the borderColorList.
borderColorList.DataSource = colors;
borderColorList.DataBind();
// Create a ListItemCollection and the add names of 
// the BorderStyle enumeration values.
ListItemCollection styles = new ListItemCollection();
foreach (string s in Enum.GetNames(typeof(BorderStyle)))
{
styles.Add(s);
}
// Bind the styles collection to the borderStyleList.
borderStyleList.DataSource = styles;
borderStyleList.DataBind();
// Create a ListItemCollection and add width values
// expressed in pixels (px).
ListItemCollection widths = new ListItemCollection();
for (int i = 0; i < 11; i++)
{
widths.Add(i.ToString() + "px");
}
// Bind the widths collection to the borderWidthList.
borderWidthList.DataSource = widths;
borderWidthList.DataBind();
}
}
// This method handles the SelectedIndexChanged event for borderColorList.
public void ChangeBorderColor(object sender, System.EventArgs e)
{
// Convert the color name string to an object of type Color, 
// and set the Color as the new border color for Label1.
Label1.BorderColor = Color.FromName(borderColorList.SelectedItem.Text);
}
// This method handles the selectedIndexChanged event for boderStyleList.
public void ChangeBorderStyle(object sender, System.EventArgs e)
{
// Convert the style name string to a BorderStyle enumeration value,
// and set the BorderStyle as the new border style for Label1.
Label1.BorderStyle = (BorderStyle)Enum.Parse(typeof(BorderStyle),
borderStyleList.SelectedItem.Text);
}
// This method handles the SelectedIndexChanged event for borderWidthList.
public void ChangeBorderWidth(object sender, System.EventArgs e)
{
// Convert the border width string to a object of type Unit,
// and set the Unit as the new border width for Label1.
Label1.BorderWidth = Unit.Parse(borderWidthList.SelectedItem.Text);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title> Border Properties Example </title>
</head>
<body>
<form id="form1" runat="server">
<h3> Border Properties Example </h3>
<table border="0" cellpadding="6">
<tr>
<td>
<asp:Label Runat="server" BorderColor="Black" 
BorderStyle="Solid" BorderWidth="4px" ID="Label1" 
Text="Border Properties Example" Height="75" 
Width="200"><center><br />Border Properties Example
</center></asp:Label>
</td>
<td>
<asp:DropDownList Runat="server" ID="borderColorList" 
OnSelectedIndexChanged="ChangeBorderColor" AutoPostBack="True" 
EnableViewState="True"></asp:DropDownList>
<br />
<br />
<asp:DropDownList Runat="server" ID="borderStyleList" 
OnSelectedIndexChanged="ChangeBorderStyle" AutoPostBack="True" 
EnableViewState="True"></asp:DropDownList>
<br />            
<br />
<asp:DropDownList Runat="server" ID="borderWidthList" 
OnSelectedIndexChanged="ChangeBorderWidth" AutoPostBack="True"
EnableViewState="True"></asp:DropDownList>
</td>
</tr>
</table>
</form>
</body>
</html>


 

http://www.lryc.cn/news/2412513.html

相关文章:

  • 网络抓包原理及Fiddler的使用
  • SHELLEXECUTEINFO,ShellExecuteEx
  • Win7 开启显示快速启动工具栏,发送到快速启动右键菜单
  • leetcode刷题汇总
  • 假如金融危机来临,比特币、房产、黄金哪个更保值?
  • rr与hr_统计基本功:OR、RR和HR的区别和选择
  • 方差分析(单因素ANOVA(One-Way ANOVA)、两因素ANOVA(Two-Way ANOVA))
  • Halcon找圆系列(1)如何检测圆形
  • 硬盘检测HD tune使用教程(图文)
  • 全国大学生网络安全精英赛练习题
  • 活久见!TCP两次挥手,你见过吗?那四次握手呢?
  • [Win10]鼠标没用,插入USB口电脑提示USB Optical Mouse找不到驱动程序的解决方案
  • 智能股票选取系统(JSP+java+springmvc+mysql+MyBatis)
  • 怎样利用directX SDK
  • Expression Blend4经验分享:自适应布局浅析
  • 数据挖掘技术:从数据中挖掘价值
  • Linux网络编程:socket与常用函数
  • 【前端素材】推荐5种优质大数据分析展示页面网站设计(8)(附源码)
  • 【QT开发教程】Qt多线程编程:提高应用性能
  • Android 程序静态分析
  • CIS关键工艺技术概览
  • 商城源码:建立自己的电子商务平台的利器!
  • Python3 识别判断图片主要颜色,提取指定颜色的方法
  • 计算机的起源与发展历程
  • Leetcode 483 - Smallest Good Base(二分+枚举)
  • 抬杠APP获Donews“年度最佳运营创意”大奖,跨界营销引瞩目
  • 黑苹果教程 win7+virtualbox安装Mac os搭建完美越狱环境
  • android 上传图片到服务器_画质无损,体积减半,这些图片压缩神器,你一定要知道!...
  • 【网络安全】brainpan-windows缓冲区溢出详解
  • 制作windows xp开机画面并替换