创建“卡住的窗口”应用程序

时间:2015-09-15 17:42:49

标签: vb.net winforms

我正在创建一个卡住的Windows 应用程序(如TeamViewer 10),应该如下所示:

enter image description here

但我有两个问题:

  • 首先,如果我在加载Form2期间使用以下代码显示Form1,则首先显示Form2,然后显示第一个表单。

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Form2.Show()
    End Sub
    

所以我就是这样,但这不是我想要的......

enter image description here

...但我找到了一个解决方案:我将Form2设置为启动表单,然后在加载Form1期间显示Form2有更简单的方式或更合乎逻辑的方法吗?

  • 其次,如何在加载2个表单时关注我的Form1(主表单)?目前,我已经使用了这段代码(它有效,但它是一个这样做有点奇怪......):

    Private Sub MainFormFocus_Tick(sender As Object, e As EventArgs) Handles MainFormFocus.Tick
        Form1.Focus()
        MainFormFocus.Stop()
    End Sub
    

MainFormFocus对象为TimerEnabled属性设置为TrueInterval设置为1。

上面的所有代码都有效,但有点棘手......这就是为什么我想以不同的方式做到这一点。

1 个答案:

答案 0 :(得分:0)

感谢 Chris Dunaway ,解决了我的问题:

Traceback (most recent call last):
  File "C:\Users\ssamant\Desktop\Testing\get_all_links.py", line 32, in <module>
    with open (csvfile,'ab') as export:
TypeError: coercing to Unicode: need string or buffer, file found

上面的代码位于我的Protected Overrides Sub OnShown(e As EventArgs) MyBase.OnShown(e) Me.Location = New Point((My.Computer.Screen.WorkingArea.Width - (Me.Width + 5 + Form2.Width)) \ 2, Me.Location.Y) Form2.Show() Form2.Location = New Point(Me.Location.X + Me.Width + 5, Me.Location.Y) Me.Focus() End Sub 中,并重置为启动表单。

相关问题