导航

« height auto float 兼容ie6-ie9QQ 技巧 您需要添加对方为好友,才能给对方发送会话消息 等  »

vb.net 窗体设计常用技巧

虚位以待 VB.NET

这里打算收集vb.net 窗体设计的常用技巧,用的时候不至于每次都从头来过

1.子窗口(体)在父窗口(体)居中

Dim tempRect As New Rectangle(frmM.Left + (frmM.Width - Me.Width) / 2, frmM.Top + (frmM.Height - Me.Height) / 2, 866, 537)

DesktopBounds = tempRect

备注:frmM是父窗口,最后的866,537分别为子窗口的宽度和高度

2.按ESC键退出

    Private Sub form_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
        If e.KeyChar = Chr(27) Then
            Me.Close()
        End If

    End Sub

具体chr对应的数值,查标准ASCII表

3.tooltip用法
        ToolTip1.SetToolTip(控件名, "字符")

4.vb.net 随windows开机启动

        Dim StartupKey As Microsoft.Win32.RegistryKey

        StartupKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
        If chkAutoStart.Checked Then
            StartupKey.SetValue("SiteM", Application.ExecutablePath & " -startup")
        Else
            StartupKey.DeleteValue("SiteM", False)
        End If

  • 顶一下
虚位以待




原创文章如转载,请注明:转载自落日故乡

本文链接地址:http://www.spersky.com/post/363.html

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

内容搜索


虚位以待

常用链接

最新评论及回复

Powered By Z-Blog

Copyright spersky All Rights Reserved.Theme Moonlight,Calf modified.n 浙ICP备16017820号-1