I want to use the code provided here (http://www.codeproject.com/KB/GDI-plus/LovelyGoldFishDeskPet.a开发者_JS百科spx) to make a form background semitransparent using an alpha image. But I don't know how to implement the code. Can you help me, I just started my C# 3 hours ago. Please guide me.
Edit 1:
Look at the border of the inner image. I want my border to be like that.
I believe I know what you are trying to do now. The code you were attempting to use is GDI+ based and uses Win32 calls...
If you can avoid that, then you definitely should. The reason it probably won't build is because you havent included "using Microsoft.Win32" or something similar.
Either way, if transparent forms are what you are after there is a MUCH easier way that is supported by WinForms.
As per this article, the trick is to set a forms transparency key to the same thing as the forms back colour.
Try this in your FishForm() or equivilant constructor:
this.TransparencyKey = this.BackColor;
I'm pretty sure that will do the trick!
In the FishForm() function try placing:
this.Opacity = 0.5;
Inside. Normally that works, but I don't know how it will interact with the other drawing you have going on.
精彩评论