Control.ProductName 屬性

定義

取得包含控制項的組件的產品名稱。

public:
 property System::String ^ ProductName { System::String ^ get(); };
[System.ComponentModel.Browsable(false)]
public string ProductName { get; }
[<System.ComponentModel.Browsable(false)>]
member this.ProductName : string
Public ReadOnly Property ProductName As String

屬性值

包含控制項的組件的產品名稱。

屬性

範例

下列程式碼範例會顯示 包含在 中 LabelForm 應用程式的相關資訊。 這個範例需要 CompanyName 設定 和 ProductNameProductVersion

void AboutDialog_Load( Object^ /*sender*/, EventArgs^ /*e*/ )
{
   // Display the application information in the label.
   this->labelVersionInfo->Text = String::Format(  "{0} {1} Version: {2}", this->CompanyName, this->ProductName, this->ProductVersion );
}
private void AboutDialog_Load(object sender, EventArgs e)
{
   // Display the application information in the label.
   this.labelVersionInfo.Text = 
      this.CompanyName + "  " + 
      this.ProductName + "  Version: " +
      this.ProductVersion;  
}
Private Sub AboutDialog_Load(sender As Object, e As EventArgs) Handles MyBase.Load
   ' Display the application information in the label.
   Me.labelVersionInfo.Text = _
      Me.CompanyName + "  " + _
      Me.ProductName + "  Version: " + _
      Me.ProductVersion
   End Sub

備註

屬性 ProductName 是唯讀屬性。 若要變更此屬性的值,請設定 ProductAssemblyProductAttribute 屬性值。 下列 C# 程式程式碼會 ProductName 設定 屬性。

[assembly: AssemblyProduct("MyApplication")]

注意

強烈建議您提供公司名稱、產品名稱和產品版本。 提供這項資訊可讓您使用Windows Forms功能,例如 Application.UserAppDataPath ,更輕鬆地撰寫符合「Windows 認證」程式的應用程式。

適用於

另請參閱