“新”:太多的争论

时间:2012-11-27 06:06:26

标签: vb.net forms overrides

我制作了一个“自定义”表格,如下所示。当我说:

Dim nSplash As New frmSplash(nBitmap)

它告诉我“ Public Sub New 的参数太多了。”

我不明白为什么会嘲笑它。

Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.Runtime.InteropServices
Imports System.Windows.Forms

Namespace AlphaWindow

Public Class frmSplash

    Inherits Form

    Public Sub New(ByRef uBitmap As Bitmap)

        Me.Size = uBitmap.Size
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen

        APIHelp.ShowTopmost(Me)

        Me.SelectBitmap(uBitmap)

    End Sub

 (...)

' Class to assist with Win32 API calls
Class APIHelp

    Private Const SW_SHOWNOACTIVATE As Integer = 4
    Private Const HWND_TOPMOST As Integer = -1

 (...)

End Class
End Namespace

1 个答案:

答案 0 :(得分:3)

问题不在于命名空间,但是当包含命名空间时,表单必须由“Namespace.Form”而不是“Form”调用。