您的足迹:首页 > 我的代码 >winform做的mask遮罩,可拖拽改变大小

winform做的mask遮罩,可拖拽改变大小


import win.ui;
import win.cur;
/*DSG{{*/
var winform = win.form(text="aardio form";right=663;bottom=447;border="none";exmode="none")
winform.add(
S1={cls="static";left=0;top=0;right=24;bottom=24;bgcolor=8388736;dl=1;dt=1;notify=1;transparent=1;z=2};
S2={cls="static";left=640;top=0;right=664;bottom=24;bgcolor=8388736;dr=1;dt=1;notify=1;transparent=1;z=3};
S3={cls="static";left=0;top=424;right=24;bottom=448;bgcolor=8388736;db=1;dl=1;notify=1;transparent=1;z=4};
S4={cls="static";text="FDSFDSFDSF";left=640;top=424;right=664;bottom=448;bgcolor=8388736;db=1;dr=1;notify=1;transparent=1;z=5};
SS={cls="plus";left=0;top=0;right=664;bottom=448;background="C:\Users\Administrator\Desktop\mask.png";bkBottom=11;bkLeft=11;bkRight=11;bkTop=11;db=1;dl=1;dr=1;dt=1;notify=1;z=1}
)
/*}}*/

/**
0x7F88/*_IDC_NO*/
0x7F86/*_IDC_SIZEALL*/
0x7F84/*_IDC_SIZEWE*/
0x7F82/*_IDC_SIZENWSE*/;
0x7F83/*_IDC_SIZENESW*/
0x7F85/*_IDC_SIZENS*/
0x7F80/*_IDC_SIZE*/
0x7F04/*_IDC_UPARROW*/
0x7F02/*_IDC_WAIT*/
0x7F00/*_IDC_ARROW*/
0x7F8A/*_IDC_APPSTARTING*/
0x7F03/*_IDC_CROSS*/
32649/*_IDC_HAND*/
0x7F81/*_IDC_ICON*/
0x7F01/*_IDC_IBEAM*/

**/
curs = {
    0x7F88/*_IDC_NO*/;
    0x7F86/*_IDC_SIZEALL*/;
    0x7F84/*_IDC_SIZEWE*/;
    0x7F82/*_IDC_SIZENWSE*/;
    0x7F83/*_IDC_SIZENESW*/;
    0x7F85/*_IDC_SIZENS*/;
    0x7F80/*_IDC_SIZE*/;
    0x7F04/*_IDC_UPARROW*/;
    0x7F02/*_IDC_WAIT*/;
    0x7F00/*_IDC_ARROW*/;
    0x7F8A/*_IDC_APPSTARTING*/;
    0x7F03/*_IDC_CROSS*/;
    32649/*_IDC_HAND*/;
    0x7F81/*_IDC_ICON*/;
    0x7F01/*_IDC_IBEAM*/;
}
//十字花移动
shi = win.cur.load( 0x7F86/*_IDC_SIZEALL*/ );

winform.S1.oncommand = function(id,event){
    winform.hitTopleft();
}

winform.S2.oncommand = function(id,event){
    winform.hitTopright();
}

winform.S3.oncommand = function(id,event){
    winform.hitBottomleft();
}
winform.S4.oncommand = function(id,event){
    winform.hitBottomright();
}
winform.SS.oncommand = function(id,event){
    //winform.hitCaption();
}

winform.S1.wndproc = function(hwnd,message,wParam,lParam){
    if( message = 0x200/*_WM_MOUSEMOVE*/ ){ winform.SS.disabled = true; }
    if( message = 0x200/*_WM_MOUSEMOVE*/ || message = 0x201/*_WM_LBUTTONDOWN*/ ){ win.cur.setCur( win.cur.load( 0x7F82/*_IDC_SIZENWSE*/ ) ); }

}

winform.S2.wndproc = function(hwnd,message,wParam,lParam){
    if( message = 0x200/*_WM_MOUSEMOVE*/ ){ winform.SS.disabled = true; }
    if( message = 0x200/*_WM_MOUSEMOVE*/ || message = 0x201/*_WM_LBUTTONDOWN*/ ){ win.cur.setCur( win.cur.load( 0x7F83/*_IDC_SIZENESW*/ ) ); }
}

winform.S3.wndproc = function(hwnd,message,wParam,lParam){
    if( message = 0x200/*_WM_MOUSEMOVE*/ ){ winform.SS.disabled = true; }
    if( message = 0x200/*_WM_MOUSEMOVE*/ || message = 0x201/*_WM_LBUTTONDOWN*/ ){ win.cur.setCur( win.cur.load( 0x7F83/*_IDC_SIZENESW*/ ) ); }
}

winform.S4.wndproc = function(hwnd,message,wParam,lParam){
    if( message = 0x200/*_WM_MOUSEMOVE*/ ){ winform.SS.disabled = true; }
    if( message = 0x200/*_WM_MOUSEMOVE*/ || message = 0x201/*_WM_LBUTTONDOWN*/ ){ win.cur.setCur( win.cur.load( 0x7F82/*_IDC_SIZENWSE*/ ) ); }
}

winform.S4.wndproc = function(hwnd,message,wParam,lParam){
    if( message = 0x200/*_WM_MOUSEMOVE*/ ){ winform.SS.disabled = true; }
    if( message = 0x200/*_WM_MOUSEMOVE*/ || message = 0x201/*_WM_LBUTTONDOWN*/ ){ win.cur.setCur( win.cur.load( 0x7F82/*_IDC_SIZENWSE*/ ) ); }
}

import mouse; 

winform.SS.wndproc = function(hwnd,message,wParam,lParam){
    if(message = 0x200/*_WM_MOUSEMOVE*/ ){ 
        win.cur.setCur( shi ); 
    }
    if( message = 0x201/*_WM_LBUTTONDOWN*/ ){
        winform.hitCaption();
    }
}

winform.setInterval(
    10,function(){
        x,y = mouse.getPos();
        x,y = win.toClient( winform.hwnd,x,y);

        c1 = { 24; 24; }
        c2 = { winform.SS.width-24; 24; }
        c3 = { 24; winform.SS.height-24; }
        c4 = { winform.SS.width-24; winform.SS.height-24; }

        if( x < c1[1] && y < c1[2] ||
            x > c2[1] && y < c2[2] ||
            x < c3[1] && y > c3[2] ||
            x > c4[1] && y > c4[2] ){
            winform.SS.disabled = true; 
        }else {
            winform.SS.disabled = false; 
        }
        winform.text = x ++ "_" ++ y ++ "  <->  " ++ winform.SS.width ++ "_" ++ winform.SS.height;
    }
);
winform.transparent(178,);

winform.show();
win.loopMessage();


效果基本上OK。


   这个是窗体背景文件。





本博客所有文章如无特别注明均为原创。作者:恶猫复制或转载请以超链接形式注明转自 恶猫的博客
原文地址《winform做的mask遮罩,可拖拽改变大小

相关推荐

分享本文至:

发表评论

路人甲 表情
看不清楚?点图切换 Ctrl+Enter快速提交

网友评论(0)

恶猫的博客 -记录自己日常,代码,美图,电影,音乐,新闻,只是个人博客而已

浙ICP备15011757号-4 网站地图 联系我