| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1164 人关注过本帖
标题:一个很好的鼠标滚轮放大缩小窗体,控件也会改变位置
取消只看楼主 加入收藏
sfp5
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-12-8
收藏
 问题点数:0 回复次数:0 
一个很好的鼠标滚轮放大缩小窗体,控件也会改变位置
Dim s As Long
Dim y As Long

Private Sub combo1_KeyDown(KeyCode As Integer, Shift As Integer)
    Dim w As Long
    w = s * (Width / Height)
   
    If KeyCode = 38 Then
        If Height <= Screen.Height - s And Width <= Screen.Width - w Then
            Height = Height + s
            Width = Width + w
        End If
    ElseIf KeyCode = 40 Then
        If Height > s And Width > w + y Then
            Height = Height - s
            Width = Width - w
        End If
    End If
End Sub


Private Sub Command1_Click()
    End
End Sub

Private Sub Form_Load()
    s = 300
    y = 2000
   
    Picture1.TabStop = False
                                
   
    With Combo1
        .Left = -.Width - 100
    End With
End Sub


Private Sub Form_Resize()
    With Picture1
        .Top = 0
        .Left = 0
        .Width = Width
        .Height = heigth
    End With
   
    With Me
        .Left = (Screen.Width - Width) / 2
        .Top = (Screen.Height - Height) / 2
        Command1.Top = Form1.ScaleHeight - 800
        Command1.Left = Form1.ScaleWidth - 1600
    End With
End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, y As Single)
    Combo1.SetFocus
                    
                    
End Sub

放大缩小窗体.rar (5.61 KB)
搜索更多相关主题的帖子: 鼠标 控件 滚轮 窗体 位置 
2008-09-20 12:30
快速回复:一个很好的鼠标滚轮放大缩小窗体,控件也会改变位置
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016420 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved