IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası
  sohbet

 Kayıt ol  Topluluk
Yeni Konu aç Cevapla
 
LinkBack Seçenekler Stil
Alt 19 Temmuz 2008, 16:03   #1
Çevrimiçi
Yardımcı Admin
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Karakterlerin Program Üzerindeki Yer Bilgisi




ListBox içerisinde fareyle üzerine geldiğiniz karakterin x-y koordinatlarını veren kod

PHP Kod:   Kodu kopyalamak için üzerine çift tıklayın!
using System;
using System.Windows.Forms;
 
namespace 
ListBoxMouse1
{
  public class 
MainForm System.Windows.Forms.Form
  
{
    private 
System.Windows.Forms.Label label1;
    private 
System.Windows.Forms.ListBox listBox1;
    
    public 
MainForm()
    {
      
InitializeComponent();
      
// now set this particular event handler to function ButtonDown()
      
this.listBox1.MouseDown += new System.Windows.Forms.MouseEventHandlerthis.ButtonDown ); 
    }
          
    
// program entry point
    
public static void Main(string[] args)
    {
      
Application.Run(new MainForm());
    }
          
    
#region Windows Forms Designer generated code
    
private void InitializeComponent() 
    {
      
this.listBox1 = new System.Windows.Forms.ListBox();
      
this.label1 = new System.Windows.Forms.Label();
      
this.SuspendLayout();
      
// 
      // listBox1
      // 
      
this.listBox1.BackColor System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(224)), ((System.Byte)(192)));
      
this.listBox1.ItemHeight 16;
      
this.listBox1.Location = new System.Drawing.Point(816);
      
this.listBox1.Name "listBox1";
      
this.listBox1.Size = new System.Drawing.Size(240196);
      
this.listBox1.TabIndex 0;
      
// 
      // label1
      // 
      
this.label1.BackColor System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(192)));
      
this.label1.Location = new System.Drawing.Point(16224);
      
this.label1.Name "label1";
      
this.label1.Size = new System.Drawing.Size(232112);
      
this.label1.TabIndex 1;
      
this.label1.Text "label1";
      
// 
      // MainForm
      // 
      
this.AutoScaleBaseSize = new System.Drawing.Size(615);
      
this.BackColor System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(0)));
      
this.ClientSize = new System.Drawing.Size(320344);
      
this.Controls.Add(this.label1);
      
this.Controls.Add(this.listBox1);
      
this.Name "MainForm";
      
this.Text "MouseDown in a ListBox";
      
this.Load += new System.EventHandler(this.MainFormLoad);
      
this.ResumeLayout(false);
    }
    
#endregion
          
    // respond to mouse events in the listBox
    
private void ButtonDown(object senderMouseEventArgs mea)
    {
      
// the 0 based index of the row/item clicked
      
int nDx 0
       
      if ( 
mea.Button == MouseButtons.Right 
      { 
        
label1.Text "Right Button Clicked\n";
      }
      else if ( 
mea.Button == MouseButtons.Left 
      { 
        
label1.Text "Left Button Clicked\n";
      }
 
      
// calculate the index of the selected item or show error
      
nDx mea.listBox1.ItemHeight;
      
label1.Text label1.Text +
        
"Item height = " listBox1.ItemHeight.ToString()+ "\n" +
        
"X position  = " mea.X.ToString() + "\n" +
        
"Y position  = " mea.Y.ToString() + "\n" +
        
"Index       = " nDx.ToString();
 
      if ( 
listBox1.Items.Count <= nDx )
      {
        
label1.Text label1.Text "\nRow clicked past items loaded";
      }
      else
      {
        
label1.Text label1.Text "\nIndex       = " listBox1.Items[nDx];
        
//highlight the selected row/item
        
listBox1.SetSelected(nDx,true);
      }
    }          
          
    
// load the listBox with some names
    
void MainFormLoad(object senderSystem.EventArgs e)
    {
      
listBox1.Items.Add("Helmut");
      
listBox1.Items.Add("Helga");
      
listBox1.Items.Add("Andreas");
      
listBox1.Items.Add("Volger");
      
listBox1.Items.Add("Kurt");
      
listBox1.Items.Add("Erich");
      
listBox1.Items.Add("Bjorn");
      
listBox1.Items.Add("Lena");
      
listBox1.Items.Add("Kristina");
      
listBox1.Items.Add("Ulrike");
      
listBox1.Items.Add("Heidrun");
    }
  }


Alıntıdır

__________________
[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]

[Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]
 
Alıntı ile Cevapla

IRCForumlari.NET Reklamlar
sohbet odaları reklam ver Benimmekan Mobil Sohbet
Cevapla

Etiketler
bilgisi, karakterlerin, program, yer, Üzerindeki


Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir)
 

Yetkileriniz
Konu Acma Yetkiniz Yok
Cevap Yazma Yetkiniz Yok
Eklenti Yükleme Yetkiniz Yok
Mesajınızı Değiştirme Yetkiniz Yok

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-Kodu Kapalı
Trackbacks are Kapalı
Pingbacks are Açık
Refbacks are Açık


Benzer Konular
Konu Konuyu Başlatan Forum Cevaplar Son Mesaj
Cabal Online 1'den 170'e Tüm Karakterlerin Yol Haritası KarakıZ Online Oyunlar 1 11 Şubat 2013 17:03
Karakter yapılandırma (Tüm karakterlerin skill ve stat ayarları) Rehin Metin2 0 12 Aralık 2010 19:20
Event'lardaki ^@* gibi Karakterlerin Anlamları MaeLStrOm mIRC Scripting Sorunları 40 30 Mayıs 2009 21:06