Beispiel #1
0
      private void ClearButton_Click(object sender, EventArgs e)
      {
          Graphics   draw  = DrawBox.CreateGraphics();
          Brush      clear = new SolidBrush(DrawBox.BackColor);
          RectangleF Clear = new RectangleF(0, 0, DrawBox.Width, DrawBox.Height);

          draw.FillRectangle(clear, Clear);
          shapes = null;
      }
Beispiel #2
0
        public Form1()
        {
            _5pW   = _5pL = _5pD = 0;
            p5flag = drawflag = imgflag = whsflag = true;
            this.Hide();
            this.Location = new Point(150, 150);
            //this.ShowInTaskbar = true;
            InitializeComponent();


            //Gomoku a = new Gomoku();
            //a.ShowDialog();

            this.ShowInTaskbar = true;

            trackBar1.Hide();
            ColorBox.Hide();
            button2.Hide();

            Login log = new Login();

            log.ShowDialog();
            if (log.DialogResult == DialogResult.Cancel)
            {
                this.Close();
            }
            else
            {
                this.Show();
                //this.ShowInTaskbar = true;
                SetUpData init = log.Get();
                Username = init.UserName;


                MLabel.Hide();
                //Box.ForeColor = Bcolor;
                UserBox.DataSource = UserList;
                myGraphic          = DrawBox.CreateGraphics();
                DrawBox.BringToFront();

                c.Setup(init.IP, init.Port);


                //addMsg("2.成功連線");

                msgHandler = this.addMsg;
                dwHandler  = this.addDw;
                imgHandler = this.ShowPic;
                c.Recv(processMsgComeIn, processDwComeIn, processImgComeIn);

                //MessageBox.Show("歡迎加入~");
            }
        }
Beispiel #3
0
      private void DrawButton_Click(object sender, EventArgs e)
      {
          if (shapes == null)
          {
              shapes = new List <Shape>();
          }
          Graphics draw = DrawBox.CreateGraphics();
          int      randomShape;

          if (checkBoxColorOfShapes.Checked)
          {
              color = colorDialog.Color;
          }
          else
          {
              color = Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256));
          }
          for (int i = 0; i < trackBarDrawings.Value; i++)
          {
              switch (randomShape = rnd.Next(0, 5))
              {
              case 0:
                  shapes.Add(new Point(rnd.Next(0, DrawBox.Width), rnd.Next(0, DrawBox.Height),
                                       pen = new Pen(color, 2)));
                  break;

              case 1:
                  shapes.Add(new Line(rnd.Next(0, DrawBox.Width), rnd.Next(0, DrawBox.Height),
                                      rnd.Next(0, DrawBox.Width), rnd.Next(0, DrawBox.Height),
                                      pen = new Pen(color, 2)));
                  break;

              case 2:
                  shapes.Add(new Rectangle(rnd.Next(0, DrawBox.Width), rnd.Next(0, DrawBox.Height),
                                           rnd.Next(0, DrawBox.Width), rnd.Next(DrawBox.Height),
                                           pen = new Pen(color, 2)));
                  break;

              case 3:
                  shapes.Add(new Circle(rnd.Next(0, DrawBox.Width), rnd.Next(0, DrawBox.Height),
                                        rnd.Next(0, DrawBox.Width), rnd.Next(0, DrawBox.Height),
                                        pen = new Pen(color, 2)));
                  break;

              case 4:
                  shapes.Add(new Ellipse(rnd.Next(0, DrawBox.Width), rnd.Next(0, DrawBox.Height),
                                         rnd.Next(0, DrawBox.Width), rnd.Next(0, DrawBox.Height),
                                         pen = new Pen(color, 2)));
                  break;
              }
          }
          DrawBox.Refresh();
      }
Beispiel #4
0
        public String addDw(String str)
        {
            DrawBox.BringToFront();
            myGraphic = DrawBox.CreateGraphics();

            String[]   Words  = str.Split('.');
            int        Nsize  = Int32.Parse(Words[1]);
            Color      Ncolor = System.Drawing.ColorTranslator.FromHtml(Words[2]);
            SolidBrush NBrush = new SolidBrush(Ncolor);
            int        i      = 0;

            try
            {
                for (i = 3; Words[i] != "!"; i += 2)
                {
                    if (i < Words.Length)
                    {
                        try
                        {
                            x = Int32.Parse(Words[i + 1]);
                            y = Int32.Parse(Words[i]);
                            px.Add(x);
                            py.Add(y);
                            if (onDraw == true)
                            {
                                myGraphic.FillEllipse(NBrush, y, x, Nsize, Nsize);
                            }
                        }
                        catch
                        {
                            MessageBox.Show(Words[i + 1]);
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("畫太多了唷!");
            }
            return("OK");
        }
Beispiel #5
0
 private void Form1_Load(object sender, EventArgs e)
 {
     graphics = DrawBox.CreateGraphics();
     pen      = new Pen(Color.Red, 2);
     graphics.Clear(Color.White);
 }