VB.Net intellisense返回表单类,而不是My.Forms.etc

时间:2016-07-19 07:56:05

标签: vb.net forms

很抱歉,如果之前已经询问过这个问题,但我甚至不知道如何在这个问题上进行谷歌描述 - 以上标题不会返回任何内容。

在VB.Net中键入现有的表单名称时,例如frmMainGame,它会将其作为一个类进行选择。该文字变为青色(黑暗主题)并具有.ActiveForm.DefaultFont.DockPaddingEdges.MousePosition等相关选项。

虽然我之前写过的预先存在的frmMainGamefrmMainGame表单中的子控件一致正常。不用说,这些子控件和表格的典型长选项列表也不可用。

这发生在所有子功能中,无论是公共还是私有。这是一个项目范围的事件。

非常感谢任何帮助。

enter image description here 在这张图片中,新写的frmMainGame。导致青色文字。

enter image description here 同时,frmMainGame的预先存在的代码可以完全访问表单及其子控件。 (文本框等,如设计视图中所示)。

同时,类代码本身看起来很好;

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class frmMainGame
Inherits System.Windows.Forms.Form

'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
    Try
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
    Finally
        MyBase.Dispose(disposing)
    End Try
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.  
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
    Me.components = New System.ComponentModel.Container()
    Me.GameTimer = New System.Windows.Forms.Timer(Me.components)
    Me.GameMsgBox = New System.Windows.Forms.RichTextBox()
    Me.GameMsgFilter = New System.Windows.Forms.CheckedListBox()
    Me.PicWorldMap = New System.Windows.Forms.PictureBox()
    Me.mapAreaTitle = New System.Windows.Forms.TextBox()
    Me.lblCrafting = New System.Windows.Forms.Label()
    Me.barHP = New System.Windows.Forms.ProgressBar()
    Me.barMagic = New System.Windows.Forms.ProgressBar()
    Me.barStamina = New System.Windows.Forms.ProgressBar()
    Me.barHunger = New System.Windows.Forms.ProgressBar()
    Me.barThirst = New System.Windows.Forms.ProgressBar()
    Me.barRest = New System.Windows.Forms.ProgressBar()
    Me.picPortrait = New System.Windows.Forms.PictureBox()
    Me.picScene = New System.Windows.Forms.PictureBox()
    Me.picSky = New System.Windows.Forms.PictureBox()
    Me.lblTimeNormal = New System.Windows.Forms.Label()
    Me.lblTimeFast = New System.Windows.Forms.Label()
    Me.lblTimeFaster = New System.Windows.Forms.Label()
    Me.lblTimeDate = New System.Windows.Forms.Label()
    Me.ActionList = New System.Windows.Forms.ListView()
    Me.ColumnHeader2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
    Me.lblCharSheet = New System.Windows.Forms.Label()
    Me.lblCurrentAction = New System.Windows.Forms.Label()
    Me.TM_Walk = New System.Windows.Forms.RadioButton()
    Me.TM_run = New System.Windows.Forms.RadioButton()
    Me.TM_sprint = New System.Windows.Forms.RadioButton()
    Me.lblOptions = New System.Windows.Forms.Label()
    Me.lblSettlementView = New System.Windows.Forms.Label()
    Me.mode_hunt = New System.Windows.Forms.CheckBox()
    Me.mode_forage = New System.Windows.Forms.CheckBox()
    CType(Me.PicWorldMap, System.ComponentModel.ISupportInitialize).BeginInit()
    CType(Me.picPortrait, System.ComponentModel.ISupportInitialize).BeginInit()
    CType(Me.picScene, System.ComponentModel.ISupportInitialize).BeginInit()
    CType(Me.picSky, System.ComponentModel.ISupportInitialize).BeginInit()
    Me.SuspendLayout()
    '
    'GameTimer
    '
    Me.GameTimer.Enabled = True
    Me.GameTimer.Interval = 1000
    '
    'GameMsgBox
    '
    Me.GameMsgBox.Location = New System.Drawing.Point(194, 596)
    Me.GameMsgBox.Name = "GameMsgBox"
    Me.GameMsgBox.ReadOnly = True
    Me.GameMsgBox.Size = New System.Drawing.Size(571, 91)
    Me.GameMsgBox.TabIndex = 0
    Me.GameMsgBox.Text = ""
    '
    'GameMsgFilter
    '
    Me.GameMsgFilter.CheckOnClick = True
    Me.GameMsgFilter.FormattingEnabled = True
    Me.GameMsgFilter.Items.AddRange(New Object() {"General", "Important", "Ambient", "Combat", "New Items"})
    Me.GameMsgFilter.Location = New System.Drawing.Point(771, 598)
    Me.GameMsgFilter.Name = "GameMsgFilter"
    Me.GameMsgFilter.Size = New System.Drawing.Size(128, 89)
    Me.GameMsgFilter.TabIndex = 1
    '
    'PicWorldMap
    '
    Me.PicWorldMap.Location = New System.Drawing.Point(192, 176)
    Me.PicWorldMap.Name = "PicWorldMap"
    Me.PicWorldMap.Size = New System.Drawing.Size(707, 414)
    Me.PicWorldMap.TabIndex = 2
    Me.PicWorldMap.TabStop = False
    '
    'mapAreaTitle
    '
    Me.mapAreaTitle.Location = New System.Drawing.Point(192, 148)
    Me.mapAreaTitle.Name = "mapAreaTitle"
    Me.mapAreaTitle.ReadOnly = True
    Me.mapAreaTitle.Size = New System.Drawing.Size(662, 22)
    Me.mapAreaTitle.TabIndex = 3
    Me.mapAreaTitle.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
    '
    'lblCrafting
    '
    Me.lblCrafting.Location = New System.Drawing.Point(849, 26)
    Me.lblCrafting.Name = "lblCrafting"
    Me.lblCrafting.Size = New System.Drawing.Size(50, 44)
    Me.lblCrafting.TabIndex = 4
    Me.lblCrafting.Text = "[craft]"
    '
    'barHP
    '
    Me.barHP.ForeColor = System.Drawing.Color.Red
    Me.barHP.Location = New System.Drawing.Point(72, 30)
    Me.barHP.Name = "barHP"
    Me.barHP.Size = New System.Drawing.Size(40, 10)
    Me.barHP.Style = System.Windows.Forms.ProgressBarStyle.Continuous
    Me.barHP.TabIndex = 5
    '
    'barMagic
    '
    Me.barMagic.ForeColor = System.Drawing.Color.Fuchsia
    Me.barMagic.Location = New System.Drawing.Point(72, 62)
    Me.barMagic.Name = "barMagic"
    Me.barMagic.Size = New System.Drawing.Size(40, 10)
    Me.barMagic.Style = System.Windows.Forms.ProgressBarStyle.Continuous
    Me.barMagic.TabIndex = 6
    '
    'barStamina
    '
    Me.barStamina.ForeColor = System.Drawing.Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer))
    Me.barStamina.Location = New System.Drawing.Point(72, 46)
    Me.barStamina.Name = "barStamina"
    Me.barStamina.Size = New System.Drawing.Size(40, 10)
    Me.barStamina.Style = System.Windows.Forms.ProgressBarStyle.Continuous
    Me.barStamina.TabIndex = 7
    '
    'barHunger
    '
    Me.barHunger.ForeColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(0, Byte), Integer))
    Me.barHunger.Location = New System.Drawing.Point(127, 29)
    Me.barHunger.Name = "barHunger"
    Me.barHunger.Size = New System.Drawing.Size(49, 10)
    Me.barHunger.Style = System.Windows.Forms.ProgressBarStyle.Continuous
    Me.barHunger.TabIndex = 8
    '
    'barThirst
    '
    Me.barThirst.ForeColor = System.Drawing.Color.FromArgb(CType(CType(128, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer))
    Me.barThirst.Location = New System.Drawing.Point(127, 45)
    Me.barThirst.Name = "barThirst"
    Me.barThirst.Size = New System.Drawing.Size(49, 10)
    Me.barThirst.Style = System.Windows.Forms.ProgressBarStyle.Continuous
    Me.barThirst.TabIndex = 9
    '
    'barRest
    '
    Me.barRest.ForeColor = System.Drawing.Color.Blue
    Me.barRest.Location = New System.Drawing.Point(127, 62)
    Me.barRest.Name = "barRest"
    Me.barRest.Size = New System.Drawing.Size(49, 10)
    Me.barRest.Style = System.Windows.Forms.ProgressBarStyle.Continuous
    Me.barRest.TabIndex = 10
    '
    'picPortrait
    '
    Me.picPortrait.Location = New System.Drawing.Point(12, 26)
    Me.picPortrait.Name = "picPortrait"
    Me.picPortrait.Size = New System.Drawing.Size(50, 50)
    Me.picPortrait.TabIndex = 11
    Me.picPortrait.TabStop = False
    '
    'picScene
    '
    Me.picScene.Location = New System.Drawing.Point(324, 26)
    Me.picScene.Name = "picScene"
    Me.picScene.Size = New System.Drawing.Size(160, 80)
    Me.picScene.TabIndex = 13
    Me.picScene.TabStop = False
    '
    'picSky
    '
    Me.picSky.Location = New System.Drawing.Point(496, 26)
    Me.picSky.Name = "picSky"
    Me.picSky.Size = New System.Drawing.Size(160, 80)
    Me.picSky.TabIndex = 14
    Me.picSky.TabStop = False
    '
    'lblTimeNormal
    '
    Me.lblTimeNormal.Font = New System.Drawing.Font("Franklin Gothic Medium", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.lblTimeNormal.Location = New System.Drawing.Point(591, 108)
    Me.lblTimeNormal.Name = "lblTimeNormal"
    Me.lblTimeNormal.Size = New System.Drawing.Size(19, 19)
    Me.lblTimeNormal.TabIndex = 15
    Me.lblTimeNormal.Text = ">"
    Me.lblTimeNormal.TextAlign = System.Drawing.ContentAlignment.TopCenter
    '
    'lblTimeFast
    '
    Me.lblTimeFast.Font = New System.Drawing.Font("Franklin Gothic Medium", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.lblTimeFast.Location = New System.Drawing.Point(616, 108)
    Me.lblTimeFast.Name = "lblTimeFast"
    Me.lblTimeFast.Size = New System.Drawing.Size(19, 19)
    Me.lblTimeFast.TabIndex = 16
    Me.lblTimeFast.Text = ">>"
    Me.lblTimeFast.TextAlign = System.Drawing.ContentAlignment.TopCenter
    '
    'lblTimeFaster
    '
    Me.lblTimeFaster.Font = New System.Drawing.Font("Franklin Gothic Medium", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.lblTimeFaster.Location = New System.Drawing.Point(641, 108)
    Me.lblTimeFaster.Name = "lblTimeFaster"
    Me.lblTimeFaster.Size = New System.Drawing.Size(19, 19)
    Me.lblTimeFaster.TabIndex = 17
    Me.lblTimeFaster.Text = ">>>"
    Me.lblTimeFaster.TextAlign = System.Drawing.ContentAlignment.TopCenter
    '
    'lblTimeDate
    '
    Me.lblTimeDate.Font = New System.Drawing.Font("Franklin Gothic Medium", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.lblTimeDate.Location = New System.Drawing.Point(319, 108)
    Me.lblTimeDate.Name = "lblTimeDate"
    Me.lblTimeDate.Size = New System.Drawing.Size(267, 19)
    Me.lblTimeDate.TabIndex = 18
    Me.lblTimeDate.Text = ">"
    Me.lblTimeDate.TextAlign = System.Drawing.ContentAlignment.TopCenter
    '
    'ActionList
    '
    Me.ActionList.BackColor = System.Drawing.Color.White
    Me.ActionList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    Me.ActionList.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader2})
    Me.ActionList.FullRowSelect = True
    Me.ActionList.GridLines = True
    Me.ActionList.Location = New System.Drawing.Point(11, 148)
    Me.ActionList.MultiSelect = False
    Me.ActionList.Name = "ActionList"
    Me.ActionList.Size = New System.Drawing.Size(165, 442)
    Me.ActionList.TabIndex = 20
    Me.ActionList.UseCompatibleStateImageBehavior = False
    Me.ActionList.View = System.Windows.Forms.View.Details
    '
    'ColumnHeader2
    '
    Me.ColumnHeader2.Text = "Available Actions"
    Me.ColumnHeader2.Width = 163
    '
    'lblCharSheet
    '
    Me.lblCharSheet.Location = New System.Drawing.Point(793, 26)
    Me.lblCharSheet.Name = "lblCharSheet"
    Me.lblCharSheet.Size = New System.Drawing.Size(50, 44)
    Me.lblCharSheet.TabIndex = 21
    Me.lblCharSheet.Text = "[Char Sheet]"
    '
    'lblCurrentAction
    '
    Me.lblCurrentAction.Font = New System.Drawing.Font("Franklin Gothic Medium", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.lblCurrentAction.Location = New System.Drawing.Point(12, 79)
    Me.lblCurrentAction.Name = "lblCurrentAction"
    Me.lblCurrentAction.Size = New System.Drawing.Size(164, 19)
    Me.lblCurrentAction.TabIndex = 22
    Me.lblCurrentAction.Text = ">"
    Me.lblCurrentAction.TextAlign = System.Drawing.ContentAlignment.TopCenter
    '
    'TM_Walk
    '
    Me.TM_Walk.AutoSize = True
    Me.TM_Walk.Checked = True
    Me.TM_Walk.Font = New System.Drawing.Font("Franklin Gothic Medium", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.TM_Walk.Location = New System.Drawing.Point(11, 596)
    Me.TM_Walk.Name = "TM_Walk"
    Me.TM_Walk.Size = New System.Drawing.Size(49, 19)
    Me.TM_Walk.TabIndex = 23
    Me.TM_Walk.TabStop = True
    Me.TM_Walk.Text = "Walk"
    Me.TM_Walk.UseVisualStyleBackColor = True
    '
    'TM_run
    '
    Me.TM_run.AutoSize = True
    Me.TM_run.Font = New System.Drawing.Font("Franklin Gothic Medium", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.TM_run.Location = New System.Drawing.Point(11, 621)
    Me.TM_run.Name = "TM_run"
    Me.TM_run.Size = New System.Drawing.Size(44, 19)
    Me.TM_run.TabIndex = 24
    Me.TM_run.Text = "Run"
    Me.TM_run.UseVisualStyleBackColor = True
    '
    'TM_sprint
    '
    Me.TM_sprint.AutoSize = True
    Me.TM_sprint.Font = New System.Drawing.Font("Franklin Gothic Medium", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.TM_sprint.Location = New System.Drawing.Point(11, 646)
    Me.TM_sprint.Name = "TM_sprint"
    Me.TM_sprint.Size = New System.Drawing.Size(54, 19)
    Me.TM_sprint.TabIndex = 25
    Me.TM_sprint.Text = "Sprint"
    Me.TM_sprint.UseVisualStyleBackColor = True
    '
    'lblOptions
    '
    Me.lblOptions.Location = New System.Drawing.Point(849, 78)
    Me.lblOptions.Name = "lblOptions"
    Me.lblOptions.Size = New System.Drawing.Size(50, 44)
    Me.lblOptions.TabIndex = 26
    Me.lblOptions.Text = "[options]"
    '
    'lblSettlementView
    '
    Me.lblSettlementView.Location = New System.Drawing.Point(860, 148)
    Me.lblSettlementView.Name = "lblSettlementView"
    Me.lblSettlementView.Size = New System.Drawing.Size(39, 22)
    Me.lblSettlementView.TabIndex = 27
    Me.lblSettlementView.Text = "[SV]"
    Me.lblSettlementView.Visible = False
    '
    'mode_hunt
    '
    Me.mode_hunt.AutoSize = True
    Me.mode_hunt.Font = New System.Drawing.Font("Franklin Gothic Medium", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.mode_hunt.Location = New System.Drawing.Point(192, 19)
    Me.mode_hunt.Name = "mode_hunt"
    Me.mode_hunt.Size = New System.Drawing.Size(79, 19)
    Me.mode_hunt.TabIndex = 28
    Me.mode_hunt.Text = "Hunt Mode"
    Me.mode_hunt.UseVisualStyleBackColor = True
    '
    'mode_forage
    '
    Me.mode_forage.AutoSize = True
    Me.mode_forage.Font = New System.Drawing.Font("Franklin Gothic Medium", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.mode_forage.Location = New System.Drawing.Point(192, 37)
    Me.mode_forage.Name = "mode_forage"
    Me.mode_forage.Size = New System.Drawing.Size(90, 19)
    Me.mode_forage.TabIndex = 29
    Me.mode_forage.Text = "Forage mode"
    Me.mode_forage.UseVisualStyleBackColor = True
    '
    'frmMainGame
    '
    Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 17.0!)
    Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
    Me.BackgroundImage = Global.ProjectKeira.My.Resources.Resources.main_base1
    Me.ClientSize = New System.Drawing.Size(918, 700)
    Me.ControlBox = False
    Me.Controls.Add(Me.mode_forage)
    Me.Controls.Add(Me.mode_hunt)
    Me.Controls.Add(Me.lblSettlementView)
    Me.Controls.Add(Me.lblOptions)
    Me.Controls.Add(Me.TM_sprint)
    Me.Controls.Add(Me.TM_run)
    Me.Controls.Add(Me.TM_Walk)
    Me.Controls.Add(Me.lblCurrentAction)
    Me.Controls.Add(Me.lblCharSheet)
    Me.Controls.Add(Me.ActionList)
    Me.Controls.Add(Me.lblTimeDate)
    Me.Controls.Add(Me.lblTimeFaster)
    Me.Controls.Add(Me.lblTimeFast)
    Me.Controls.Add(Me.lblTimeNormal)
    Me.Controls.Add(Me.picSky)
    Me.Controls.Add(Me.picScene)
    Me.Controls.Add(Me.picPortrait)
    Me.Controls.Add(Me.barRest)
    Me.Controls.Add(Me.barThirst)
    Me.Controls.Add(Me.barHunger)
    Me.Controls.Add(Me.barStamina)
    Me.Controls.Add(Me.barMagic)
    Me.Controls.Add(Me.barHP)
    Me.Controls.Add(Me.lblCrafting)
    Me.Controls.Add(Me.mapAreaTitle)
    Me.Controls.Add(Me.PicWorldMap)
    Me.Controls.Add(Me.GameMsgFilter)
    Me.Controls.Add(Me.GameMsgBox)
    Me.DoubleBuffered = True
    Me.Font = New System.Drawing.Font("Franklin Gothic Medium", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
    Me.Name = "frmMainGame"
    Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
    Me.Text = "MainGame"
    CType(Me.PicWorldMap, System.ComponentModel.ISupportInitialize).EndInit()
    CType(Me.picPortrait, System.ComponentModel.ISupportInitialize).EndInit()
    CType(Me.picScene, System.ComponentModel.ISupportInitialize).EndInit()
    CType(Me.picSky, System.ComponentModel.ISupportInitialize).EndInit()
    Me.ResumeLayout(False)
    Me.PerformLayout()

End Sub

Friend WithEvents GameTimer As Timer
Friend WithEvents GameMsgBox As RichTextBox
Friend WithEvents GameMsgFilter As CheckedListBox
Friend WithEvents PicWorldMap As PictureBox
Friend WithEvents mapAreaTitle As TextBox
Friend WithEvents lblCrafting As Label
Friend WithEvents barHP As ProgressBar
Friend WithEvents barMagic As ProgressBar
Friend WithEvents barStamina As ProgressBar
Friend WithEvents barHunger As ProgressBar
Friend WithEvents barThirst As ProgressBar
Friend WithEvents barRest As ProgressBar
Friend WithEvents picPortrait As PictureBox
Friend WithEvents picScene As PictureBox
Friend WithEvents picSky As PictureBox
Friend WithEvents lblTimeNormal As Label
Friend WithEvents lblTimeFast As Label
Friend WithEvents lblTimeFaster As Label
Friend WithEvents lblTimeDate As Label
Friend WithEvents ActionList As ListView
Friend WithEvents ColumnHeader2 As ColumnHeader
Friend WithEvents lblCharSheet As Label
Friend WithEvents lblCurrentAction As Label
Friend WithEvents TM_Walk As RadioButton
Friend WithEvents TM_run As RadioButton
Friend WithEvents TM_sprint As RadioButton
Friend WithEvents lblOptions As Label
Friend WithEvents lblSettlementView As Label
Friend WithEvents mode_hunt As CheckBox
Friend WithEvents mode_forage As CheckBox
End Class

1 个答案:

答案 0 :(得分:2)

听起来您正在尝试使用表单的默认实例 如果是这样,那么该行为是Visual Studio中的一个错误,可能会得到修复 根据{{​​3}}他们从更新1开始就知道它,但在更新3之后它仍然存在。

同时,您可以创建表单实例并使用

Dim f as new frmMainGame
f.something()

或者如果您需要默认实例,可以使用

访问它
My.Forms.frmMainGame.something()