実行結果: http://twitpic.com/dmdz2s
http://codetter.com/?p=1007 のオブジェクト版。
やっていることはこちらのブログとほぼ同じ→ http://d.hatena.ne.jp/setuna-kanata/20090112/1231777971
ちょくとさん作のコールバック関数実装プラグインhscallbk.dllを使用してボタンの描画部分をのっとってます。
ちなみにボタンアニメーション(カーソル載せるとふわりと色が変わるアレ)が機能していないけど
BeginBufferedPaintの代わりにBeginBufferedAnimation使えばいけるっぽい。
実行結果: http://twitpic.com/dmdz2s
http://codetter.com/?p=1007 のオブジェクト版。
やっていることはこちらのブログとほぼ同じ→ http://d.hatena.ne.jp/setuna-kanata/20090112/1231777971
ちょくとさん作のコールバック関数実装プラグインhscallbk.dllを使用してボタンの描画部分をのっとってます。
ちなみにボタンアニメーション(カーソル載せるとふわりと色が変わるアレ)が機能していないけど
BeginBufferedPaintの代わりにBeginBufferedAnimation使えばいけるっぽい。
#include "user32.as"#define GWL_WNDPROC -4#define WM_CREATE 0x1#define WM_DESTROY 0x2#uselib "uxtheme"#cfunc BeginBufferedPaint "BeginBufferedPaint" int,int,int,int,int#func EndBufferedPaint "EndBufferedPaint" int,int#func BufferedPaintSetAlpha "BufferedPaintSetAlpha" int,int,int#func BufferedPaintRenderAnimation "BufferedPaintRenderAnimation" int,int#define BPBF_TOPDOWNDIB 2#uselib "dwmapi"#func DwmExtendFrameIntoClientArea "DwmExtendFrameIntoClientArea" int,int#include "hscallbk.as"#uselib ""#func CallNew "" int,int,int,int;-- いつものscreen 0,580,160r=0,0,80,0DwmExtendFrameIntoClientArea hwnd,varptr(r)cls 4;-- コールバック関数setcallbk ProcNew, CallNew, *lCallNewWindowProcobjx=200objy=50objsize objx,objyobjmode 2,1 : font "meiryo",24,1+16 ;-- みんな大好きメイリオpos 10,10 : button gosub "透けるボタン",*lButton;-- ボタンのサブクラス化pos 310,10 : button gosub "透けないボタン",*lButtonhButton=objinfo(stat,2)GetWindowLong hButton,GWL_WNDPROCdButtonProc=statSetWindowLong hButton,GWL_WNDPROC,varptr(ProcNew)stop*lButtondialog "Push"return*lCallNewWindowProcif callbkarg(0)=hButton{ ;--該当ボタン;-- WM_PAINT以外は通常通りの動作をするCallWindowProc dButtonProc,callbkarg(0),callbkarg(1),callbkarg(2),callbkarg(3)ret=statif callbkarg(1)=0xf{ ;--WM_PAINTr=5,5,objx-5,objy-5 ;-- ボタンの角が円いので少し小さめにしておかないと余計な部分まで不透明になる; ……はずなのだが、HSPのボタンはなぜか下地が見えちゃってるので意味なしpp=16,0,0,0mhdc=0GetWindowDC hButtondcButton=statpb=BeginBufferedPaint(dcButton,varptr(r),BPBF_TOPDOWNDIB,varptr(pp),varptr(mhdc))if pb!0{CallWindowProc dButtonProc,callbkarg(0),callbkarg(1),mhdc,callbkarg(3)ret=statBufferedPaintSetAlpha pb,varptr(r),255EndBufferedPaint pb,1}ReleaseDC hButton,dcButton}}return ret