CSHARPWINDOWSFORM Telegram 269
فمثلاً عندما تكلمنا عن الطريقة التي اختصرنا بها دوال الاحداث الخاصة بكل أداة وقمنا بعملهن جميعاً في دالة واحدة وقمنا بعمل شرط في switch لكي يتم المقارنة من خلال خاصية text لاداة التحكم ارجع الى السطر الذي به
"""" وإقراء الاسطر التي بعده

لنكمل شرحنا

قد يحتوي برنامجك على ازرار او أي أداة تحكم لايوجد بها نص وقد تكون صممت برنامجك بيحث تحتوي الاداوت على ايقونات وما الى ذلك وتريد ان تختصر كتابة دوال الاحداث مثل الطريقة التي شرحناها أعلاه

أولا قم بإضافة ثلاثة ازرار الى الفورم button1,button2,button3

قم بتحديد نص فريد للخاصية AccessibleName لكل الازرار

الان اكتب الاكواد التالية :


public Form1()
{
InitializeComponent();

button1.Click += new EventHandler(this.ButtonClicked);
button2.Click += new EventHandler(this.ButtonClicked);
button3.Click += new EventHandler(this.ButtonClicked);

}

private void ButtonClicked(object sender, EventArgs e)
{
Button btn = (Button)sender;
switch (btn.AccessibleName)
{
case"b1":
MessageBox.Show("I'm Button 1");
break;

case "b2":
MessageBox.Show("I'm Button 2");
break;

case "b3":
MessageBox.Show("I'm Button 3");
break;
default:
break;
}
}



نتوقف الى هنا سنكمل باقي العمليات لمحرر النصوص في وقت لاحق إن شاء الله....



tgoop.com/CsharpWindowsForm/269
Create:
Last Update:

فمثلاً عندما تكلمنا عن الطريقة التي اختصرنا بها دوال الاحداث الخاصة بكل أداة وقمنا بعملهن جميعاً في دالة واحدة وقمنا بعمل شرط في switch لكي يتم المقارنة من خلال خاصية text لاداة التحكم ارجع الى السطر الذي به
"""" وإقراء الاسطر التي بعده

لنكمل شرحنا

قد يحتوي برنامجك على ازرار او أي أداة تحكم لايوجد بها نص وقد تكون صممت برنامجك بيحث تحتوي الاداوت على ايقونات وما الى ذلك وتريد ان تختصر كتابة دوال الاحداث مثل الطريقة التي شرحناها أعلاه

أولا قم بإضافة ثلاثة ازرار الى الفورم button1,button2,button3

قم بتحديد نص فريد للخاصية AccessibleName لكل الازرار

الان اكتب الاكواد التالية :


public Form1()
{
InitializeComponent();

button1.Click += new EventHandler(this.ButtonClicked);
button2.Click += new EventHandler(this.ButtonClicked);
button3.Click += new EventHandler(this.ButtonClicked);

}

private void ButtonClicked(object sender, EventArgs e)
{
Button btn = (Button)sender;
switch (btn.AccessibleName)
{
case"b1":
MessageBox.Show("I'm Button 1");
break;

case "b2":
MessageBox.Show("I'm Button 2");
break;

case "b3":
MessageBox.Show("I'm Button 3");
break;
default:
break;
}
}



نتوقف الى هنا سنكمل باقي العمليات لمحرر النصوص في وقت لاحق إن شاء الله....

BY برمجة تطبيقات الويندوز C# Programming


Share with your friend now:
tgoop.com/CsharpWindowsForm/269

View MORE
Open in Telegram


Telegram News

Date: |

Select “New Channel” In handing down the sentence yesterday, deputy judge Peter Hui Shiu-keung of the district court said that even if Ng did not post the messages, he cannot shirk responsibility as the owner and administrator of such a big group for allowing these messages that incite illegal behaviors to exist. Some Telegram Channels content management tips How to Create a Private or Public Channel on Telegram? The initiatives announced by Perekopsky include monitoring the content in groups. According to the executive, posts identified as lacking context or as containing false information will be flagged as a potential source of disinformation. The content is then forwarded to Telegram's fact-checking channels for analysis and subsequent publication of verified information.
from us


Telegram برمجة تطبيقات الويندوز C# Programming
FROM American