炫酷的“鼠标光标”
By
o3o_o3o_o3o
at 2021-10-01 • 0人收藏 • 988人看过
这是我很久以前做的程序,其中copy了一点范例程序的部分。今天有闲时间,我把它修改了一下:
import win.ui; /*DSG{{*/ var winform = win.form(text="歌词效果演示";right=339;bottom=141;border="none";exmode="toolwindow";mode="popup") winform.add() /*}}*/ import win.ui.glass; import gdi; import gdip; drawAlphaText =function( strText,fontsize= 35,fontname="Verdana" ){ gdi.layeredBuffer( winform.hwnd, function( hdc,hMemDc,hMemBitmap,width,height ){ var graphics = gdip.graphics(hMemDc) graphics.smoothingMode = 4/*_GdipSmoothingModeAntiAlias*/; var pen = gdip.pen(0xFF222222, 2,2/*_GdipUnitPixel*/ ); var brush = gdip.lineBrush( ::POINTF(10,10), ::POINTF(100,100), 0xFFFFFF00, 0xFF00FFFF) var family = gdip.family( fontname ); var strformat = gdip.stringformat(); strformat.align =1/*_GdipStringAlignmentCenter*/; var rclayout = ::RECTF( , ,width,height); var path = gdip.path( 0/*_GdipFillModeAlternate*/ ); path.addstring(strText, family,1/*_GdipFontStyleBold*/, fontsize, rclayout, strformat); graphics.fillPath( brush, path) graphics.drawPath( pen, path) brush.delete(); pen.delete(); strformat.delete(); family.delete(); path.delete(); graphics.delete(); gdi.updateLayeredWindow( winform.hwnd,hMemDc,::SIZE(width,height) ,gdi.blendFunction(130/*透明度*/) ); } ) } var o = 0; import key.hook; var hook = key.hook(); hook.proc = function(msg,vkcode,scancode,injected,flags,timeStamp,extraInfo){ if( injected ) return; var kn = key.getName( vkcode ); select(msg) { case 0x100/*_WM_KEYDOWN*/ ,0x104/*_WM_SYSKEYDOWN*/{ if(kn == "MEDIA_PLAY_PAUSE"){ winform.close() } } } } winform.onClose = function(hwnd,message,wParam,lParam){ hook.close(); } import mouse; var hwnd = winform.hwnd; winform.transparent(true); drawAlphaText("⚪"/*这里可以替换*/,55/*大小*/ ) var width,height = winform.width,winform.height; winform.show(true) win.ui.glass(winform) while(winform.valid){ var cx,cy = mouse.getPos(); winform.setPos(cx-width/2,cy-height/2+34,,,-1/*_HWND_TOPMOST*/) win.delay(10) } win.loopMessage();
效果:
登录后方可回帖