Possible Duplicate:
Update label location in C#?非可調用成員
我創建一個自定義的Windows窗體,並試圖更改標籤的位置,我得到的錯誤時:錯誤1非可調用成員的System.Windows.Forms.Control.Location '不能像一種方法一樣使用。 C:\ Users \用戶然\文件\的Visual Studio 2010 \項目\ SyncCustomForm \ SyncCustomForm \ SyncControl1.cs 50 24 SyncCustomForm
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SyncCustomForm
{
public partial class SyncControl : UserControl
{
public SyncControl()
{
InitializeComponent();
}
public ProgressBar prbSyncProgress
{
get { return prbProgress; }
}
public Label lblException
{
get { return lblMessage; }
}
public Label lblStatus
{
get { return lblS; }
}
public Button btnPause
{
get { return btnP; }
}
public Button btnStop
{
get { return btnS; }
}
public GroupBox grbxSync
{
get { return gbxSync; }
}
private void SyncControl_Load(object sender, EventArgs e)
{
lblMessage.Location.X = 50;
}
}
}
爲什麼要公開所有私有部分?就像在現實生活中一樣,在編程時也強烈建議不要...(我指的是你的公共標籤,按鈕等。 – Crisfole