Rambler's Top100
Главная
Новости
Статьи
Форумы
Книги
Коды
Сообщество
Блоги
О нас
 

Логин

Email:
  Пароль:

Войти
Зарегистрироваться
Забыл пароль

Поиск

 Искать :
 
Вперед

Сообщение

Eugene Ostroukhov


Болтун

Зарегистрирован:
11 September 2003
Сообщения: 340
Примеры кода: 3
 

RE: Странности ListView

19 April 2005 14:47  


При работе с мышкой.
Если свойство MultySelect = TRUE, не вырабатывается MouseMove (понятно, Идет выделение айтемов), если False, то сразу!! за MouseDown проходит MouseUP !!! Кнопка мыши [q]только[/q] нажата! Это что, MS bag или фич?

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication1
{
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.ListView listView1;
		private System.Windows.Forms.Label labelX;
		private System.Windows.Forms.Label labelY;
		private System.ComponentModel.Container components = null;
		public Form1()
		{
			InitializeComponent();
		}
		protected override void Dispose( bool disposing )
		{
			if( disposing )
				if (components != null) 
					components.Dispose();
			base.Dispose( disposing );
		}
		private void InitializeComponent()
		{
			System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem("111");
			System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem("222");
			System.Windows.Forms.ListViewItem listViewItem3 = new System.Windows.Forms.ListViewItem("333");
			System.Windows.Forms.ListViewItem listViewItem4 = new System.Windows.Forms.ListViewItem("444");
			this.listView1 = new System.Windows.Forms.ListView();
			this.labelX = new System.Windows.Forms.Label();
			this.labelY = new System.Windows.Forms.Label();
			this.SuspendLayout();
			// listView1
			this.listView1.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
			  listViewItem1,
			  listViewItem2,
			  listViewItem3,
			  listViewItem4});
			this.listView1.Location = new System.Drawing.Point(56, 48);
			this.listView1.Name = "listView1";
			this.listView1.Scrollable = false;
			this.listView1.TabIndex = 0;
			this.listView1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseMove);
			// labelX
			this.labelX.Location = new System.Drawing.Point(112, 184);
			this.labelX.Name = "labelX";
			this.labelX.Size = new System.Drawing.Size(40, 23);
			this.labelX.TabIndex = 1;
			this.labelX.Text = "label1";
			// labelY
			this.labelY.Location = new System.Drawing.Point(160, 184);
			this.labelY.Name = "labelY";
			this.labelY.Size = new System.Drawing.Size(40, 23);
			this.labelY.TabIndex = 2;
			this.labelY.Text = "label1";
			// Form1
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(408, 269);
			this.Controls.Add(this.labelY);
			this.Controls.Add(this.labelX);
			this.Controls.Add(this.listView1);
			this.Name = "Form1";
			this.Text = "Form1";
			this.ResumeLayout(false);
		}
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void listView1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			labelX.Text = e.X.ToString();
			labelY.Text = e.Y.ToString();
		}
	}
}

Все замечательно отображается при MouseMove (и с нажатым Ctrl включительно).
Двадцать лет строил песочный замок, потом поумнел и стал строить воздушный.
Наверх
  



Winforms

 Странности ListViewSolovkin  19 April 2005 12:25
 RE: Странности ListViewEugene Ostroukhov  19 April 2005 14:47
 RE: Странности ListViewDanat  17 January 2007 14:41
 RE: Странности ListViewDanat  17 January 2007 14:52
 
Наш Киев

Apartments for Rent

Rambler's Top100
Рейтинг@Mail.ru
Идея: Dimon aka Manowar Программирование: Dimon aka Manowar Дизайн: Dan Lebedev
Хостинг от компании Parking.ru
Карта сайта