c# - exclude a part of an image by taking color -


my problem quite simple, can't deal it. have yin-yang.jpg file , i'd round shape (without rest of rectangle, should not clickable) , more whole white color change red 1 , parts black color should excluded image (not clickable).

that image background of form, i'd show @ start of application.

private void hello_form_paint(object sender, painteventargs e)     {         form f = (form)sender;         f.backgroundimage = global::tictactoe.properties.resources.ying_yang1;         graphicspath formpath = new graphicspath();         rectangle newrectangle = f.clientrectangle;         e.graphics.drawellipse(system.drawing.pens.black, newrectangle);         newrectangle.inflate(-5, -5);         formpath.addellipse(newrectangle);         f.region = new region(formpath);      } 

paint event on form show makes them round, it's not things have do. how exclude black part background , how change white part red one?

given you've described may find:

http://msdn.microsoft.com/en-us/library/system.drawing.bitmap.maketransparent(v=vs.71).aspx

bitmap.maketransparent() useful method explore, allows turn given colour in image transparent.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -