zoukankan      html  css  js  c++  java
  • 可定制的IE鼠标右键菜单

    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using System.Drawing;

    [assembly:TagPrefix("MyWebMenu","zbjg")]
    namespace MyTools
    {
        /// <summary>
        /// Summary description for MyWebMenu.
        /// </summary>
        public class MyWebMenu : System.Web.UI.WebControls.Panel
        {
            public MyWebMenu()
            {
                this.BorderStyle = BorderStyle.Outset;
                this.BackColor = Color.Silver;
                this.BorderWidth= new Unit(2);
            }

            protected override void Render(HtmlTextWriter writer)
            {
                base.Render (writer);
                writer.RenderBeginTag(HtmlTextWriterTag.Script);
                writer.WriteLine("<!--");
                writer.WriteLine("   document.getElementById('" + this.ClientID + "').style.position = 'absolute';");
                writer.WriteLine("   document.getElementById('" + this.ClientID + "').style.display = 'none';");
                writer.WriteLine("   function Hide_MyMenu() {");
                writer.WriteLine("      var tempDiv = document.getElementById('" + this.ClientID + "');");
                writer.WriteLine("      if(tempDiv.offsetLeft > window.event.clientX + 25) {");
                writer.WriteLine("         tempDiv.style.display = 'none'; }");
                writer.WriteLine("      if(tempDiv.offsetLeft + tempDiv.offsetWidth < window.event.clientY - 25) {");
                writer.WriteLine("         tempDiv.style.display = 'none'; }");
                writer.WriteLine("      if(tempDiv.offsetTop > window.event.clientY + 25) {");
                writer.WriteLine("         tempDiv.style.display = 'none'; }");
                writer.WriteLine("      if(tempDiv.offsetTop + tempDiv.offsetHeight < window.event.clientY - 25) {");
                writer.WriteLine("         tempDiv.style.display = 'none'; }");
                writer.WriteLine("   }");
                writer.WriteLine("");

                writer.WriteLine("   function Show_MyMenu() {");
                writer.WriteLine("      var tempDiv = document.getElementById('" + this.ClientID + "');");
                writer.WriteLine("      tempDiv.style.left = window.event.clientX ;");
                writer.WriteLine("      tempDiv.style.top = window.event.clientY ;");
                writer.WriteLine("      tempDiv.style.display = '' ;");
                writer.WriteLine("      return false; }");
                writer.WriteLine("");
                writer.WriteLine("   document.oncontextmenu = Show_MyMenu;");
                writer.WriteLine("   document.onmousemove = Hide_MyMenu;");
                writer.WriteLine("//-->");
                writer.RenderEndTag();
            }

        }
    }
  • 相关阅读:
    OpenSSL使用1(用OpenSSL生成自签名证书在IIS上搭建Https站点)(用于iOS的https访问)
    dotnet调用node.js写的socket服务(websocket/socket/socket.io)
    Jenkins中deploy插件的deploy war/ear to a container与deploy artifacts to maven reepository区别
    Mac下启动MySQL出现错误“the /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql' user”解决
    Mac下配置node.js环境(Mac 10.12)
    brew udpate出现错误“/usr/local is not writable.”的问题解决
    Linux快速查看某条命令的版本和存放的位置(ls -l `which mvn`)
    Mac下node.js卸载方法收集
    Mac下安装包管理平台Homebrew(Mac 10.12)
    Java出现“Error configuring application listener of class...”类似的错误解决
  • 原文地址:https://www.cnblogs.com/zhuor/p/282817.html
Copyright © 2011-2022 走看看