using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;
Sorun Çözmeye Geldik
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Grafik_nesnesi_ile_yazı_yaz
{
Bu uygulamada Form1 de button 1 e tıklayarak Form2 pencere açma uygulaması yapacağız. Bunun için öncelikle Form1 penceresine bir tan buton ekliyoruz. Bu butonun Click olayına Form2 nesnenin bir örneğini alıyotuz. Bu nesne ile gerekli özellikleri ayarladıktan sonar Show metodunu kullanarak Form2 penceresinin gösterilmesini sağlıyoruz. Burada amacımız Form1 den Form2 açtırıp Form1 penceresini kapatmak ve Form2 den tekrar Form1 penceresini açtırıp Form2 penceresini kapatmak. Bunu yapabilmek için Form sınıfından Form1 sınıfına erişmemiz gerekiyor. Bu erişimi Form2 sınıfına ParentForm özelliğini ekleyerek yapıyoruz. ParentForm özelliğine Form1 nesnesinin referansını vereceğiz. Böylece Form2 den Form1 nesnesine erişmiş olacağız. Form2 penceresine de bir buton ekliyoruz. Bu butonın Click olayına Form1 nesnesini ParentForm.Show() metodu ile tekrar görünür yapıyoruz. this.Close metodu ile de Form2 pencerisini kapatıyoruz. Form2 açıldığında Form1 penceresini kapatmak içinde Form2_Load metodunda ParentForm.Hide() metodunu kullanıcağız . Böylece Form2 penceresi açılırken Form1 penceresini kapatmış yani gizlemiş olacağız. /// Form1.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading;