-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
550 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
import fonts.fontAwesome; | ||
import win.ui; | ||
/*DSG{{*/ | ||
var winform = win.form(text="截图";right=199;bottom=99;border="none";) | ||
winform.add( | ||
plusPreview={cls="plus";left=2;top=32;right=198;bottom=98;clipBk=false;db=1;dl=1;dr=1;dt=1;foreRepeat="scale";notify=1;repeat="scale";z=1;}; | ||
保存={cls="plus";text="保存";left=175;top=5;right=225;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=5;}; | ||
反色={cls="plus";text="反色";left=64;top=5;right=113;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=3;}; | ||
复制={cls="plus";text="复制";left=119;top=5;right=169;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=4;}; | ||
截图={cls="plus";text="截图";left=7;top=5;right=57;bottom=27;bgcolor=-5197169;dl=1;dt=1;font=LOGFONT(h=-16);notify=1;z=2;}; | ||
|
||
) | ||
/*}}*/ | ||
|
||
import fsys.dlg; | ||
import soImage; | ||
|
||
winform.截图.skin({ | ||
background={ | ||
default=0x668FB2B0; | ||
disabled=0xFFCCCCCC; | ||
hover=0xFF928BB3 | ||
}; | ||
color={ | ||
default=0xFF000000; | ||
disabled=0xFF6D6D6D | ||
} | ||
}) | ||
|
||
winform.反色.skin({ | ||
background={ | ||
default=0x668FB2B0; | ||
disabled=0xFFCCCCCC; | ||
hover=0xFF928BB3 | ||
}; | ||
color={ | ||
default=0xFF000000; | ||
disabled=0xFF6D6D6D | ||
} | ||
}) | ||
|
||
winform.复制.skin({ | ||
background={ | ||
default=0x668FB2B0; | ||
disabled=0xFFCCCCCC; | ||
hover=0xFF928BB3 | ||
}; | ||
color={ | ||
default=0xFF000000; | ||
disabled=0xFF6D6D6D | ||
} | ||
}) | ||
|
||
winform.保存.skin({ | ||
background={ | ||
default=0x668FB2B0; | ||
disabled=0xFFCCCCCC; | ||
hover=0xFF928BB3 | ||
}; | ||
color={ | ||
default=0xFF000000; | ||
disabled=0xFF6D6D6D | ||
} | ||
}) | ||
|
||
winform.caller = null; | ||
|
||
import win.region.hole; | ||
var watchWin = win.region.hole(winform.plusPreview); | ||
|
||
var imgCaptured = soImage(); | ||
|
||
import win.ui.simpleWindow3; | ||
win.ui.simpleWindow(winform,,,,).skin( | ||
background = { | ||
hover = 0xff99ffcc; | ||
active = 0xffff6666; | ||
default = 0x00000000; | ||
} | ||
color = { | ||
hover = 0xff666666; | ||
active = 0xffffffff; | ||
default = 0xFF7BA5BF; | ||
} | ||
) | ||
|
||
winform.uiShow = function(){ | ||
winform.disableDragFullWindow = true; | ||
winform.截图.text = "重截"; | ||
winform.反色.show(true); | ||
winform.复制.show(true); | ||
winform.保存.show(true); | ||
watchWin.enable(false); | ||
if(winform.width<400){ | ||
winform.width = 400; | ||
} | ||
} | ||
winform.uiHide = function(){ | ||
winform.disableDragFullWindow = false; | ||
winform.截图.text = "截图"; | ||
winform.反色.show(false); | ||
winform.复制.show(false); | ||
winform.保存.show(false); | ||
watchWin.enable(true); | ||
var old = winform.plusPreview.setForeground(null); | ||
if(old){ old.dispose(); } | ||
} | ||
|
||
winform.uiHide(); | ||
|
||
winform.watchWinEn = true; | ||
winform.截图.oncommand = function(id,event){ | ||
if(winform.watchWinEn){ | ||
winform.getHoleBmp(); | ||
winform.uiShow(); | ||
} | ||
else { | ||
winform.uiHide(); | ||
} | ||
winform.watchWinEn = !winform.watchWinEn; | ||
} | ||
|
||
winform.getHoleBmp = function(){ | ||
var x,y,cx,cy = win.getPos(winform.plusPreview.hwnd,true); | ||
imgCaptured.capture(,x,y,cx,cy,pointerSize); | ||
winform.plusPreview.foreground = imgCaptured.getBytes("*.bmp"); | ||
} | ||
|
||
winform.复制.oncommand = function(id,event){ | ||
imgCaptured.toClipBD(); | ||
if(winform.caller){ | ||
win.setForeground(winform.caller.hwnd); | ||
winform.caller.图片预览.foreground = imgCaptured.getBytes("*.bmp"); | ||
winform.caller.show(); | ||
winform.close(); | ||
} | ||
} | ||
|
||
winform.保存.oncommand = function(id,event){ | ||
var savePath = fsys.dlg.saveOp("图像文件|*.bmp;*.png;*.jpg","保存图像",,,"temp.png"); | ||
if(savePath){ | ||
imgCaptured.save(savePath); | ||
} | ||
} | ||
|
||
winform.反色.oncommand = function(id,event){ | ||
imgCaptured.negative(); | ||
winform.plusPreview.foreground = imgCaptured.getBytes("*.bmp"); | ||
} | ||
|
||
winform.wndproc = function(hwnd,message,wParam,lParam){ | ||
select( message ) { | ||
case 5/*_WM_SIZE*/{ | ||
winform.redrawBackground(); | ||
} | ||
else{ | ||
} | ||
} | ||
//无返回值则继续调用默认回调函数 | ||
} | ||
|
||
winform.plusPreview.wndproc = function(hwnd,message,wParam,lParam){ | ||
select( message ) { | ||
case 0x201/*_WM_LBUTTONDOWN*/ { | ||
winform.hitCaption(); | ||
} | ||
else{ | ||
} | ||
} | ||
//无返回值则继续调用默认回调函数 | ||
} | ||
|
||
winform.onClose = function(hwnd,message,wParam,lParam){ | ||
if(winform.caller){ | ||
win.setForeground(winform.caller.hwnd); | ||
winform.caller.图片预览.foreground = imgCaptured.getBytes("*.bmp"); | ||
winform.caller.show(); | ||
}; | ||
imgCaptured.delete(); | ||
} | ||
|
||
winform.width = 400; | ||
winform.height = 400; | ||
win.setTopmost(winform.hwnd,true) | ||
winform.show(); | ||
|
||
winform.doTop = function(){ | ||
win.setTopmost(winform.hwnd,true); | ||
} | ||
|
||
winform.undoTop = function(){ | ||
win.setTopmost(winform.hwnd,false); | ||
} | ||
|
||
win.loopMessage(); |
Oops, something went wrong.