asp:DropDownList 的一些属性

asp:DropDownList 的一些属性使用 BorderStyle 属性为Web服务器控件指定边框样式。 使用一个 BorderStyle 枚举值设置此属性。 下表列出了可能的值。边框样式说明NotSet不设置边框样式。None无边框Dotted虚线边框。

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

使用 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>

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/181059.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • densenet解析_给我一个承诺详细解读

    densenet解析_给我一个承诺详细解读这篇文章是DenselyConnectedConvolutionalNetworks的解读,在精简部分内容的同时补充了相关的概念。如有错误,敬请指正。

    2022年9月29日
    0
  • Origin简单绘图

    Origin简单绘图一、从cadence导出数据仿真生成波形之之后,鼠标选中波形,右击—>SendTo—>Export,进行csv数据的保存。打开该csv文件,删掉第一行,第一行是是横纵坐标的标识,左侧第一列是横坐标值,右侧列是纵坐标值。二、origin简单绘图双击图标打开origin导入csv数据可选中多个csv文件导入为了让两个csv的数据同时显示,在弹出的对话框进行以下操作(默认第二个csv数据会覆盖第一个csv数据)。设置好之后点击“确定”,两个csv数据均被导入到了o

    2022年6月1日
    49
  • get请求的长度限制是多少_url长度限制为多少

    get请求的长度限制是多少_url长度限制为多少Httpget方法提交的数据大小长度并没有限制,Http协议规范没有对URL长度进行限制。目前说的get长度有限制,是特定的浏览器及服务器对它的限制。各种浏览器和服务器的最大处理能力如下:IE:对URL的最大限制为2083个字符,若超出这个数字,提交按钮没有任何反应。Firefox:对Firefox浏览器URL的长度限制为:65536个字符。Safari:URL最大长度限制为80000个字符。Opera:URL最大长度限制为190000个字符。Goog

    2022年8月24日
    37
  • C语言 按位异或运算

    C语言 按位异或运算按位异或运算:规律:无论0或1,异或1取反,异或0不变变量交换:题一:给定两个数a和b,用异或运算交换它们的值。思路:1)中间量t=a^b2)b=tb,相当于abb,根据异或性质知道ab^b=a,所以b=t^b就是b=a(异或性质:异或两次不变)3)a=t^a,道理同上出现奇数次的数:题二:输入n个数,其中只有一个数出现了奇数次,其它所有数都出现了偶数次。求这个出现了奇数次的数。思路:根据异或的性质,两个一样的数异或结果为零。也就是所有出现偶数

    2022年5月25日
    40
  • solidworks常用快捷键命令大全_solidworks怎么设置快捷键

    solidworks常用快捷键命令大全_solidworks怎么设置快捷键为了更好的节约大家的设计时间,小编花了一番功夫为大家整理出了一份SolidWorks的快捷键大全,希望可以帮助到大家。

    2022年9月28日
    0
  • xmind使用指南(XMind具有下列哪些功能)

    ..6年的工作利用思维导图只需要6个月就可以轻松完成了?据美国波音飞机设计人员透露,他们按照传统方法设计一架飞机大概要花费6到7年的时间。然而当他们引入思维导图工具后,设计时间大大缩短,原本需要花费6年时间的工作居然6个月就提前完成了,不但如此,还大大为公司节省了数千万美元的费用。傲看今朝图片来自网络由此可见,思维导图是一个非常高效强大、实用的思维工具。目前世界500强包括惠普、…

    2022年4月15日
    133

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号