private void zedGraphControl1_MouseEnter(object sender, EventArgs e)
{
zedGraphControl1.Location = new Point(this.Width / 2, this.Height / 2);
}
그러나 이렇게하면 컨트롤의 왼쪽이 form1의 중간에있게되고 오른쪽은 모두 form1 영역을 벗어나게됩니다.
전체 컨트롤이 중간에 있도록하려면 어떻게해야합니까?
메인 Winform의 중심을 올바르게 찾고 거기에 그래프 컨트롤을 배치했습니다. 해당 지점의 중앙에 배치하려면 너비와 높이의 절반을 제거하면됩니다.
private void zedGraphControl1_MouseEnter(object sender, EventArgs e)
{
zedGraphControl1.Location = new Point(Width / 2 - zedGraphControl1.Width/2, Height / 2 - zedGraphControl1.Height/2);
}
그리고 미안하지만 MS Paint를 좋아합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다