Szanowni Państwo :),
Mam problem, może i trywialny, jednak nie wiem jak go rozwiązać, a mianowicie po kliknięciu menu chce wywołać drugie okno jednak nie wiem jak to uczynić
Form2:
namespace Linia
{
public partial class Form2 : Form
{
private Form1 Form1;
public Form2(Form1 Form)
{
InitializeComponent();
this.Form1 = Form;
}
private void Form2_Load(object sender, EventArgs e)
{
}
private void label3_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
ColorDialog MyDialog = new ColorDialog();
// Keeps the user from selecting a custom color.
MyDialog.AllowFullOpen = false;
// Allows the user to get help. (The default is false.)
MyDialog.ShowHelp = true;
// Sets the initial color select to the current text color.
MyDialog.Color = Form1.circularProgressBar1.ProgressColor;
// Update the text box color if the user clicks OK
if (MyDialog.ShowDialog() == DialogResult.OK)
Form1.circularProgressBar1.ProgressColor = MyDialog.Color;
}
private void button2_Click(object sender, EventArgs e)
{
ColorDialog MyDialog = new ColorDialog();
// Keeps the user from selecting a custom color.
MyDialog.AllowFullOpen = false;
// Allows the user to get help. (The default is false.)
MyDialog.ShowHelp = true;
// Sets the initial color select to the current text color.
MyDialog.Color = Form1.circularProgressBar2.ProgressColor;
// Update the text box color if the user clicks OK
if (MyDialog.ShowDialog() == DialogResult.OK)
Form1.circularProgressBar2.ProgressColor = MyDialog.Color;
}
private void button3_Click(object sender, EventArgs e)
{
ColorDialog MyDialog = new ColorDialog();
// Keeps the user from selecting a custom color.
MyDialog.AllowFullOpen = false;
// Allows the user to get help. (The default is false.)
MyDialog.ShowHelp = true;
// Sets the initial color select to the current text color.
MyDialog.Color = Form1.circularProgressBar3.ProgressColor;
// Update the text box color if the user clicks OK
if (MyDialog.ShowDialog() == DialogResult.OK)
Form1.circularProgressBar3.ProgressColor = MyDialog.Color;
}
}
}
I fragment Form1:
private void ustawieniaWizualneToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2.ActiveForm.ShowDialog();
}
Niestety powyższe rozwiązanie nie funkcjonuje