转自: http://www.lsrxc.com/archives/595.html 异萝松的技术博客
当拖动窗口边框改变窗口大小于,控制窗口的最小宽度、高度或最大宽度、高度。
[code lang=”JS”]
//新增全局结构point
type point from structure
long x
long y
end type
[/code]
[code lang=”JS”]
//新增全局结构minmaxinfo
type minmaxinfo from structure
point ptreserved
point ptmaxsize
point ptmaxposition
point ptmintracksize
point ptmaxtracksize
end type
[/code]
[code lang=”JS”]
//添加全局外部函数
//Global External Functions
subroutine GetMinMaxInfo(ref minmaxinfo d, long s, long l) library "kernel32.dll" alias for "RtlMoveMemory"
subroutine SetMinMaxInfo(long d, minmaxinfo s, long l) library "kernel32.dll" alias for "RtlMoveMemory"
[/code]
[code lang=”JS”]
//添加窗口实例变量
private:
long il_orig_width = 2935//最小窗口宽度
long il_orig_height = 1728//最小窗口高度
[/code]
[code lang=”JS”]
//新增窗口自定义事件ue_minmaxinfo,并选择事件ID为:pbm_getminmaxinfo
//Event ID: pbm_getminmaxinfo
minmaxinfo lstr_minmaxinfo
/* copy the data, pointed by the argument MinMaxInfo, to our lstr_MinMaxInfo structure */
GetMinMaxInfo(lstr_minmaxinfo, minmaxinfo, 40)
/* set the minimal size for our window */
lstr_minmaxinfo.ptmintracksize.x = UnitsToPixels(il_orig_width, XUnitsToPixels!)
lstr_minmaxinfo.ptmintracksize.y = UnitsToPixels(il_orig_height, YUnitsToPixels!)
/* copy the structure back into memory at the same place */
SetMinMaxInfo(minmaxinfo, lstr_minmaxinfo, 40)
/* important, according to the MS API, we must return 0 */
return 0
[/code]