界面上方下方左方隐藏

try (destroyDialog cytool) Catch ()
global cytool,minicytool
rollout minicytool "test" width:190 height:150
(
 local wa = (GetDialogSize cytool).x
 local ws = (getMAXWindowsize()).x
 --[scr.Width, scr.Height]
 label kk "" width:200 height:200 pos:[2,2]
 fn hidedialog vol = (                --//移动窗口函数
  mp = GetDialogPos cytool
  vpos = case cytool.chkooo of (
   "top": [mp.x,vol]
   "left":[vol,mp.y]
   "right":[vol,mp.y]
  )--end case
  SetDialogPos cytool vpos
 )
 fn fn_MiniRoll width1 height2 Key cPos clr labPos=( --创建小窗口
  createdialog minicytool width1 height2 pos:cPos style:#() bgcolor:clr fgcolor:white
  minicytool.kk.text = Key
  minicytool.kk.pos = labPos
 )
 on  minicytool mousemove pos do(
  --ws = ((getMAXWindowsize()) -(GetDialogSize cytool)).x -2
   case cytool.chkooo of (
    "top": hidedialog 2
    "left": hidedialog 2
    "right": hidedialog (ws-wa-2)
   )--end case
  try destroyDialog minicytool catch()       --//关闭小窗口
 )
)--end rollout
-----------------------------------------------------------------------------------------
rollout cytool "test" width:190 height:150
(
 local chkooo = "hello"
 local tt = 1
 timer clock "testClock" interval:1000            --//计时器 必需的
 button bt_1 "点击隐藏" width: 64 height:22 pos:[60,60]
-----------------------------------------------------------------------------------------
  on cytool moved pos do  
  ( 
   tt = 1
  --max窗宽去掉小窗宽
   ws = (getMAXWindowSize()).x-(GetDialogSize cytool).x
  --//靠近屏幕上端 1像素以内 自动隐藏
   if pos.x >1 and pos.y < 1 then minicytool.hidedialog -2000 --//left hide     
   else if pos.x < 1 and pos.y >10 then minicytool.hidedialog  -2000  --//hide from top
   else if pos.x > ws and pos.y >10 then minicytool.hidedialog 2000  --//hide from top
   else ()
  --//set dialog position as name
   if pos.y < 100 then chkooo = "top"
   else if pos.x <100 and pos.y >100 then chkooo = "left"
   else if pos.x >(ws-100) and pos.y >100 then chkooo = "right"
   else chkooo = ""
  )
  on cytool mousemove pos do
  (
  --//鼠标在窗口上时始终保持tt= 1 防止计时 必需的。。
   tt = 1   
  )
  on clock tick do
  (
   mousePos = mouse.screenpos
   dialogPos = GetDialogPos cytool
   dialogSize = GetDialogSize cytool
   maxSize = (getMAXWindowsize())
   if tt < 4 then (
    --//top
    if chkooo == "top" and mousePos.y > dialogSize.y and dialogPos.y < 8 then ( 
     valUp = tt+1 ;tt = valUp
     if valUp == 2 then (
      minicytool.hidedialog  -2000
      minicytool.fn_MiniRoll 160 14 "I'm Here" [dialogPos.x,0] red [64,2]
     )
    )
    --//left
    else if chkooo == "left" and  mousePos.x > (dialogSize.x+8) and dialogPos.x < 8 then (
     valUp = tt+1 ;tt = valUp
     if valUp == 2 then (
      minicytool.hidedialog -2000
      minicytool.fn_MiniRoll 14 160 "In'nmn nHnenrne" [0,dialogPos.y] green [2,32]
     )
    )
    --//right
    else if chkooo == "right" and mousePos.x < (maxSize.x-dialogSize.x+60) and dialogPos.x > (maxSize.x-dialogSize.x-8) then (
     valUp = tt+1 ;tt = valUp
     if valUp == 2 then (
      minicytool.hidedialog 2000
      minicytool.fn_MiniRoll 14 160 "In'nmn nHnenrne" [(maxSize.x-24),dialogPos.y] blue [2,32]
     )
    )
    else ()
   )
  --print chkooo
  )
-----------------------------------------------------------------------------------------
 
  on cytool close do (
   try destroyDialog minicytool catch()
  )
 
  on bt_1 pressed do
  (
   minicytool.hidedialog  -1000
  )
)--end rollout
createdialog cytool

猜你喜欢

转载自www.cnblogs.com/humd/p/12110049.html