CSHARPWINDOWSFORM Telegram 227
برمجة تطبيقات الويندوز C# Programming
بسم الله نبدا شرح موضوع الشكل السابق بعد ان تقوم بإنشاء مشروع اذهب الى قائمة الاحداث للفورم الحدث Paint اضغط عليه double Click قم بكتابة الكود التالي داخل دالة الحدث private void Form4_Paint(object sender, PaintEventArgs e) { int…
تابع الشرح

ملاحظة :

ماذا لو انت تريد ان تضع اكثر من نص في الفورم هل سوف تقوم بتكرار الكود اكثر من مرة بهذا الشكل

private void Form4_Paint(object sender, PaintEventArgs e)
{

int x = 40, y = 50;


Font f = new Font("Andalus", 20, FontStyle.Bold);
e.Graphics.RotateTransform(40);
e.Graphics.TranslateTransform(x, y, System.Drawing.Drawing2D.MatrixOrder.Append);
e.Graphics.DrawString("Hello", f, Brushes.Green, x, y);



x += 50;

e.Graphics.RotateTransform(50);
e.Graphics.TranslateTransform(x, y, System.Drawing.Drawing2D.MatrixOrder.Append);
e.Graphics.DrawString("Wellcome", f, Brushes.Green, x, y);

}
الطريقة تعتبر صحيحه بس سوف تجعل الكود الخاص بك كثييير وتتعب نفسك بهذه الطريقة ما رايك ان تقوم باختصار الكود وتقوم بعمل دالة تؤدي هذه المهمه
مثال :

public void Draw(Graphics g ,int a,string str,int x,int y,Font f , Brush b)
{
System.Drawing.Drawing2D.GraphicsState state = g.Save();
g.RotateTransform(a);
g.TranslateTransform(x, y, System.Drawing.Drawing2D. MatrixOrder.Append);
g.DrawString(str, f, b, 0, 0);

g.Restore(state);
}

private void Form4_Paint(object sender, PaintEventArgs e)
{

int x = 40, y = 50;


Font f = new Font("Andalus", 20, FontStyle.Bold);

Draw(e.Graphics, 50, "YEMEN", x, y, f, Brushes.Green);
x += 50;
Draw(e.Graphics, 60, "C# Windows Forms", x, y, f, Brushes.Red);
x += 100; y += 50;
Draw(e.Graphics, 60, "Hello World", x, y, f = new Font("Traditional Arabic", 20), Brushes.Blue);
}
لاحظ كيف قمنا بعمل دالة تحمل وسائط التي استخدمناها في الكود السابق
الكلاس GraphicsState يحفظ الحالة الحالية لهذه الرسومات ويحدد الحالة المحفوظة باستخدام GraphicsState.


انتهى ................

https://www.tgoop.com/CsharpWindowsForm
👍1



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

تابع الشرح

ملاحظة :

ماذا لو انت تريد ان تضع اكثر من نص في الفورم هل سوف تقوم بتكرار الكود اكثر من مرة بهذا الشكل

private void Form4_Paint(object sender, PaintEventArgs e)
{

int x = 40, y = 50;


Font f = new Font("Andalus", 20, FontStyle.Bold);
e.Graphics.RotateTransform(40);
e.Graphics.TranslateTransform(x, y, System.Drawing.Drawing2D.MatrixOrder.Append);
e.Graphics.DrawString("Hello", f, Brushes.Green, x, y);



x += 50;

e.Graphics.RotateTransform(50);
e.Graphics.TranslateTransform(x, y, System.Drawing.Drawing2D.MatrixOrder.Append);
e.Graphics.DrawString("Wellcome", f, Brushes.Green, x, y);

}
الطريقة تعتبر صحيحه بس سوف تجعل الكود الخاص بك كثييير وتتعب نفسك بهذه الطريقة ما رايك ان تقوم باختصار الكود وتقوم بعمل دالة تؤدي هذه المهمه
مثال :

public void Draw(Graphics g ,int a,string str,int x,int y,Font f , Brush b)
{
System.Drawing.Drawing2D.GraphicsState state = g.Save();
g.RotateTransform(a);
g.TranslateTransform(x, y, System.Drawing.Drawing2D. MatrixOrder.Append);
g.DrawString(str, f, b, 0, 0);

g.Restore(state);
}

private void Form4_Paint(object sender, PaintEventArgs e)
{

int x = 40, y = 50;


Font f = new Font("Andalus", 20, FontStyle.Bold);

Draw(e.Graphics, 50, "YEMEN", x, y, f, Brushes.Green);
x += 50;
Draw(e.Graphics, 60, "C# Windows Forms", x, y, f, Brushes.Red);
x += 100; y += 50;
Draw(e.Graphics, 60, "Hello World", x, y, f = new Font("Traditional Arabic", 20), Brushes.Blue);
}
لاحظ كيف قمنا بعمل دالة تحمل وسائط التي استخدمناها في الكود السابق
الكلاس GraphicsState يحفظ الحالة الحالية لهذه الرسومات ويحدد الحالة المحفوظة باستخدام GraphicsState.


انتهى ................

https://www.tgoop.com/CsharpWindowsForm

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




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

View MORE
Open in Telegram


Telegram News

Date: |

Judge Hui described Ng as inciting others to “commit a massacre” with three posts teaching people to make “toxic chlorine gas bombs,” target police stations, police quarters and the city’s metro stations. This offence was “rather serious,” the court said. Today, we will address Telegram channels and how to use them for maximum benefit. How to Create a Private or Public Channel on Telegram? As five out of seven counts were serious, Hui sentenced Ng to six years and six months in jail. On Tuesday, some local media outlets included Sing Tao Daily cited sources as saying the Hong Kong government was considering restricting access to Telegram. Privacy Commissioner for Personal Data Ada Chung told to the Legislative Council on Monday that government officials, police and lawmakers remain the targets of “doxxing” despite a privacy law amendment last year that criminalised the malicious disclosure of personal information.
from us


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