private void panel1_MouseDoubleClick(object sender, MouseEventArgs e) { if (radioButton1.Checked) { Pen q = new Pen(Color.Black); CCircle RR = new CCircle(e.X, e.Y, 10, q); storage.Add(RR); Label lb = new Label(); lb.Location = new System.Drawing.Point(e.X - 18, e.Y - 18); this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); lb.BackColor = Color.Transparent; lb.Name = "label1"; lb.Size = new System.Drawing.Size(10, 12); lb.Text = n.ToString(); panel1.Controls.Add(lb); dataGridView1.RowCount = n + 1; dataGridView1.ColumnCount = n + 1; dataGridView1[0, 0].Value = 0; for (int i = 1; i < dataGridView1.Rows.Count; ++i) { dataGridView1[0, i].Value = i; } for (int i = 1; i < dataGridView1.Rows.Count; ++i) { dataGridView1[i, 0].Value = i; } n++; panel1.Invalidate(); } }
public Mobile() { //SMSProvider = SMSProviderFactory.GetSMSProvider("SMSProviderWithTread"); SMSProvider = SMSProviderFactory.GetSMSProvider("SMSProviderWithTasks"); Storage = new MyStorage(); SMSProvider.SMSReceived += (message) => Storage.Add(message); }
public override void Load(StreamReader stream) { int c = Convert.ToInt32(stream.ReadLine()); for (int i = 0; i < c; i++) { _shapes.Add(op_8.Form1.createShape(stream.ReadLine())); _shapes.GetObject(i).Load(stream); } }
private void panel1_MouseClick(object sender, MouseEventArgs e) { if (radioButton2.Checked) { if (versh == -1) { for (int i = 0; i < storage.getCount(); i++) { if (storage.GetObject(i).finder(e.X, e.Y)) { versh = i; break; } panel1.Invalidate(); } } else { toversh = -1; for (int i = 0; i < storage.getCount(); i++) { if (storage.GetObject(i).finder(e.X, e.Y)) { toversh = i; break; } } if ((toversh != -1) && (versh != toversh)) { Graphics g = panel1.CreateGraphics();; Pen pen1 = new Pen(Color.Red); float x1, x2, y1, y2; x1 = storage.GetObject(versh).x; y1 = storage.GetObject(versh).y; x2 = storage.GetObject(toversh).x; y2 = storage.GetObject(toversh).y; x = Convert.ToInt32(x1 + (x2 - x1) / 2); y = Convert.ToInt32(y1 + (y2 - y1) / 2); Section line = new Section(x1, y1, x2, y2, pen1); storage2.Add(line); label1.Visible = true; textBox1.Visible = true; button1.Visible = true; MessageBox.Show("Введите расстояние"); k = versh; l = toversh; } panel1.Invalidate(); versh = -1; } } }
public Mobile() { SMSProvider = new SMSProvider(); Storage = new MyStorage(); SMSProvider.SMSReceived += (message) => Storage.Add(message); }