Control.ProductName Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan nama produk rakitan yang berisi kontrol.
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
Nilai Properti
Nama produk rakitan yang berisi kontrol.
- Atribut
Contoh
Contoh kode berikut menampilkan informasi tentang aplikasi dalam yang Label terkandung oleh Form. Contoh ini mengharuskan CompanyName, ProductName dan ProductVersion telah ditetapkan.
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
Keterangan
Properti ProductName adalah properti baca-saja. Untuk mengubah nilai properti ini, atur Product nilai properti dari AssemblyProductAttribute. Baris kode C# berikut mengatur ProductName properti .
[assembly: AssemblyProduct("MyApplication")]
Nota
Sangat disarankan agar Anda memberikan nama perusahaan, nama produk, dan versi produk. Menyediakan informasi ini memungkinkan penggunaan fitur Windows Forms seperti Application.UserAppDataPath yang memudahkan penulisan aplikasi yang mematuhi program "Bersertifikat untuk Windows".