Re: Emulating Bold Button Behaviour for H1

  •  08-23-2007, 11:14 AM

    Re: Emulating Bold Button Behaviour for H1

    Richard,
     
    You can create a custom button. When people click it. It calls the following JavaScript function:

    <script runat="server">
     void Page_Load(object sender, System.EventArgs e)
     {
      if(! this.IsPostBack )
      {
       Editor1.Attributes["oncommand"]="return CatchCommand(this);";
      }

      CuteEditor.ToolControl tc = Editor1.ToolControls["insertcustombutonhere"];
      if(tc!=null)
      {    
       System.Web.UI.WebControls.Image Image1 = new System.Web.UI.WebControls.Image ();
       Image1.ToolTip    = "Head 1";
       Image1.ImageUrl    = "tools.gif";
       Image1.CssClass    = "CuteEditorButton";
       SetMouseEvents(Image1);
       Image1.Attributes["onclick"]="var editdoc=CuteEditor_GetEditor(this).GetDocument(); editdoc.execCommand('formatblock', false, "Heading 1");";
       tc.Control.Controls.Add(Image1);
      }
     }
     
     void SetMouseEvents(WebControl control)
     {
      control.Attributes["onmouseover"]="CuteEditor_ButtonCommandOver(this)";
      control.Attributes["onmouseout"]="CuteEditor_ButtonCommandOut(this)";
      control.Attributes["onmousedown"]="CuteEditor_ButtonCommandDown(this)";
      control.Attributes["onmouseup"]="CuteEditor_ButtonCommandUp(this)";
      control.Attributes["ondragstart"]="CuteEditor_CancelEvent()";
     }

    </script>

     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View Complete Thread