Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
Cute Editor for .NET
»
Re: The Cut effect for custom buttons
Re: The Cut effect for custom buttons
05-24-2010, 3:25 AM
Kenneth
Joined on 02-13-2008
Posts 3,886
Re: The Cut effect for custom buttons
Reply
Quote
Hi jonathanexact,
Please try this example
<%@ Page Language=
"C#"
ValidateRequest=
"false"
%>
<%@ Register TagPrefix=
"CE"
Namespace=
"CuteEditor"
Assembly=
"CuteEditor"
%>
<html>
<head>
</head>
<script runat=
"server"
>
protected
override
void
OnLoad(EventArgs e)
{
CuteEditor.ToolControl tc = Editor1.ToolControls[
"insertcustombutonhere"
];
if
(tc !=
null
)
{
System.Web.UI.WebControls.Image Image1 =
new
System.Web.UI.WebControls.Image();
Image1.ID =
"customIco"
;
Image1.ToolTip =
"Insert today's date"
;
Image1.Style.Value =
"filter:alpha(opacity=70); -moz-opacity:0.7; opacity:0.7;margin:1px; vertical-align:middle;"
;
Image1.ImageUrl =
"~/CuteSoft_Client/CuteEditor/Themes/Office2003/Images/cut.gif"
;
Image1.CssClass =
"CuteEditorButton"
;
SetMouseEvents(Image1);
Image1.Attributes[
"onclick"
] =
"var d = new Date(); CuteEditor_GetEditor(this).ExecCommand('PasteHTML',false,d.toLocaleDateString())"
;
tc.Control.Controls.Add(Image1);
}
base
.OnLoad(e);
}
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>
<body>
<form id=
"Form1"
runat=
"server"
>
<CE:Editor ID=
"Editor1"
runat=
"server"
TemplateItemList=
"insertcustombutonhere"
>
</CE:Editor>
</form>
</body>
</html>
<script>
var editor1=document.getElementById(
"<%= Editor1.ClientID %>"
);
var customIco=document.getElementById(
"Editor1_ctl00_customIco"
);
function changeStyle()
{
var editor1doc = editor1.GetDocument();
var editwin = editor1.GetWindow();
if
(document.selection && document.selection.createRange)
{
if
(editor1doc.selection.createRange().text!=
""
)
{
customIco.style.cssText=
""
;
}
else
{
customIco.style.cssText=
"filter:alpha(opacity=70); -moz-opacity:0.7; opacity:0.7;margin:1px; vertical-align:middle;"
;
}
}
else
if
(window.getSelection)
{
if
(editwin.getSelection()!=
""
)
{
customIco.style.cssText=
""
;
}
else
{
customIco.style.cssText=
"filter:alpha(opacity=70); -moz-opacity:0.7; opacity:0.7;margin:1px; vertical-align:middle;"
;
}
}
}
setInterval(changeStyle ,100)
</script>
Regards,
ken
View Complete Thread