Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
という名前のパネルを再配置しようとすると、次のpPan2 つの方法で行うことができます。
pPan
私が書くボタンのクリックイベント内
pPan.Location = new Point ( pPan.Location.X +10 , pPan.Location.Y );
または私は書くことができます:
pPan.Location.X += 10;
では、ここでの違いは何ですか?new Pointこれを作成する理由
new Point
Pointが の場合struct、プロパティを呼び出すと のコピーが返され、Locationそのコピーを変更しようとするため、最初のものを使用する必要があります。
Point
struct
Location