Ejemplo n.º 1
0
        /// <summary>
        /// 建立新的工具条按钮
        /// </summary>
        /// <param name="imgSrc">按钮图片源</param>
        /// <param name="commandName">命令名称</param>
        /// <returns>工具条图片按钮对象</returns>
        public ToolbarImageButton CreateImageButton(string resID, string commandName)
        {
            // 获取工具提示字符串
            string toolTipString = ToolTips.TheInstance.GetString(commandName);

            // 建立工具条图片按钮控件
            ToolbarImageButton imageButton = new ToolbarImageButton(MyResources.GetResourcesURL(resID), commandName);

            // 设置提示字符串
            imageButton.Alt = toolTipString;
            // 设置标题提示信息
            imageButton.Attributes.Add("title", toolTipString);

            return(imageButton);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 控件初始化函数
        /// </summary>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            // 字体加粗按钮
            this.m_btnBold = base.CreateImageButton("Bold", "CMD_BOLD");
            // 斜体字按钮
            this.m_btnItalic = base.CreateImageButton("Italic", "CMD_ITALIC");
            // 下划线按钮
            this.m_btnUnderLine = base.CreateImageButton("UnderLine", "CMD_UNDERLINE");

            // 缩进按钮
            this.m_btnIndent = base.CreateImageButton("Indent", "CMD_INDENT");
            // 撤销缩进按钮
            this.m_btnOutdent = base.CreateImageButton("Outdent", "CMD_OUTDENT");

            // 段落左对齐按钮
            this.m_btnJustifyLeft = base.CreateImageButton("JustifyLeft", "CMD_JUSTIFY_LEFT");
            // 段落居中对齐按钮
            this.m_btnJustifyCenter = base.CreateImageButton("JustifyCenter", "CMD_JUSTIFY_CENTER");
            // 段落右对齐按钮
            this.m_btnJustifyRight = base.CreateImageButton("JustifyRight", "CMD_JUSTIFY_RIGHT");

            // 剪切按钮
            this.m_btnCut = base.CreateImageButton("Cut", "CMD_CUT");
            // 复制按钮
            this.m_btnCopy = base.CreateImageButton("Copy", "CMD_COPY");
            // 粘贴按钮
            this.m_btnPaste = base.CreateImageButton("Paste", "CMD_PASTE");
            // 撤销按钮
            this.m_btnUndo = base.CreateImageButton("Undo", "CMD_UNDO");

            // 插入链接按钮
            this.m_btnAnchor = base.CreateImageButton("Anchor", "CMD_ANCHOR");
            // 取消链接按钮
            this.m_btnCancelAnchor = base.CreateImageButton("CancelAnchor", "CMD_CANCEL_ANCHOR");
            // 插入图片按钮
            this.m_btnPicture = base.CreateImageButton("Picture", "CMD_PICTURE");
            // 插入横线按钮
            this.m_btnRule = base.CreateImageButton("Rule", "CMD_RULE");

            // 清除格式按钮
            this.m_btnEraser = base.CreateImageButton("Eraser", "CMD_ERASER");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 控件初始化函数
        /// </summary>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            // 初始化字体名称下拉列表框
            this.m_drpFont = new ToolbarDropDownList("CMD_FONT");
            // 加入首选项
            this.m_drpFont.Items.Add(new ListItem("Font -"));

            // 加入字体名称
            foreach (string fontName in Toolbar1.FONT_NAMES)
            {
                this.m_drpFont.Items.Add(new ListItem(fontName, fontName));
            }

            // 初始化字体按钮
            this.m_btnApplyFont = base.CreateImageButton("Apply_Small", "CMD_FONT");

            // 初始化字体大小下拉列表框
            this.m_drpSize = new ToolbarDropDownList("CMD_SIZE");
            // 加入首选项
            this.m_drpSize.Items.Add(new ListItem("Size -"));

            // 加入字体大小选项
            for (int i = 1; i <= 7; i++)
            {
                this.m_drpSize.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }

            // 初始化字体大小按钮
            this.m_btnApplySize = base.CreateImageButton("Apply_Small", "CMD_SIZE");
            // 背景色按钮
            this.m_btnApplyBackColor = base.CreateImageButton("BackColor", "CMD_BACK_COLOR");
            // 背景色下拉列表框
            this.m_drpBackColor = new ColorDropDownList("BackColor -", "CMD_BACK_COLOR");
            // 前景色按钮
            this.m_btnApplyForeColor = base.CreateImageButton("ForeColor", "CMD_FORE_COLOR");
            // 背景色下拉列表框
            this.m_drpForeColor = new ColorDropDownList("ForeColor -", "CMD_FORE_COLOR");
        }