コントロールCellで構成される次のクラスがあるとします。Label
class Cell : UserControl
{
Label base;
public Cell(Form form)
{
base = new Label();
base.Parent = form;
base.Height = 30;
base.Width = 30;
}
}
public partial class Form1 : Form
{
Label label = new Label();
public Form1()
{
InitializeComponent();
Cell cell = new Cell(this);
cell.Location = new Point(150, 150); //this doesnt work
label.Location = new Point(150,150); //but this does
}
}
シングルCellはに表示されますが、Formその位置に固定されtop left (0,0)ます。
LocationプロパティをPoint他の座標でnewに設定しても、Cellは左上に残るため、何もしません。
ただし、新しいものを作成してLabelからその場所を設定しようとすると、ラベルが移動します。
Cell私のオブジェクトでこれを行う方法はありますか?