在VB中编程全屏/普通屏幕尺寸按钮 [英] Programming full screen/normal screen size button in VB

查看:225
本文介绍了在VB中编程全屏/普通屏幕尺寸按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个全屏/普通屏幕按钮但逻辑突然开始从全屏循环到正常大小每个按钮点击它在一点工作这里是一个片段:

I am doing a full screen/normal screen button but the logic suddenly started looping from full screen to normal size each button click and it was working at one point here is a snippet:

  If ScreenMode.Text = "Normal Size" Then
        ScreenMode.Text = "Full Size"
        Me.WindowState = FormWindowState.Normal
        Me.Width = 563
        Me.Height = 447
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable
        Me.TopMost = False
    ElseIf Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable Then
        ScreenMode.Text = "Normal Size"
        Me.WindowState = FormWindowState.Maximized
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
        Me.TopMost = True
    End If


推荐答案

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    If Me.WindowState = FormWindowState.Normal Then
        Me.WindowState = FormWindowState.Maximized
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
        Me.TopMost = True
    Else
        Me.WindowState = FormWindowState.Normal
        Me.Width = 563
        Me.Height = 447
        Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable
        Me.TopMost = False
    End If
End Sub

这篇关于在VB中编程全屏/普通屏幕尺寸按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆