最新写的toolbar

原创 2008年09月28日 18:04:00

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;

namespace SysControl
{
    [DefaultEvent("Click")]
    [ToolboxData("<{0}:form1 runat=server></{0}:form1>")]
    public class sysToolbar1 : Panel, IPostBackEventHandler
    {
         public sysToolbar1()
         {
             AddToolbar(this);
            
         }
         protected string getToolbartitles="";
         protected string getToolbarItems="";
        public virtual string Toolbartitles
         {
             get { return getToolbartitles; }
             set { getToolbartitles = value; }
         }
         public string getItemName="";
        public virtual string ToolbarItems
         {
             get { return getToolbarItems; }
             set { getToolbarItems = value; }
         }
        public virtual string ToolItemName
         {
             get { return getItemName; }
             set { getItemName = value; }
         }
         protected string getTitle="";
        public virtual string Titlestr
         {
             get { return getTitle; }
             set { getTitle = value; }
         }
         private void AddToolbar(Panel divs)
         {
             sysdiv div = new sysdiv();
             div.classstr = "top_banner";
             sysdiv div1 = new sysdiv();
             div1.onclickstr = "sysf_ShowMenuSetting("+divs.ClientID+")";
             div1.classstr = "NavigatorBannerTitle";
             div1.stylestr = "float:left;";
             div1.texts = "卡片信息";
             div.Controls.Add(div1);
             sysdiv div2 = new sysdiv();
             div2.stylestr = "float:right;margin-top:5px;";
             sysTable tab = new sysTable();
             tab.stylestr = "border-width:0px;height:16px;border-collapse:collapse;";
             tab.CellSpacing=0;
             tab.CellPadding=0;
             tab.BorderWidth=0;
             sysTabRow row = new sysTabRow();
             row.classstr = "banner_bt_table";
          
             string[] Toolbartitlesstr = Toolbartitles.Split(',');
             string[] ToolbarItemsstr = ToolbarItems.Split(',');
             string[] ItemNamestr = ToolItemName.Split(',');
             for (int i = 0; i < Toolbartitlesstr.Length; i++)
             {
                 row.Controls.Add(addCel(Toolbartitlesstr[i], ToolbarItemsstr[i],ItemNamestr[i]));
                 sysTabcel cel2 = new sysTabcel();
                 cel2.stylestr = "width:16px;";
                 cel2.Text = "|";
                 row.Controls.Add(cel2);
             }
           
       
             tab.Controls.Add(row);
             div2.Controls.Add(tab);
             div.Controls.Add(div2);
             divs.Controls.Add(div);
    
            
         }

         private Control addCel(string Toolbartitlesstr, string ToolbarItemsstr, string ItemNamestr)
         {
             sysTabcel cel = new sysTabcel();
             cel.stylestr = "white-space:nowrap;";
             syslable labe1 = new syslable();
             labe1.stylestr = "cursor:hand;";
             labe1.classstr = "STYLE10";
             labe1.onclickstr = "f_add()";
             labe1.ID ="add";
             labe1.texts = "增加";
             cel.Controls.Add(labe1);
             return cel;
         }
         protected override void AddAttributesToRender(HtmlTextWriter writer)
         {
             base.AddAttributesToRender(writer);
             writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
             writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
             writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
             writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            
         }
         //
         // 摘要:
         //     将 System.Web.UI.WebControls.Panel 控件的 HTML 开始标记呈现到指定的编写器中。
         //
         // 参数:
         //   writer:
         //     System.Web.UI.HtmlTextWriter,表示要在客户端呈现 HTML 内容的输出流。
        public override void RenderBeginTag(HtmlTextWriter writer)
        {
           
        }
         // 定义一个Click事件委托对象
         private static readonly object EventClick = new object();
         //实现Click事件属性
         [Description("Click事件属性"), Category("Action")]
         public event EventHandler Click
         {
             add
             {
                 Events.AddHandler(EventClick, value);
             }
             remove
             {
                 Events.RemoveHandler(EventClick, value);
             }
         }
         void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
         {
             OnClick(EventArgs.Empty, eventArgument);
             //if (eventArgument == "Previous")
             //    PreviousText = "你点击了PreviousText按钮";
             //else if (eventArgument == "Next")
             //    NextText = "你点击了NextText按钮";
         }      //实现事件方法
         protected virtual void OnClick(EventArgs e, string eventArgument)
         {

             EventHandler clickHandler = (EventHandler)Events[EventClick];
             if (clickHandler != null)
             {
                 clickHandler(this, e);
             }

         }
     }
     #region 自定义自控件
     class sysdiv : Panel
    {
        public sysdiv()
        {
        
        }
        private string getonclick;
        private string getclassstr;
        private string getstylestr;
        private string getAlignstr="";
        private string gettexts="";
        public string onclickstr
        {
            get { return getonclick; }
            set { getonclick = value; }
        }
        public string Alignstr
        {
            get { return getAlignstr; }
            set { getAlignstr = value; }
        }
        public string classstr
        {
            get { return getclassstr; }
            set { getclassstr = value; }
        }
        public string stylestr
        {
            get { return getstylestr; }
            set { getstylestr = value; }
        }
        public string texts
        {
            get { return gettexts; }
            set { gettexts = value; }
        }
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, onclickstr);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, getclassstr);
            writer.AddStyleAttribute("", stylestr);
            writer.AddAttribute(HtmlTextWriterAttribute.Align, Alignstr);
            AddText(this);
        }
        void AddText(Panel div)
        {
            systext tex = new systext();
            tex.Text = texts;
            div.Controls.Add(tex);
        }
   
    }
     class sysTable : Table
    {
         private string getonclick;
        private string getclassstr;
        private string getstylestr;
        private string gettexts;
         public string onclickstr
        {
            get { return getonclick; }
            set { getonclick = value; }
        }
        public string classstr
        {
            get { return getclassstr; }
            set { getclassstr = value; }
        }
        public string stylestr
        {
            get { return getstylestr; }
            set { getstylestr = value; }
        }
        public string texts
        {
            get { return gettexts; }
            set { gettexts = value; }
        }
         private string getAlignstr = "";
         public string Alignstr
         {
             get { return getAlignstr; }
             set { getAlignstr = value; }
         }
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, onclickstr);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, getclassstr);
            writer.AddStyleAttribute("", stylestr);
            writer.AddAttribute(HtmlTextWriterAttribute.Align, Alignstr);
        
        }
        //protected override void RenderContents(HtmlTextWriter writer)
        //{

        //}
    }
    class sysTabcel : TableCell
    {
        public sysTabcel()
        {
       
        }
        private string getonclick;
        private string getclassstr;
        private string getstylestr;
        public string onclickstr
        {
            get { return getonclick; }
            set { getonclick = value; }
        }
        public string classstr
        {
            get { return getclassstr; }
            set { getclassstr = value; }
        }
        public string stylestr
        {
            get { return getstylestr; }
            set { getstylestr = value; }
        }
        private string getAlignstr = "";
        public string Alignstr
        {
            get { return getAlignstr; }
            set { getAlignstr = value; }
        }
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, onclickstr);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, getclassstr);
            writer.AddStyleAttribute("", stylestr);
            writer.AddAttribute(HtmlTextWriterAttribute.Align, Alignstr);

        }
    
    }
    class sysTabRow : TableRow
    {
        public sysTabRow()
        {
       
        }
        private string getonclick;
        private string getclassstr;
        private string getstylestr;
        public string onclickstr
        {
            get { return getonclick; }
            set { getonclick = value; }
        }
        public string classstr
        {
            get { return getclassstr; }
            set { getclassstr = value; }
        }
        public string stylestr
        {
            get { return getstylestr; }
            set { getstylestr = value; }
        }
        private string getAlignstr = "";
        public string Alignstr
        {
            get { return getAlignstr; }
            set { getAlignstr = value; }
        }
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, onclickstr);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, getclassstr);
            writer.AddStyleAttribute("", stylestr);
            writer.AddAttribute(HtmlTextWriterAttribute.Align, Alignstr);

        }
     
    }
    class syslable : Label
    {
        public syslable() { }
        private string getonclick;
        private string getclassstr;
        private string getstylestr;
        private string gettexts="";
        public string onclickstr
        {
            get { return getonclick; }
            set { getonclick = value; }
        }
        public string classstr
        {
            get { return getclassstr; }
            set { getclassstr = value; }
        }
        public string stylestr
        {
            get { return getstylestr; }
            set { getstylestr = value; }
        }
        public string texts
        {
            get { return gettexts; }
            set { gettexts = value; }
        }
        private string getAlignstr = "";
        public string Alignstr
        {
            get { return getAlignstr; }
            set { getAlignstr = value; }
        }
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Onclick, onclickstr);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, getclassstr);
            writer.AddStyleAttribute("", stylestr);
            writer.AddAttribute(HtmlTextWriterAttribute.Align, Alignstr);
            AddText(this);
        }
        void AddText(Label la)
        {
            systext tex = new systext();
            tex.Text = texts;
            la.Controls.Add(tex);
        }
    }
   class systext : System.Web.UI.Control
    {
       public systext()
        {
       
        }
        string gettext="";
        public string Text
        {

            get
            {

 

                return gettext;

            }

            set
            {

                this.gettext= value;

            }

        }

        protected override void Render(HtmlTextWriter writer)
        {
            writer.Write(Text);

        }

    }
     #endregion


}

235168650

Android新特性-ToolBar小结

Toolbar创建:
  • weiwozhiyi
  • weiwozhiyi
  • 2016年06月29日 01:17
  • 1472

[绍棠] IQKeyboardManager的使用

IQKeyboardManager的使用非常简单,只需要在项目使用到的地方之前给IQKeyboardManager的单例设置一些属性就能轻松实现。下面来介绍一下这些属性: 建议在AppDelegat...
  • happyshaotang2
  • happyshaotang2
  • 2017年09月08日 12:22
  • 172

BaseActivity 和 ToolBar 的完美结合

在项目中,很多页面拥有类似的标题,我们只需要改变一些文字和样式就可以做到重用,所以一般的情况都是 写一个标题的布局,然后每个页面都去使用 自定义view,然后写到你的activity的布局文件里面去使...
  • sinstar1
  • sinstar1
  • 2017年03月10日 15:59
  • 658

Android 最新控件 Toolbar

之前Android的ActionBar好像做项目从没用过,除了google自己,并没有多少人用,究其原因,主要是因为ActionBar不够灵活,不能够随心所欲的定制,后来Goole也发现了这一点,然后...
  • qq997843911
  • qq997843911
  • 2015年07月21日 10:28
  • 1111

获取Toolbar中title的TextView

观察微信打开或关闭页面时,titlebar中的text是渐变的,心想丫的藏这么深,我得学来~ 然后。。尼玛。。 Api中根本没提供类似getTitleTextView的方法,搞了半天反射,莫名其妙也获...
  • noiary
  • noiary
  • 2015年08月12日 19:27
  • 932

easyui datagrid的toolbar如何添加输入框或自定义控件

$(function () {  var lastIndex;             $('#tt').datagrid({                 toolbar: [{         ...
  • lybwwp
  • lybwwp
  • 2013年06月05日 09:06
  • 23837

Android官方说明--返回键和toolbar向上按钮的区别

使用返回和向上导航 实现有效导航 一致的导航操作是整体用户体验的重要组成部分。如果基本的导航方法都不能保持一致,甚至让用户意想不到的话,恐怕没有比这更让人沮丧的事情了。 Andro...
  • Card361401376
  • Card361401376
  • 2016年04月01日 19:59
  • 4673

【踩坑】如何获得Toolbar上原生的返回按钮

0 获得返回按钮的图标出于一个很蠢的原因需要这个返回按钮的图标。 起初,想法是获取这个图标的Drawable对象或者Bitmap对象,把它存到手机SD卡中,取出来。1 尝试一1.1 取得Drawab...
  • R3lish
  • R3lish
  • 2017年01月06日 19:42
  • 1606

Panel上放两个ToolBar两行显示

一个panel只能有一个tbar,有时我们tbar上的内容很多,需要两行显示,但是他又不会自动换行。我们就给一个panel添加两个tbar,这样就能两行显示两个tbar了。方法如下:首先定义一个too...
  • yuanyuan110_l
  • yuanyuan110_l
  • 2010年10月26日 23:00
  • 2636

Toolbar的介绍和使用

1.Toolbar介绍      Toolbar是应用程序中使用的标准工具栏。     Toolbar是应用程序布局中使用的Actionbar的泛华,虽然Actionbar是传统Activity的不透...
  • wangjiang_qianmo
  • wangjiang_qianmo
  • 2016年02月16日 17:57
  • 1996
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:最新写的toolbar
举报原因:
原因补充:

(最多只允许输入30个字)