Control.LocationChanged 이벤트

정의

Location 속성 값이 변경되면 발생합니다.

public:
 event EventHandler ^ LocationChanged;
public event EventHandler LocationChanged;
public event EventHandler? LocationChanged;
member this.LocationChanged : EventHandler 
Public Custom Event LocationChanged As EventHandler 

이벤트 유형

예제

다음 코드 예제에서는 폼의 LocationChanged 크기를 조정할 때 에 StatusStrip 이벤트를 발생 입니다.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

public class Form1 : Form
{
    private StatusStrip statusStrip1;

    public Form1()
    {
        InitializeComponent();
    }
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }

    private void InitializeComponent()
    {
        this.statusStrip1 = new System.Windows.Forms.StatusStrip();
        this.SuspendLayout();
        // 
        // statusStrip1
        // 
        this.statusStrip1.Location = new System.Drawing.Point(0, 251);
        this.statusStrip1.Name = "statusStrip1";
        this.statusStrip1.Size = new System.Drawing.Size(292, 22);
        this.statusStrip1.TabIndex = 0;
        this.statusStrip1.Text = "statusStrip1";
        this.statusStrip1.LocationChanged += new System.EventHandler(this.statusStrip1_LocationChanged);
        // 
        // Form1
        // 
        this.ClientSize = new System.Drawing.Size(292, 273);
        this.Controls.Add(this.statusStrip1);
        this.Name = "Form1";
        this.ResumeLayout(false);
        this.PerformLayout();
    }

    private void statusStrip1_LocationChanged(object sender, EventArgs e)
    {
        MessageBox.Show("The form has been resized.");
    }
}
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms

Public Class Form1
   Inherits Form
   Private WithEvents statusStrip1 As StatusStrip
   
   Public Sub New()
      InitializeComponent()
   End Sub
   
   <STAThread()>  _
   Shared Sub Main()
      Application.EnableVisualStyles()
      Application.SetCompatibleTextRenderingDefault(False)
      Application.Run(New Form1())
   End Sub
   
   
   Private Sub InitializeComponent()
      Me.statusStrip1 = New System.Windows.Forms.StatusStrip()
      Me.SuspendLayout()
      ' 
      ' statusStrip1
      ' 
      Me.statusStrip1.Location = New System.Drawing.Point(0, 251)
      Me.statusStrip1.Name = "statusStrip1"
      Me.statusStrip1.Size = New System.Drawing.Size(292, 22)
      Me.statusStrip1.TabIndex = 0
      Me.statusStrip1.Text = "statusStrip1"
      ' 
      ' Form1
      ' 
      Me.ClientSize = New System.Drawing.Size(292, 273)
      Me.Controls.Add(statusStrip1)
      Me.Name = "Form1"
      Me.ResumeLayout(False)
      Me.PerformLayout()
   End Sub
    
   
   Private Sub statusStrip1_LocationChanged(sender As Object, e As EventArgs) Handles statusStrip1.LocationChanged
      MessageBox.Show("The form has been resized.")
   End Sub
End Class

설명

이 이벤트는 프로그래매틱 수정 또는 상호 작용을 통해 속성이 변경되는 경우에 Location 발생합니다.

이벤트 처리에 대한 자세한 내용은 이벤트 처리 및 발생 을 참조하십시오.

적용 대상

추가 정보