WinForm特效:桌面上的遮罩层

WinForm特效:桌面上的遮罩层,第1张

一个窗体特效 帮你旁肢了解几个windows api函数 效果 windows桌面上增加一个简单的遮罩层 其中WS_EX_TRANSPARENT 比较重要 它实现了鼠标穿透的功能

using System        using System Drawing        using System Windows Forms        using System Runtime InteropServices        namespace WindowsApplication         {            public partial class Form : Form            {                public Form ()                {            手启团        InitializeComponent()                }                [DllImport( user dll EntryPoint = GetWindowLong )]                public static extern long GetWindowLong(IntPtr hwnd int nIndex)                [DllImport( user dll EntryPoint = SetWindowLong )]                public static extern long SetWindowLong(IntPtr hwnd int nIndex long dwNewLong)                [DllImport( user EntryPoint = SetLayeredWindowAttributes )]                private static extern int SetLayeredWindowAttributes(IntPtr Handle int crKey byte bAlpha int dwFlags)        毕橘        const int GWL_EXSTYLE =                 const int WS_EX_TRANSPARENT = x                 const int WS_EX_LAYERED = x                 const int LWA_ALPHA =                 private void Form _Load(object sender EventArgs e)                {                    this BackColor = Color Silver                    this TopMost = true                    this FormBorderStyle = FormBorderStyle None                    this WindowState = FormWindowState Maximized                    SetWindowLong(Handle GWL_EXSTYLE GetWindowLong(Handle GWL_EXSTYLE) | WS_EX_TRANSPARENT | WS_EX_LAYERED)                    SetLayeredWindowAttributes(Handle LWA_ALPHA )                }            }        }

lishixinzhi/Article/program/net/201311/11485

<form name='pay'棚晌返 id="pay" action="地址" target="_blank">假设你的form 是这样的

给支链饥付按钮写一个方法,比如说

function submit(){

$('#pay').submit()

//控制d出层代码,你的d出层自己定谨握义就好了

}

jsp中实现loading效果,带遮罩层的实现方法如下:

var MaskUtil = (function(){

  var $mask,$maskMsg

  var defMsg = '正在处理,请稍待。。。'

  function init(){

      if(!$mask){

          $mask = $("<div class=\"datagrid-mask mymask\"></div>").appendTo("body")

      }

      if(!$maskMsg){

          $maskMsg = $("<div class=\"datagrid-mask-msg mymask\">"+defMsg+"</div>")

              .appendTo("body").css({'font-size':'12px'})

      }

     

      $mask.css({width:"100%",height:$(document).height()})

   岁清  

      $maskMsg.css({

          left:($(document.body).outerWidth(true) - 190) / 2,top:($(window).height() - 45) / 2,

      })

             

  }

  return {

      mask:function(msg){

          init()

          $mask.show()

          $maskMsg.html(msg||defMsg).show()

     乎毕前 }

      ,unmask:function(){

          $mask.hide()

          $maskMsg.hide()

      }

  }

}())

需要用到的数圆css样式:

.datagrid-mask-msg {

position: absolute

top: 50%

margin-top: -20px

padding: 12px 5px 10px 30px

width: auto

height: 16px

border-width: 2px

border-style: solid

display: none

}

实现的效果:


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/12524553.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2025-08-26
下一篇2025-08-26

发表评论

登录后才能评论

评论列表(0条)

    保存