не получается вывести текст в picturebox, я только изучаю программирование, и задача состоит в том что бы не пользовать готовыми шаблонами (кнопками, лэйблами, боксами и т.д.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public string P = "Лет", Z = "Дней";
PictureBox Ps,Gs;
public Form1()
{
InitializeComponent();
this.StartPosition = FormStartPosition.CenterScreen;
Text = "Вроде работает";
this.BackColor = Color.Red;
this.Width = 365;
this.Height = 130;
private void Form1_Load(object sender, EventArgs e)
{
Pict sk;
Ps = new PictureBox();
Controls.Add(Ps);
Gs = new PictureBox();
Controls.Add(Gs);
this.Gs.Location = new System.Drawing.Point(125, 20);
this.Gs.Size = new System.Drawing.Size(100, 50);
Gs.MouseClick += Gs_MouseClick;
Gs.BackColor = Color.Green;
Gs.MouseEnter += Gs_MouseEnter;
this.Ps.Location = new System.Drawing.Point(230, 20);
this.Ps.Size = new System.Drawing.Size(100, 50);
Ps.BackColor = Color.Green;
Ps.MouseClick += Ps_MouseClick;
Ps.MouseEnter += Ps_MouseEnter;
sk = new WindowsFormsApplication4.Pict();
sk.New(this, 200,200);
sk.Noty += sk_Noty;
}
private void Gs_Paint(object sender, PaintEventArgs e)
{
Visible = true;
Text = "asd";
e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
e.Graphics.DrawString(Text, new Font("Cambria", 48), Brushes.Black, new PointF(0, 0));
**Здесь соответственно пытаюсь вывести текст в один из пикчербоксов.**
}
private void Gs_MouseClick(object sender, EventArgs e)
{
this.Hide();
Form2 form2 = new Form2();
form2.Show();
}
private void Gs_MouseEnter(object sender, EventArgs e)
{
Gs.BackColor = Color.Blue;
}
private void Ps_MouseClick(object sender, MouseEventArgs e)
{
Form fr = new Form();
try
{
using(Form3 f = new Form3())
{
fr.StartPosition = FormStartPosition.Manual;
fr.FormBorderStyle = FormBorderStyle.None;
fr.Opacity = .50d;
fr.BackColor = Color.Black;
fr.WindowState = FormWindowState.Maximized;
fr.Location = this.Location;
fr.ShowInTaskbar = false;
fr.Show();
f.Owner = fr;
f.ShowDialog();
fr.Dispose();
}
}
catch(Exception ex) { MessageBox.Show(ex.Message); }
finally { fr.Dispose(); }
}
private void Ps_MouseEnter(object sender, EventArgs e)
{
Ps.BackColor = Color.Blue;
}
private void sk_Noty(string message)
{
MessageBox.Show(P);
}
}
}'
)