找回密码
 加入
搜索
查看: 2728|回复: 5

[AU3基础] 【已解决】当鼠标移动到字体上时如何放大字体的问题?

  [复制链接]
发表于 2011-3-27 19:44:53 | 显示全部楼层 |阅读模式
本帖最后由 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
发表于 2011-3-27 20:13:04 | 显示全部楼层
#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[0] > $nPos[0]+40 And $mPos[0] < $nPos[0]+40+276 And $mPos[1] > $nPos[1]+88+24 And $mPos[1] < $nPos[1]+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
不知道这样成不成~呵呵
 楼主| 发表于 2011-3-27 20:46:06 | 显示全部楼层
回复 2# 破帽遮颜


   
你真是太捧啦!非常感谢!就是这种效果.
发表于 2011-3-27 20:48:54 | 显示全部楼层
以前论坛有个放大镜的代码 ,简单改一下
#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[0]+20,$mouse[1]+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[0] - 10
                        $t = $xy[1] - 10
                        DllCall("gdi32.dll", "int", "StretchBlt", "int", $MyHDC[0], "int", 0, "int", 0, "int", 100, "int", 100, "int", $DeskHDC[0], "int", $l, "int", $t, "int", 20, "int", 20, "long", $SRCCOPY)
                EndIf
                DllCall("user32.dll", "int", "ReleaseDC", "int", $DeskHDC[0], "hwnd", 0)
        EndIf
        DllCall("user32.dll", "int", "ReleaseDC", "int", $MyHDC[0], "hwnd", $MyhWnd)
EndFunc   ;==>MAG
 楼主| 发表于 2011-3-27 21:16:30 | 显示全部楼层
回复 4# pcbar


   
呵!非常感谢!原来还有这种好东西!
发表于 2011-3-28 15:50:16 | 显示全部楼层
学习了 不错  呵呵
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-23 12:17 , Processed in 0.115219 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表