【已解决】当鼠标移动到字体上时如何放大字体的问题?
本帖最后由 dgnanhua 于 2011-3-27 20:47 编辑如题:当鼠标移动到字体上时如何放大字体的问题?
就是说,当鼠标移动到字体上时看上去有一种动画放大字体的那种效果.表达可能不是很准确请包涵!#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("窗体1", 374, 215, 196, 125)
$Label1 = GUICtrlCreateLabel("当鼠标移动到字体上时如何放大字体", 40, 88, 276, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("窗体1", 374, 215, -1, -1)
$Label1 = GUICtrlCreateLabel("当鼠标移动到字体上时如何放大字体", 40, 88, 276, 24, 0x0200+0x01)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $Font = False
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
$mPos = MouseGetPos()
If @error Then ContinueLoop
$nPos = WinGetPos($Form2)
If @error Then ContinueLoop
If $mPos > $nPos+40 And $mPos < $nPos+40+276 And $mPos > $nPos+88+24 And $mPos < $nPos+88+24*2 Then
ToolTip('放大')
If $Font Then
GUICtrlSetFont($Label1, 13, 800, 0, "MS Sans Serif")
$Font = False
EndIf
Else
ToolTip('正常')
If Not $Font Then
GUICtrlSetFont($Label1, 10, 800, 0, "MS Sans Serif")
$Font = True
EndIf
EndIf
WEnd不知道这样成不成~呵呵 回复 2# 破帽遮颜
你真是太捧啦!非常感谢!就是这种效果. 以前论坛有个放大镜的代码 ,简单改一下#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
;Global $SRCCOPY = 0x00CC0020
Global $leave = 0
SplashTextOn("AU3MAG", "", 100, 100, 100, 0, 1)
$MyhWnd = WinGetHandle("AU3MAG")
;WinSetState($MyhWnd, '', @SW_HIDE)
#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("窗体1", 374, 215, -1, -1)
$Label1 = GUICtrlCreateLabel("当鼠标移动到字体上时如何放大字体", 40, 88, 276, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
WinMove($MyhWnd,'',$mouse+20,$mouse+20)
mag()
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
SplashOff()
Exit
EndSwitch
WEnd
Func MAG()
$MyHDC = DllCall("user32.dll", "int", "GetDC", "hwnd", $MyhWnd)
If @error Then Return
$DeskHDC = DllCall("user32.dll", "int", "GetDC", "hwnd", 0)
If Not @error Then
$xy = MouseGetPos()
If Not @error Then
$l = $xy - 10
$t = $xy - 10
DllCall("gdi32.dll", "int", "StretchBlt", "int", $MyHDC, "int", 0, "int", 0, "int", 100, "int", 100, "int", $DeskHDC, "int", $l, "int", $t, "int", 20, "int", 20, "long", $SRCCOPY)
EndIf
DllCall("user32.dll", "int", "ReleaseDC", "int", $DeskHDC, "hwnd", 0)
EndIf
DllCall("user32.dll", "int", "ReleaseDC", "int", $MyHDC, "hwnd", $MyhWnd)
EndFunc ;==>MAG
回复 4# pcbar
呵!非常感谢!原来还有这种好东西! 学习了 不错呵呵
页:
[1]