예제 #1
0
파일: frmPaint.cs 프로젝트: prostrmk/paint
        private void timer1_Tick(object sender, EventArgs e)
        {
            Invoke(new Action(() =>
            {
                Graphics g = this.CreateGraphics();
                for (byte i = 1; i <= GP.PlayerCount; i++)
                {
                    int X = 0, Y = 0;
                    X     = GP.PlayerList[i].Position.X;
                    Y     = GP.PlayerList[i].Position.Y;
                    g.FillEllipse(new SolidBrush(Color.FromArgb(GP.PlayerList[i].Color)), X - 10, Y - 10, radius, radius);
                    if (X == 0 && Y == 0)
                    {
                        GP.PlayerList[i].Position = new Point(1, 1);
                        GP.Send(TramePreGen.InfoPlayer(GP.PlayerList[i], i, GP.PacketID));
                        this.Refresh();
                    }
                }

                if (MouseButtons == MouseButtons.Left)
                {
                    GP.PlayerList[GP.ID].Position = this.PointToClient(Cursor.Position);
                    GP.Send(TramePreGen.InfoPlayer(GP.PlayerList[GP.ID], GP.ID, GP.PacketID));
                }

                if (update)
                {
                    this.Invalidate();
                }
            }));
        }
예제 #2
0
 private void frmPaint_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData == Keys.Return)
     {
         byte[] b = new byte[2];
         b[0] = 5;
         b[1] = GP.ID;
         GP.Send(b);
     }
     else
     {
         if (e.KeyData == Keys.Space)
         {
             using (ColorDialog ColorPicker = new ColorDialog())
             {
                 if (ColorPicker.ShowDialog() == DialogResult.OK)
                 {
                     GP.PlayerList[GP.ID].Couleur = ColorPicker.Color.ToArgb();
                     GP.Send(TramePreGen.InfoJoueur(GP.PlayerList[GP.ID], GP.ID, GP.PacketID));
                 }
             }
         }
         else
         {
             GP.PlayerList[GP.ID].Position = new Point(0, 0);
             GP.Send(TramePreGen.InfoJoueur(GP.PlayerList[GP.ID], GP.ID, GP.PacketID));
         }
     }
 }
예제 #3
0
파일: frmPaint.cs 프로젝트: prostrmk/paint
 private void выбратьЦветToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (ColorDialog ColorPicker = new ColorDialog())
     {
         if (ColorPicker.ShowDialog() == DialogResult.OK)
         {
             GP.PlayerList[GP.ID].Color = ColorPicker.Color.ToArgb();
             GP.Send(TramePreGen.InfoPlayer(GP.PlayerList[GP.ID], GP.ID, GP.PacketID));
         }
     }
 }
예제 #4
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            Invoke(new Action(() =>
            {
                Graphics g = this.CreateGraphics();
                for (byte i = 1; i <= GP.PlayerCount; i++)////////////////////////////////////+ 1
                {
                    int X = 0, Y = 0;
                    X     = GP.PlayerList[i].Position.X;
                    Y     = GP.PlayerList[i].Position.Y;



                    g.FillEllipse(new SolidBrush(Color.FromArgb(GP.PlayerList[i].Couleur)), X - 10, Y - 10, 20, 20);

                    /*rtb1.Text += a.ToString() + "x:" + c.ToString() + "y\n";
                     * rtb1.SelectionStart = rtb1.Text.Length;
                     * rtb1.ScrollToCaret();*/

                    if (X == 0 && Y == 0)
                    {
                        GP.PlayerList[i].Position = new Point(1, 1);
                        GP.Send(TramePreGen.InfoJoueur(GP.PlayerList[i], i, GP.PacketID));
                        this.Refresh();
                    }
                }
                g.DrawString(GP.ID.ToString(), new Font("Arial", 16), new SolidBrush(Color.Black), 10, 10);
                if (MouseButtons == MouseButtons.Left)//mouse)
                {
                    GP.PlayerList[GP.ID].Position = this.PointToClient(Cursor.Position);
                    GP.Send(TramePreGen.InfoJoueur(GP.PlayerList[GP.ID], GP.ID, GP.PacketID));
                }

                if (update)
                {
                    this.Invalidate();
                }
            }));
        }