Jump to content

C# - Sürükle Bırak Örneği


Muallim-i Ali

Recommended Posts

Dersi Hazırlayan : Programmar'a teşekkürler.

Sürükle Bırak Örneği (C#)

C# da Sürükle Bırak işleminin nasıl yapıldığını göreceğiz. Videoda anlatmıştım. Burdada Kodları veriyorum. 2 Listbox koyup propertiesten AllowDrop özelliklerini True yapacağız ve kodlar aşağıda sizlerle...

public partial class Form1 : Form
{
int index;

public Form1( )
{
InitializeComponent( );
}

private void listBox1_MouseDown(object sender, MouseEventArgs e )
{
Point p = new Point(e.X, e.Y );
index = listBox1.IndexFromPoint(p );
if (e.Button == MouseButtons.Left )
{
listBox1.DoDragDrop(listBox1.Items[index].ToString( ), DragDropEffects.All );
}
}

private void listBox2_DragOver(object sender, DragEventArgs e )
{
if (e.KeyState == 1 )
{
e.Effect = DragDropEffects.Move;
}
}

private void listBox2_DragDrop(object sender, DragEventArgs e )
{
listBox2.Items.Add(e.Data.GetData(DataFormats.Text ).ToString( ) );
listBox1.Items.Remove(listBox1.Items[index].ToString( ) );
}

}[/CODE]

Dersin videosu : http://www.kariyervideo.com/VideoAciklama.asp?id=137

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...