以前作ったモジュールでよければアップします。
指定のウィンドウに、サイズ変更領域を自分で描画することが出来ます。
#ifndef SIZEINGAREA_MODULE
#include "user32.as"
#module SIZEINGAREA_MODULE \
m_hwnd , m_fsx_1 , m_fsy_1 , m_fsx_2 , m_fsy_2 , m_hc , m_ssx,m_ssy ,m_flgs , m_rc
#uselib "user32.dll"
#cfunc c_selc "LoadCursorA" nullptr,int
#enum px_1 = 0
#enum py_1
#enum px_2
#enum py_2
#enum RC_ELETOTAL
#modinit int hwnd_ , int fsx_1_ , int fsy_1_ , int fsx_2_ , int fsy_2_
if(hwnd_==0){m_hwnd=hwnd}else{m_hwnd=hwnd_}
m_fsx_1 = fsx_1_ : m_fsy_1 = fsy_1_
m_fsx_2 = fsx_2_ : m_fsy_2 = fsy_2_
dim m_rc,RC_ELETOTAL
return
#modcfunc sizearea_IsIn array rc_ , int mx_ , int my_ ,local flgs_
#define ctype add(%1,%2,%3,%4=rc_) (%4.p%1_%2 %3 m_fs%1_%2)
#define ctype check1(%1,%2=rc_) (%2.p%1_1 < m%1 and add(%1,1,+) > m%1)
#define ctype check2(%1,%2=rc_) (%2.p%1_2 > m%1 and add(%1,2,-) < m%1)
mx = mx_:my = my_
if(inrc( rc_.px_1 , rc_.py_1 , add(x,1,+) , add(y,1,+) )){ flgs_ = 0b1100
}else:if(inrc( add(x,2,-) , rc_.py_1 , rc_.px_2 , add(y,1,+) )){ flgs_ = 0b0110
}else:if(inrc( add(x,2,-) , add(y,2,-) , rc_.px_2 , rc_.py_2 )){ flgs_ = 0b0011
}else:if(inrc( rc_.px_1 , add(y,2,-) , add(x,1,+) , rc_.py_2 )){ flgs_ = 0b1001
}else:if check1(x){ flgs_ = 0b1000
}else:if check2(x) { flgs_ = 0b0010
}else:if check1(y) { flgs_ = 0b0100
}else:if check2(y) { flgs_ = 0b0001 }
return flgs_
#undef add
#undef check1
#undef check2
#modfunc sizearea_SetCursor int mx_ , int my_
#define ctype cmp(%1) ((is&%1)==%1)
is = sizearea_IsIn(thismod,m_rc,mx_,my_)
if(cmp(0b1100)) or (cmp(0b0011)) { SetCursor c_selc($00007F82/*IDC_SIZENWSE*/)
}else:if(cmp(0b0110)) or (cmp(0b1001)){ SetCursor c_selc($00007F83/*IDC_SIZENESW*/)
}else:if(cmp(0b1000)) or (cmp(0b0010)){ SetCursor c_selc($00007F84/*IDC_SIZEWE*/)
}else:if(cmp(0b0100)) or (cmp(0b0001)){ SetCursor c_selc($00007F85/*IDC_SIZENS*/)
}else{SetCursor c_selc($00007F00/*IDC_ARROW*/) }
return
#undef cmp
#modfunc sizearea_ResizeWnd int bool_ , int mx_ , int my_ , local rt_
if(bool_){
if(m_flgs&0b10000)==0{
if(m_flgs==0){
m_flgs = sizearea_IsIn(thismod,m_rc,mx_,my_)
if(m_flgs&0b1000):m_ssx = mx_ - m_rc.px_1
if(m_flgs&0b0100):m_ssy = my_ - m_rc.py_1
if(m_flgs&0b0010):m_ssx = mx_ - m_rc.px_2
if(m_flgs&0b0001):m_ssy = my_ - m_rc.py_2
}
if(m_flgs&0b1111){
if(m_flgs&0b1000):m_rc.px_1 = mx_-m_ssx
if(m_flgs&0b0100):m_rc.py_1 = my_-m_ssy
if(m_flgs&0b0010):m_rc.px_2 = mx_-m_ssx
if(m_flgs&0b0001):m_rc.py_2 = my_-m_ssy
MoveWindow m_hwnd,m_rc.px_1,m_rc.py_1,m_rc.px_2-m_rc.px_1,m_rc.py_2-m_rc.py_1,1
}else{ m_flgs |= 0b10000 }
}
}else{ m_flgs = 0 }
return m_flgs
#modfunc sizearea_updateRect
GetWindowRect m_hwnd,varptr(m_rc):return
#modfunc sizearea_DupRect array rc_
dup rc_ , m_rc:return
#defcfunc local inrc int left_,int top_ , int right_ , int buttom_
return (left_ < mx) and (right_ > mx) and (top_ < my) and (buttom_ > my)
#global
#endif
//---------------------------------------eof
#include "user32.as"
#define fsizex1 5 // 上下左右のサイズ変更領域
#define fsizey1 24
#define fsizex2 5
#define fsizey2 5
#enum WID_MAIN = 0 // 使用するwindowID
#enum WID_RESIZE
#define WM_SIZE $00000005 // ウィンドウメッセージ WM_SIZE
// ウィンドウの初期化
bgscr WID_RESIZE,ginfo_dispx,ginfo_dispy,,,,300,300
newmod sa , SIZEINGAREA_MODULE ,0, fsizex1,fsizey1 , fsizex2 , fsizey2 // サイズエリアの設定
oncmd gosub *oncmd_wm_setcursor , $00000020 /*WM_SETCURSOR*/
oncmd gosub *oncmd_wm_size_move , $00000003 /*WM_MOVE*/
oncmd gosub *oncmd_wm_size_move , WM_SIZE
sizearea_updaterect sa
gosub *drawinterface
*@
stick key, 256
sizearea_ResizeWnd sa , ((key&256)!=0) and (ginfo_act==WID_RESIZE), ginfo_mx, ginfo_my
await 30
goto*@b
*oncmd_wm_size_move
sizearea_updaterect sa
if(iparam==WM_SIZE){gosub *drawinterface}
return
*oncmd_wm_setcursor
sizearea_SetCursor sa,ginfo_mx,ginfo_my
return 0
*drawinterface
redraw 0
color 255:boxf
color:boxf fsizex1,fsizey1,ginfo_winx-fsizex2-1,ginfo_winy-fsizey2-1
redraw
return