Don't do it.
Your controls should reflect the state of business objects (whether through formal data binding or, for a simple case, through setting properties in event handlers). In a really simple application (one form) the 'business objects' can be local fields of the form. Then, in other places (such as the event handler for the button you are talking about), you can look up into those same objects.
The simplest modification of your provided code towards this ideal is:
private bool isSaved = false;
private void button1_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.InitialDirectory = @"C:\";
saveFileDialog1.DefaultExt = ".bmp";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
ImOrtamCizdir.genelBmpNesnesi.Save(saveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Bmp);
}
isSaved = true;
}
private void button2_Click(object sender, EventArgs e)
{
if(isSaved)
{
}
KontrolleriAc();
bmp = new Bitmap(p_box_map.Width, p_box_map.Height);
ImOrtamCizdir ortamcizdir = new ImOrtamCizdir(p_box_map, bmp, ZoomKontrolCarpan);
bmp.RotateFlip(RotateFlipType.Rotate180FlipX);
lbxKucultmeOranlari.Items.Add("scale_factor_x :" + ortamcizdir.ScaleFactorY);
lbxKucultmeOranlari.Items.Add("scale_factor_y :" + ortamcizdir.ScaleFactorX);
lbxKucultmeOranlari.Items.Add(ortamcizdir.ScaleFactor);
}
In a real application you'd want to store the file name, bind that to the titlebar of the form and so on – and you'd probably want that information to be somewhere other than in your main form. Sometimes I create an 'App', 'DataModel' or 'GlobalState' class to make it really explicit what is state information; other times I will have a 'Project' class or similar which manages the data and logic relating to a single file, and that can store the state information.
In general, having direct dependencies on UI controls for any kind of non-UI logic is a
really bad idea. You should be able to redesign the UI, or reuse the core code as a back end library with no UI, and creating dependencies like this stops you from doing that and results in 'spaghetti code' problems.