Hack Forums
[C#] proper image alpha layer when form is invisible - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] proper image alpha layer when form is invisible (/showthread.php?tid=5557294)

Pages: Pages 1 2


proper image alpha layer when form is invisible - ๖ۣۜErexo - Feb 21, 2017

I'm looking for a way to have images on invisible form that allow alpha transparency and allow to place and use buttons/labels etc.

I've tried this Transparent background on winforms?, layered window and many more, nothing fully successful. I've ended up with such failures https://imgur.com/a/t6nmF
Other "solution" I found is to create additional form that's layered window i.imgur.com/Q231QPX.png Two forms complex into one application, will this work? how?
Any ideas ?


* - Zilog80 - Feb 21, 2017

Maybe something like this?:

Spoiler (Click to View)


* - iNCEPTiON_V - Feb 21, 2017

Use WPF for this, its very simple

1. Create a WPF Window
2. Set WindowStyle to "None"
3. Set AllowTransparency to "True"
4. Set Background to "Transparent"


* - ๖ۣۜErexo - Feb 21, 2017

(Feb 21, 2017 02:41 PM)Zilog80 Wrote:  Maybe something like this?:

Spoiler (Click to View)

Yeah, exactly like this.


(Feb 21, 2017 03:19 PM)iNCEPTiON_V Wrote:  Use WPF for this, its very simple

1. Create a WPF Window
2. Set WindowStyle to "None"
3. Set AllowTransparency to "True"
4. Set Background to "Transparent"

Will try
for some reason I dont have XAML editor on my PC so I cant do this


I've managed to do this in WPF and its working, but its hard to edit and do what I actually want. Any other suggestions?


* - ๖ۣۜErexo - Feb 23, 2017

anyone could help me with that ?


* - iNCEPTiON_V - Feb 24, 2017

(Feb 21, 2017 03:23 PM)๖ۣۜErexo Wrote:  Yeah, exactly like this.



Will try
for some reason I dont have XAML editor on my PC so I cant do this


I've managed to do this in WPF and its working, but its hard to edit and do what I actually want. Any other suggestions?

Youve done it . What exactly do you mean by its "hard to edit"?


* - Ninja - Feb 24, 2017

(Feb 24, 2017 02:17 AM)iNCEPTiON_V Wrote:  Youve done it . What exactly do you mean by its "hard to edit"?

I think he means hard to design or something like that.


* - iNCEPTiON_V - Feb 24, 2017

(Feb 24, 2017 06:55 AM)Ninja Wrote:  I think he means hard to design or something like that.

Ah ok thanks.
When you need help just ask I will help you with every wpf question


* - Zilog80 - Feb 25, 2017

As iNCEPTiON said this can be done in WPF in 4 seconds:

xaml:
Spoiler (Click to View)

'Drag trick' & result:
Spoiler (Click to View)

I encourage you to start moving to WPF, not only for dessign features.

Anyway if you want to stay in GDI/Winforms, my previous post image sample was done (4 years ago) in Winforms. Let me know and I will PMed you with info


* - ๖ۣۜErexo - Feb 25, 2017

I completly understand and I've done this, but the problem is I dont know how to add events to objects such as onClick, MouseMove etc (to make the program move when drag by image). Any good basic tutorial in how to switch from Windows Forms into WPF ?
Thanks for response guys.

@edit
okay I've managed to do some events, if I have any more questions I'll ask
[Image: H4k3DWv.png]


* - iNCEPTiON_V - Feb 25, 2017

Let's assume you have a Button.
You can either double click on it and the click event gets generated,
or you write it like this

Code
<Button Content="ClickMe" Click="YourFunction" />

and then in the code

Code
public void YourFunction(object sender, EventArgs e){
     //CODE
}

here some awesome links:
https://www.codeproject.com/Articles/140611/WPF-Tutorial-Beginning
https://www.codeproject.com/Articles/22980/WPF-A-Beginner-s-Guide-Part-of-n

Videos

https://www.youtube.com/playlist?list=PLKShHgmYjjFwmuUZ46GxeSTA2zKZF-8nv

https://www.youtube.com/playlist?list=PLKShHgmYjjFz_oV5bfFn9Sqo7loki0nWL

https://www.youtube.com/watch?v=SD3yVqpu4e4

Stick to WPF and you won't regret it!


* - ๖ۣۜErexo - Feb 25, 2017

Thanks alot for your reply!
Now I want to create a custom progress bar, I have two images, empty and filled. How to combine those two into progress bar? I've searched web for a while,
I've eventried to do this by layering two images. Do you have any idea?
[Image: WgLVvGR.jpg]


* - iNCEPTiON_V - Feb 25, 2017

Do you have discord so I can help you ?
Because this requires Styles and advanced WPF knowledge, i can do it for you.


* - ๖ۣۜErexo - Feb 25, 2017

(Feb 25, 2017 06:54 AM)iNCEPTiON_V Wrote:  Do you have discord so I can help you ?
Because this requires Styles and advanced WPF knowledge, i can do it for you.

Sadly no, I have ts3 (ntsw.pl) or jabber ([email protected])


* - iNCEPTiON_V - Feb 25, 2017

If you want you can send me your Project and i can edit for you.
Or i can provide some links how you can do that.