Click here to Skip to main content
15,909,030 members
Home / Discussions / C#
   

C#

 
AnswerRe: Drag Drop from .net application to outside it Pin
Saksida Bojan26-Feb-10 2:17
Saksida Bojan26-Feb-10 2:17 
GeneralRe: Drag Drop from .net application to outside it Pin
Aseem Sharma27-Feb-10 19:28
Aseem Sharma27-Feb-10 19:28 
QuestionMouseMove event confusion Pin
ahmetkoc26-Feb-10 1:38
ahmetkoc26-Feb-10 1:38 
AnswerRe: MouseMove event confusion Pin
Not Active26-Feb-10 2:07
mentorNot Active26-Feb-10 2:07 
AnswerRe: MouseMove event confusion Pin
Saksida Bojan26-Feb-10 2:11
Saksida Bojan26-Feb-10 2:11 
GeneralRe: MouseMove event confusion Pin
ahmetkoc26-Feb-10 2:20
ahmetkoc26-Feb-10 2:20 
GeneralRe: MouseMove event confusion Pin
Saksida Bojan26-Feb-10 3:39
Saksida Bojan26-Feb-10 3:39 
GeneralRe: MouseMove event confusion Pin
ahmetkoc27-Feb-10 1:37
ahmetkoc27-Feb-10 1:37 
Hi Saksida,
I have already used MouseUp and MouseDown events to ensure left-mousebutton pressed.
I have screenshot but dont know how to send via forum.

The idea is on mousemove event check the grid cells whether filled or not with color red while left-mousebutton pressed.Cells were checking by GetPixel static method,checking is being done only entering new cell.



private void zemin_MouseMove(object sender, MouseEventArgs e)
{
      if (!this.ClientRectangle.Contains(e.X, e.Y)) return;
      AtkiCozguNo(e.X, e.Y);//find row and column numbers of grid.
      if (!tusaBasildi) return;//ensure left-mousebutton pressed.

      if (atki == sonAtki & cozgu == sonCozgu) return;//if it's not new cell return.
      sonAtki = atki;
      sonCozgu = cozgu;
      renkKontrol(e.X, e.Y);//check color

}

private void renkKontrol(int x, int y)//find color x and y coordinate
{
             if(bitmapPixel.GetPixel(this, x, y).ToArgb()==this.BackColor.ToArgb())
                   {
                    kutuDoldur(Color.Red);//fill cell with color red
                   }
             if(bitmapPixel.GetPixel(this, x, y).ToArgb()==Color.Red.ToArgb())
                   {
                    kutuDoldur(this.BackColor);//fill cell with color of Control Backcolor
                   }

}


private void kutuDoldur(Color renk)//fill rectangle with desired color onto bitmap kutuResmi
           {
                   using (Graphics myKutu = Graphics.FromImage(kutuResmi))
                  {
                     myKutu.FillRectangle(new SolidBrush(renk),new                    Rectangle(xKoordinat,yKoordinat,kutuEbadı,kutuEbadı));
                  }

                Invalidate();
          }


private void zemin_Paint(object sender, PaintEventArgs e)
       {
          e.Graphics.DrawImage(kutuResmi, 0, 0);//place bitmap kutuResmi on Control
       }

GeneralRe: MouseMove event confusion Pin
Saksida Bojan27-Feb-10 1:49
Saksida Bojan27-Feb-10 1:49 
GeneralRe: MouseMove event confusion [modified] Pin
ahmetkoc27-Feb-10 2:05
ahmetkoc27-Feb-10 2:05 
GeneralRe: MouseMove event confusion Pin
Saksida Bojan27-Feb-10 2:12
Saksida Bojan27-Feb-10 2:12 
GeneralRe: MouseMove event confusion Pin
ahmetkoc27-Feb-10 2:20
ahmetkoc27-Feb-10 2:20 
GeneralRe: MouseMove event confusion Pin
Saksida Bojan27-Feb-10 2:22
Saksida Bojan27-Feb-10 2:22 
GeneralRe: MouseMove event confusion Pin
ahmetkoc27-Feb-10 2:25
ahmetkoc27-Feb-10 2:25 
GeneralRe: MouseMove event confusion Pin
Saksida Bojan27-Feb-10 2:30
Saksida Bojan27-Feb-10 2:30 
GeneralRe: MouseMove event confusion Pin
Luc Pattyn26-Feb-10 6:56
sitebuilderLuc Pattyn26-Feb-10 6:56 
QuestionWindows mobile screen rotation - C# Pin
john3426-Feb-10 1:33
john3426-Feb-10 1:33 
AnswerRe: Windows mobile screen rotation - C# Pin
Alan Balkany26-Feb-10 4:26
Alan Balkany26-Feb-10 4:26 
GeneralRe: Windows mobile screen rotation - C# Pin
john343-Mar-10 1:50
john343-Mar-10 1:50 
GeneralRe: Windows mobile screen rotation - C# Pin
Alan Balkany3-Mar-10 4:07
Alan Balkany3-Mar-10 4:07 
QuestionRegistry Pin
kk.tvm26-Feb-10 1:11
kk.tvm26-Feb-10 1:11 
AnswerRe: Registry Pin
Bernhard Hiller26-Feb-10 1:37
Bernhard Hiller26-Feb-10 1:37 
GeneralRe: Registry Pin
kk.tvm26-Feb-10 18:01
kk.tvm26-Feb-10 18:01 
QuestionFastest way of filtering a DataTable?? Pin
Muammar©26-Feb-10 0:28
Muammar©26-Feb-10 0:28 
AnswerRe: Fastest way of filtering a DataTable?? Pin
Som Shekhar26-Feb-10 1:08
Som Shekhar26-Feb-10 1:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.