CSHARPWINDOWSFORM Telegram 229
برمجة تطبيقات الويندوز C# Programming
بسم الله الرحمن الرحيم موضوع اليوم : عن كيف يتم تغيير لون صورة تضيفها من جهازك كما في الشكل
الشرح :

في البداية ستحتاج الى إضافة 2 أدوات pictureBox
pictureBox1 تحتوي على الصورة الاصلية بدون إضافة تأثيرات الألوان
pictureBox2 يتم حفظ الصورة مع التأثير الذي طرأ عليها

قم بتعديل خاصية Size Mode لكلا الاداتين السابقتين الى StretchImage
لكي يتم عرض الصورة بالكامل

قم بإضافة صورة لاداة صندوق الصور 1 اثناء التصميم وايضاً تستطيع إضافة صورة اثناء التنفيذ وذلك عنطريق أداة openFileDialog
ولاكن سوف نقوم باضافتها اثناء التصميم لكي نختصر الشرح والكود

الان قم بإضافة الكود التالي الى دالة الحدث Load التابعة للفورم

Bitmap bmp = new Bitmap(pictureBox1.Image);
int width = bmp.Width;
int height = bmp.Height;

Bitmap RedBmp = new Bitmap(bmp);

for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
//get pixel value
Color p = bmp.GetPixel(x, y);

//extract ARGB value from p
int a = p.A;
int r = p.R;
int g = p.G;
int b = p.B;



//set red image pixel
RedBmp.SetPixel(x, y, Color.FromArgb(a, r, 0, 0));
}
}
pictureBox2.Image = RedBmp;


لتغيير لون اخر غير الأحمر مثلا الأزرق
RedBmp.SetPixel(x, y, Color.FromArgb(a, 0, 0, b));



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

الشرح :

في البداية ستحتاج الى إضافة 2 أدوات pictureBox
pictureBox1 تحتوي على الصورة الاصلية بدون إضافة تأثيرات الألوان
pictureBox2 يتم حفظ الصورة مع التأثير الذي طرأ عليها

قم بتعديل خاصية Size Mode لكلا الاداتين السابقتين الى StretchImage
لكي يتم عرض الصورة بالكامل

قم بإضافة صورة لاداة صندوق الصور 1 اثناء التصميم وايضاً تستطيع إضافة صورة اثناء التنفيذ وذلك عنطريق أداة openFileDialog
ولاكن سوف نقوم باضافتها اثناء التصميم لكي نختصر الشرح والكود

الان قم بإضافة الكود التالي الى دالة الحدث Load التابعة للفورم

Bitmap bmp = new Bitmap(pictureBox1.Image);
int width = bmp.Width;
int height = bmp.Height;

Bitmap RedBmp = new Bitmap(bmp);

for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
//get pixel value
Color p = bmp.GetPixel(x, y);

//extract ARGB value from p
int a = p.A;
int r = p.R;
int g = p.G;
int b = p.B;



//set red image pixel
RedBmp.SetPixel(x, y, Color.FromArgb(a, r, 0, 0));
}
}
pictureBox2.Image = RedBmp;


لتغيير لون اخر غير الأحمر مثلا الأزرق
RedBmp.SetPixel(x, y, Color.FromArgb(a, 0, 0, b));

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




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

View MORE
Open in Telegram


Telegram News

Date: |

Hashtags A new window will come up. Enter your channel name and bio. (See the character limits above.) Click “Create.” Select “New Channel” The public channel had more than 109,000 subscribers, Judge Hui said. Ng had the power to remove or amend the messages in the channel, but he “allowed them to exist.” As the broader market downturn continues, yelling online has become the crypto trader’s latest coping mechanism after the rise of Goblintown Ethereum NFTs at the end of May and beginning of June, where holders made incoherent groaning sounds and role-played as urine-loving goblin creatures in late-night Twitter Spaces.
from us


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