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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 百度–计算机安全

    百度–计算机安全木马终结 …电脑病毒是什么东西呢?是否会像其他病毒,如“H5N1”、“O-157大肠杆菌”、“HIV”一样对人体造成伤害呢?电脑病毒是会造成伤害,但不是对你造成伤害,而是对你的电脑系统造成一定的伤害。其实,电脑病毒是一段非常小的(通常只有几KB)会不断… 14508字 2007-06-20 popo8819 C盘杀手 …病毒病毒名称 : W97M/Thus.A 别名:C盘杀手 病毒特点

    2022年7月25日
    10
  • ps磨皮插件portraiture「建议收藏」

    ps磨皮插件portraiture「建议收藏」相信大家在使用photoshop的时候经常会配合插件来进行修图,而ps磨皮插件portraiture也是大多数人的必备插件,因为当你需要处理人像照片的话,那么磨皮将是必不可少的一个步骤,而该插件正是一个功能强大的磨皮滤镜插件,不仅为用户们提供了强大的磨皮效果,还使用起来十分的简单,无需繁琐的使用步骤,只需要简简单单的设置下磨皮参数再随意的调整下即可快速的帮助用户进行磨皮处理啦,非常方便,所以如果你要用ps的话怎么可以缺少这款ps磨皮插件呢?另外,使用这款插件的时候,你会发现它直接为用户们提供了一个单独的面板

    2022年7月22日
    22
  • IoT — (四) 物联网系统架构介绍[通俗易懂]

    IoT — (四) 物联网系统架构介绍[通俗易懂]  物联网(IoT)是目前最新最热的技术热点之一,也是这个信息化时代的重要发展节点。相对于互联网而言,物联网的本质在于“万物相连”。物联网的核心和基础仍然是互联网,是在互联网基础上延伸和扩展的网络;其用户端延伸和扩展到了任何物品与物品之间,进行信息交换和通信,也就是物物相息。  物联网操作系统概述:尽管物联网的发展形态受到普遍看好和关注,但是“连接、区别、识别、沟通、操作”这五大问题一直如影随形…

    2022年9月17日
    0
  • 操作系统进程有若干个状态,若一个进程_进程和线程的概念

    操作系统进程有若干个状态,若一个进程_进程和线程的概念第二章进程管理-进程、线程进程的概念进程是进程实体的运行过程,是系统进行资源分配和调度的一个独立单位。(线程是调度的基本单位)程序:是静态的,是一个存放在磁盘里的可执行文件,是一系列指令的集合进程:是动态的,是程序的一次执行过程

    2022年9月3日
    3
  • 我用Java+Redis+ES+Kibana技术对数百万知乎用户进行了数据分析,得到了这些…

    点击上方“全栈程序员社区”,星标公众号 重磅干货,第一时间送达 作者:_artoria_ http://tinyurl.com/quscxyl 1. 前言 我是一个真正的知乎小白。…

    2021年6月25日
    88
  • JDBC错误:java.sql.SQLException: ORA-01008: 并非所有变量都已绑定「建议收藏」

    JDBC错误:java.sql.SQLException: ORA-01008: 并非所有变量都已绑定「建议收藏」publicintaddCourseTime(CourseTimeBeanctb){intcsh_no=ctb.getCsh_no();intcsh_id=ctb.getC_id();Stringcsh_start_time=ctb.getCsh_start_time();Stringcsh_due_time=…

    2022年9月7日
    0

发表回复

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

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