View Full Version : غیر فعال کردمه بستن فرم
farhad85
دوشنبه 09 تیر 1393, 13:06 عصر
با سلام چطور میتونم دکمه بستن فرم رو(×) رو غیر فعال کنم؟ ممنون از همه
RmeXXXXXXXXX
دوشنبه 09 تیر 1393, 13:23 عصر
دکمه خروج نمیدونم چطوری غیر فعال میشه!
در عوض:
میتونین خاصیت ControlBox فرم را تغییر بدین تا کلاً همه کنترل های نوار عنوان مخفی بشن.
ولی بصورت برنامه نویسی میتونین اینچنین از بستن فرم جلوگیری کنین: "رویداد: در حال بستن فرم"
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
// exit cancel easy way!
//e.Cancel = true;
// ask to exit
e.Cancel =MessageBox.Show("Do you want to exit?", "Exit dialog", MessageBoxButtons.YesNo
== System.Windows.Forms.DialogResult.No;
}
aliagamon
دوشنبه 09 تیر 1393, 14:39 عصر
اگه درست فهمیده باشم:
Private Const CP_NOCLOSE_BUTTON As Integer = &H200
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim myCp As CreateParams = MyBase.CreateParams
myCp.ClassStyle = myCp.ClassStyle Or CP_NOCLOSE_BUTTON
Return myCp
End Get
End Property
End Class
a_mohammadi_m
سه شنبه 10 تیر 1393, 10:51 صبح
این مثال رو ببینید
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=9356&lngWId=10
و
https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=774&lngWId=10
Aryan.Software
پنج شنبه 12 تیر 1393, 16:02 عصر
فقط کافیه در رویداد FormClosing فرم این کد رو بنویسید:
e.Cancel=True
ینی در واقع اینجوری میشه:
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
e.Cancel = True
End Sub
این کد هم سوال میپرسه قبل بسته شدن:
AskForExit = MsgBox("Do you want to close the app?", vbYesNo + vbQuestion, "Exit")
If AskForExit = vbNo Then
e.Cancel = True
End If
farhad85
شنبه 14 تیر 1393, 05:46 صبح
فقط کافیه در رویداد FormClosing فرم این کد رو بنویسید:
1
e.Cancel=True
ینی در واقع اینجوری میشه:
1
2
3
4
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
e.Cancel = True
End Sub
این کد هم سوال میپرسه قبل بسته شدن:
1
2
3
4
5
AskForExit = MsgBox("Do you want to close the app?", vbYesNo + vbQuestion, "Exit")
If AskForExit = vbNo Then
e.Cancel = True
End If
ممنون مختصر ومفید
vBulletin® v4.2.5, Copyright ©2000-1403, Jelsoft Enterprises Ltd.