윈폼 유저 컨트롤 안의 리스트 뷰의 마우스 더블 클릭이 안되는 경우

안녕하세요
유저 컨트롤을 3 영역으로 나눈 후 리스트뷰를 추가 하였습니다.
그런 뒤 마우스 더블 클릭 이벤트를 추가했는데 동작하지를 않습니다. 디버깅도 걸리지 않더군요
이럴 경우 어떻게 해야 하나요?
아래는 구성 이미지 입니다.
image

2개의 좋아요

어디에 클릭 이벤트를 넣으셨나요?
코드를 간략히 공유해주시면 원인 파악에 도움이 될 것 같습니다.

2개의 좋아요

3번째 리스트 뷰에 넣었습니다.
유저 컨트롤 디자이너 코드 입니다.
namespace TestCode2
{
partial class ucTest
{
///


/// 필수 디자이너 변수입니다.
///

private System.ComponentModel.IContainer components = null;

    /// <summary> 
    /// 사용 중인 모든 리소스를 정리합니다.
    /// </summary>
    /// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region 구성 요소 디자이너에서 생성한 코드

    /// <summary> 
    /// 디자이너 지원에 필요한 메서드입니다. 
    /// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.
    /// </summary>
    private void InitializeComponent()
    {
        this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
        this.listView1 = new System.Windows.Forms.ListView();
        this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
        this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
        this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
        this.label1 = new System.Windows.Forms.Label();
        this.label2 = new System.Windows.Forms.Label();
        this.tableLayoutPanel1.SuspendLayout();
        this.SuspendLayout();
        // 
        // tableLayoutPanel1
        // 
        this.tableLayoutPanel1.ColumnCount = 1;
        this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
        this.tableLayoutPanel1.Controls.Add(this.listView1, 0, 2);
        this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
        this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1);
        this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
        this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
        this.tableLayoutPanel1.Name = "tableLayoutPanel1";
        this.tableLayoutPanel1.RowCount = 3;
        this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
        this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
        this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
        this.tableLayoutPanel1.Size = new System.Drawing.Size(553, 383);
        this.tableLayoutPanel1.TabIndex = 0;
        // 
        // listView1
        // 
        this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
        this.columnHeader1,
        this.columnHeader2,
        this.columnHeader3});
        this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
        this.listView1.Location = new System.Drawing.Point(3, 257);
        this.listView1.Name = "listView1";
        this.listView1.Size = new System.Drawing.Size(547, 123);
        this.listView1.TabIndex = 0;
        this.listView1.UseCompatibleStateImageBehavior = false;
        this.listView1.View = System.Windows.Forms.View.Details;
        this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
        this.listView1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseClick);
        this.listView1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDoubleClick);
        // 
        // columnHeader1
        // 
        this.columnHeader1.Width = 150;
        // 
        // columnHeader2
        // 
        this.columnHeader2.Width = 150;
        // 
        // columnHeader3
        // 
        this.columnHeader3.Width = 150;
        // 
        // label1
        // 
        this.label1.AutoSize = true;
        this.label1.BackColor = System.Drawing.Color.Lime;
        this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
        this.label1.Font = new System.Drawing.Font("굴림", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
        this.label1.Location = new System.Drawing.Point(3, 0);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(547, 127);
        this.label1.TabIndex = 1;
        this.label1.Text = "영역1";
        // 
        // label2
        // 
        this.label2.AutoSize = true;
        this.label2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
        this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
        this.label2.Location = new System.Drawing.Point(3, 127);
        this.label2.Name = "label2";
        this.label2.Size = new System.Drawing.Size(547, 127);
        this.label2.TabIndex = 2;
        this.label2.Text = "label2";
        // 
        // ucTest
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.Controls.Add(this.tableLayoutPanel1);
        this.Name = "ucTest";
        this.Size = new System.Drawing.Size(553, 383);
        this.Load += new System.EventHandler(this.ucTest_Load);
        this.tableLayoutPanel1.ResumeLayout(false);
        this.tableLayoutPanel1.PerformLayout();
        this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
    private System.Windows.Forms.ListView listView1;
    private System.Windows.Forms.ColumnHeader columnHeader1;
    private System.Windows.Forms.ColumnHeader columnHeader2;
    private System.Windows.Forms.ColumnHeader columnHeader3;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.Label label2;
}

}

유저 컨트롤 소스 입니다.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TestCode2
{
public partial class ucTest : UserControl
{
public ucTest()
{
InitializeComponent();
}

    private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
    {
        MessageBox.Show("테스트");
    }

    private void listView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        MessageBox.Show("호이");
    }

    private void ucTest_Load(object sender, EventArgs e)
    {
        string strName = "이름";
        string strText = "내용 입니다.";


        ListViewItem lvi = new ListViewItem(new string[] { "", strName, strText });

        this.listView1.Items.Add(lvi);
    }

    private void listView1_MouseClick(object sender, MouseEventArgs e)
    {
        MessageBox.Show("호이");
    }
}

}

2개의 좋아요

혹시 리스트에 데이터 추가해보고 해당 데이터 더블 클릭해보셨을 때도 이벤트가 안들어오나요?

1개의 좋아요

제가 해보니 아이템이 있을 때, 아이템을 클릭해야 이벤트 핸들러로 들어가네요.
혹시 빈칸을 클릭하더라도 동작하고 싶으시다면

를 참고해서 해보세요~

3개의 좋아요

답변 감사드립니다.
아이템은 추가하여 테스트 해봤으며 그래도 안되더군요
리스트뷰의 속성 중 FullRowSelect 를 TRUE 로 변경하니 제가 원하는 그림이 나오네요.
image
속성을 변경하지 않았을 경우 첫번째 컬럼의 텍스트만 선택이 되고 이벤트 핸들러로 연결 되더군요.
참고 자료 감사합니다. ^^

2개의 좋아요