?? ultragridwindowex.htc
字號:
objContentWindow.style.width = cstr(intX) & "px"
end if
if instr(.orgDirection, "n") <> 0 then
intY = cint(.orgHeight - cliY + .orgY)
intT = cint(.orgTop + cliY - .orgY)
if intY < 60 then
intY = 60
intT = .orgTop + .orgHeight - 60
end if
with element.style
.top = cstr(intT) & "px"
.height = cstr(intY) & "px"
end with
objContentWindow.style.height = cstr(intY - objWindowCaption.offsetHeight - 10) & "px"
end if
end with
else
if window.event.srcElement is element then
if windowState = "NORMAL" then
with objResize
.orgDirection = getResizeDirection()
if .orgDirection = "" then
strCursor = "default"
else
strCursor = .orgDirection & "-resize"
end if
end with
element.style.cursor = strCursor
end if
end if
end if
end function
function coolWindowOnSelect
with window.event
.cancelBubble = true
.returnValue = false
end with
coolWindowOnSelect = false
end function
sub windowOnResize
dim h, w
if menuState then hideMenu
with element
h = .offsetHeight - 6
w = .offsetWidth - 3
end with
if windowState = "MAXIMIZED" then
objCloseButton.style.left = w - objCloseButton.offsetWidth + 1
objMaxButton.style.left = objCloseButton.offsetLeft - objCloseButton.offsetWidth - 2
objMinButton.style.left = objMaxButton.offsetLeft - objMaxButton.offsetWidth
with objContentWindow.style
.width = w
.height = h - objWindowCaption.offsetHeight
end with
end if
end sub
sub captionImageOnMouseDown
element.setActive
with window.event
if objMenu.style.visibility <> "visible" then
if .button = 1 then
showMenu objMenu, .clientX, .clientY
menuState = true
.cancelBubble = true
.returnValue = false
end if
else
menuState = false
end if
end with
end sub
sub captionImageOnMouseUp
if objMenu.style.visibility = "visible" then
if not menuState then hideMenu
end if
end sub
sub captionImageOnDoubleClick
element.style.visibility = "hidden"
end sub
sub captionOnDoubleClick
if windowType <> "NORMAL" then exit sub
internalSettingProperties = true
objWindowState.prevState = windowState
select case windowState
case "MINIMIZED"
windowState = "NORMAL"
case "MAXIMIZED"
windowState = "NORMAL"
case "NORMAL"
windowState = "MAXIMIZED"
end select
setWindowState
internalSettingProperties = false
end sub
sub captionOnMouseDown
if menuState then hideMenu
with window.event
if .button <> 1 then exit sub
objDrag.inAction = true
objDrag.orgX = .clientX - element.style.pixelLeft
objDrag.orgY = .clientY - element.style.pixelTop
.cancelBubble = true
.returnValue = false
end with
element.setCapture
with window.document
.attachEvent "onmouseup", procRefUp
.attachEvent "onmousemove", procRefMove
end with
end sub
sub captionOnMouseUp
objDrag.inAction = false
with window.document
.detachEvent "onmouseup", procRefUp
.detachEvent "onmousemove", procRefMove
end with
element.releaseCapture
end sub
sub captionOnMouseMove
if windowState = "MAXIMIZED" then exit sub
with window.event
if .clientX > 0 and .clientX < element.parentElement.offsetWidth then style.left = .clientX - objDrag.orgX
if .clientY > 0 and .clientY < element.parentElement.offsetHeight then style.top = .clientY - objDrag.orgY
.returnValue = false
.cancelBubble = true
end with
end sub
sub buttonOnMouseDown
dim el
if menuState then hideMenu
with window.event
if .button <> 1 then exit sub
set el = .srcElement
end with
if el.tagName = "IMG" then set el = el.parentElement
showPressed el, el.children(0)
el.setCapture
set objCurrentButton = el
set el = nothing
end sub
sub buttonOnMouseUp
dim el
with window.event
if .button <> 1 then exit sub
set el = .srcElement
end with
if el.tagName = "IMG" then set el = el.parentElement
if el is objCurrentButton then
with el
showRaised el, .children(0)
objWindowState.prevState = windowState
if instr(.id, "btnMin") <> 0 then
internalSettingProperties = true
if windowState = "MINIMIZED" then windowState = "NORMAL" else windowState = "MINIMIZED"
internalSettingProperties = false
setWindowState
elseif instr(.id, "btnMax") <> 0 then
internalSettingProperties = true
if windowState = "MAXIMIZED" then windowState = "NORMAL" else windowState = "MAXIMIZED"
setWindowState
internalSettingProperties = false
elseif instr(.id, "btnClose") <> 0 then
internalSettingProperties = true
windowState = "CLOSED"
setWindowState
internalSettingProperties = false
end if
end with
else
showRaised objCurrentButton, objCurrentButton.children(0)
end if
objCurrentButton.releaseCapture
set objCurrentButton = nothing
set el = nothing
end sub
sub setWindowState
select case windowState
case "CLOSED"
element.style.visibility = "hidden"
if menuState then hideMenu
internalSettingProperties = true
windowState = "NORMAL"
element.style.border = "2px outset window"
internalSettingProperties = false
case "MINIMIZED"
with element.style
if objWindowState.prevState <> "MAXIMIZED" then
objWindowState.orgTop = .top
objWindowState.orgLeft = .left
objWindowState.orgHeight = .height
objWindowState.orgWidth = .width
objWindowState.orgOffsetHeight = OffsetHeight
objWindowState.orgOffsetWidth = OffsetWidth
objWindowState.orgBorder = element.parentElement.style.border
end if
.border = "2px outset window"
.top = parentElement.offsetHeight - (objWindowCaption.offsetheight + 10)
.left = parentElement.offsetLeft
.height = objWindowCaption.offsetheight + 8
.width = 160
end with
with objCloseButton
.style.left = cstr(153 - .offsetWidth) & "px"
end with
with objMaxButton
.children(0).setAttribute "src", imgMaximize
.title = "Maximize"
.style.left = cstr(objCloseButton.offsetLeft - objCloseButton.offsetWidth - 2) & "px"
end with
with objMinButton
.children(0).setAttribute "src", imgRestore
.title = "Restore Window"
.style.left = cstr(objMaxButton.offsetLeft - objMaxButton.offsetWidth) & "px"
end with
case "NORMAL"
with element.style
.border = "2px outset window"
.top = objWindowState.orgTop
.left = objWindowState.orgLeft
.height = objWindowState.orgHeight
.width = objWindowState.orgWidth
element.parentElement.style.border = objWindowState.orgBorder
end with
with objCloseButton
.style.left = cstr(objWindowState.orgOffsetWidth - 8 - .offsetWidth) & "px"
end with
with objMaxButton
.children(0).setAttribute "src", imgMaximize
.title = "Maximize"
.style.left = cstr(objCloseButton.offsetLeft - objCloseButton.offsetWidth - 2) & "px"
end with
with objMinButton
.children(0).setAttribute "src", imgMinimize
.title = "Minimize"
.style.left = cstr(objMaxButton.offsetLeft - objMaxButton.offsetWidth) & "px"
end with
with objContentWindow
.style.width = cstr(objWindowState.orgOffsetWidth - 8) & "px"
.style.height = cstr(objWindowState.orgOffsetHeight - objWindowCaption.offsetHeight - 10) & "px"
end with
case "MAXIMIZED"
with element.style
if objWindowState.prevState <> "MINIMIZED" then
objWindowState.orgTop = .top
objWindowState.orgLeft = .left
objWindowState.orgHeight = .height
objWindowState.orgWidth = .width
objWindowState.orgOffsetHeight = OffsetHeight
objWindowState.orgOffsetWidth = OffsetWidth
objWindowState.orgBorder = element.parentElement.style.border
end if
element.parentElement.style.border = ""
.border = ""
.top = 0
.left = 0
.height = "100%"
.width = "100%"
end with
with objMaxButton
.children(0).setAttribute "src", imgRestore
.title = "Restore Window"
end with
with objMinButton
.children(0).setAttribute "src", imgMinimize
.title = "Minimize"
end with
end select
end sub
sub showRaised(el, elImage)
with el.style
.borderLeft = "1px solid buttonhighlight"
.borderRight = "1px solid threeddarkshadow"
.borderTop = "1px solid buttonhighlight"
.borderBottom = "1px solid threeddarkshadow"
end with
with elImage.style
.borderLeft = ""
.borderRight = "1px solid buttonshadow"
.borderTop = ""
.borderBottom = "1px solid buttonshadow"
end with
end sub
sub showPressed(el, elImage)
with el.style
.borderLeft = "1px solid threeddarkshadow"
.borderRight = "1px solid buttonhighlight"
.borderTop = "1px solid threeddarkshadow"
.borderBottom = "1px solid buttonhighlight"
end with
with elImage.style
.borderLeft = "1px solid buttonshadow"
.borderRight = ""
.borderTop = "1px solid buttonshadow"
.borderBottom = ""
end with
end sub
function getResizeDirection()
dim xPos, yPos, offSet, sResult
offSet = 8
with window.event
xPos = .offsetX
yPos = .offsetY
end with
if yPos < offSet then
sResult = sResult & "n"
elseif yPos > element.offsetHeight - offSet then
sResult = sResult & "s"
end if
if xPos < offSet then
sResult = sResult & "w"
elseif xPos > element.offsetWidth - offSet then
sResult = sResult & "e"
end if
getResizeDirection = sResult
end function
sub showMenu(elMenu, x, y)
dim intRightEdge
dim intBottomEdge
dim intScrollLeft
dim intScrollTop
if not elMenu.menuSized then elMenu.sizeMenu
menuState = true
with parentElement.document.body
intRightEdge = .clientWidth - x
intBottomEdge = .clientHeight - y
intScrollLeft = .scrollLeft + x
intScrollTop = .scrollTop + y
end with
with elMenu
if (intRightEdge < .offsetWidth) then
.style.left = intScrollLeft - .offsetWidth
else
.style.left = intScrollLeft
end if
if (intBottomEdge < .offsetHeight) then
.style.top = intScrollTop - .offsetHeight
else
.style.top = intScrollTop
end if
.style.zIndex = 50
.filters.blendTrans.apply()
.style.visibility = "visible"
.filters.blendTrans.play()
end with
window.document.attachEvent "onmousedown", procRef
on error resume next
set objContentWindow.contentWindow.objCoolWindow = element
if windowType = "NORMAL" then
select case windowState
case "MINIMIZED"
with objMenu
.children(0).enabled = true
.children(3).enabled = false
.children(4).enabled = true
end with
case "NORMAL"
with objMenu
.children(0).enabled = false
.children(3).enabled = true
.children(4).enabled = true
end with
case "MAXIMIZED"
with objMenu
.children(0).enabled = true
.children(3).enabled = true
.children(4).enabled = false
end with
end select
end if
end sub
sub hideMenu
if objContentWindow is nothing or objMenu is nothing then exit sub
window.document.detachEvent "onmousedown", procRef
on error resume next
set objContentWindow.contentWindow.objCoolWindow = nothing
objMenu.style.visibility = "hidden"
menuState = false
end sub
sub coolWindowExPropertyChange
if internalSettingProperties then exit sub
select case ucase(window.event.propertyName)
case "WINDOWSTATE"
setWindowState
case "SRC"
objContentWindow.setAttribute "src", element.src
case "LEFT", "TOP", "WIDTH", "HEIGHT"
dim capWidth, capHeight, capTop, btnWidth, btnHeight, imgHeight, l, t
if objResize.inAction then exit sub
if objDrag.inAction then exit sub
if windowState = "MAXIMIZED" then exit sub
with element
.style.left = left
.style.top = top
.style.width = width
.style.height = height
end with
with objWindowCaption
capWidth = .offsetWidth
capHeight = .offsetHeight
capTop = .offsetTop
end with
with objCloseButton
btnWidth = .offsetWidth
btnHeight = .offsetHeight
end with
with objCaptionImage
imgHeight = objCaptionImage.offsetHeight
t = (capHeight \ 2) - (imgHeight \ 2) + capTop
.style.top = t
end with
t = (capHeight \ 2) - (btnHeight \ 2) + capTop
with objCloseButton
.style.top = t
.style.left = capWidth - btnWidth + 1
l = .offsetLeft - btnWidth - 2
end with
with objMaxButton
.style.top = t
.style.left = l
end with
with objMinButton
.style.top = t
.style.left = l - btnWidth
end with
with objContentWindow
.style.width = capWidth
.style.height = element.offsetHeight - capHeight - 10
end with
end select
end sub
</script>
</PUBLIC:COMPONENT>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -