hi,
i need help with code in winform c# ,
Please refer the attached image.
i want to fill the texture white image dynamically select the area and blend or add to image in that selected area.
please help with code
hi,
i need help with code in winform c# ,
Please refer the attached image.
i want to fill the texture white image dynamically select the area and blend or add to image in that selected area.
please help with code
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jayraj ChhayaRank #304 · 8.2K reputationPosted Apr 11, 2024, 8:31 AM EDT
You can use the following steps:
// Assuming you have the base image loaded in pictureBoxBase and the selected area coordinates in selectedArea Bitmap baseImage = new Bitmap(pictureBoxBase.Image); Graphics g = Graphics.FromImage(baseImage); // Create a white texture image Bitmap whiteTexture = new Bitmap(selectedArea.Width, selectedArea.Height); using (Graphics gTexture = Graphics.FromImage(whiteTexture)) { gTexture.FillRectangle(Brushes.White, 0, 0, selectedArea.Width, selectedArea.Height); } // Blend the white texture onto the selected area g.DrawImage(whiteTexture, selectedArea); // Update the PictureBox with the modified image pictureBoxBase.Image = baseImage;