C# Kapat butonunu pasifleştirmek

FORUMSAL.NET YENİDEN ERİŞİME AÇILDI ForumSAL · Bilgilendirme

Yaşanan süreçte sabır gösteren ve yanımızda olan tüm üyelerimize teşekkür ederiz. Alternatif adreslerimiz üzerinden de bize ulaşabilirsiniz.

Alternatif erişim adreslerimiz
⚪ Konu yazarı en son 3444 gün önce aktifti
Uygulamanızın menu çubuğunda bulunan (X) kapat butonunu pasifleştirmek


Kod:
private const int SC_CLOSE = 0xF060;
          private const int MF_GRAYED = 0x1;
 
          [DllImport("user32.dll")]
          private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
 
          [DllImport("user32.dll")]
          private static extern int EnableMenuItem(IntPtr hMenu, int wIDEnableItem, int wEnable);
 
          private void Form1_Load(object sender, System.EventArgs e)
          {
               EnableMenuItem(GetSystemMenu(this.Handle, false), SC_CLOSE, MF_GRAYED);
          }
 
İşinize karışmak gibi olmasın fakat aşağıdaki daha basit değil mi? :emoji_scream:
Kod:
this.ControlBox = false;
 
Geri