Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


VB.NET Homework problem :S

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
angerist
Grandmaster Cheater Supreme
Reputation: 0

Joined: 18 Jun 2007
Posts: 1011
Location: Australia.

PostPosted: Thu Aug 06, 2009 6:27 am    Post subject: VB.NET Homework problem :S Reply with quote

Well I have an assignment for General Programming for school. Our assignment is to make a game. I've thought up a game called target practice where you use angles to shoot the target that pops up in random spots on the form. But it seems that I've got stuck way earlyier then I expected to.

If you look at the screenshot the picture of the man ("Kevin Rudd LOL") is transparent but the problem is the bits that are transparent go right back to the grey form. When I want them to go to the picture box behind kevin rudd. I hope that makes sense. You'll understand when you see the screenshot.

I forgot to mention that grey is the transparent key on the form.

Please shed some knowledge on this subject Smile

Screenie:

_________________
Back to top
View user's profile Send private message
Snootae
Grandmaster Cheater
Reputation: 0

Joined: 16 Dec 2006
Posts: 969
Location: --->

PostPosted: Thu Aug 06, 2009 6:49 am    Post subject: Reply with quote

short answer, vb says no

i have tested this before, it doesnt like the fact that there are controls underneath, if its set to transperant it just uses the form colour, so id say you need to photoshop that sucker

_________________
Back to top
View user's profile Send private message
shhac
Expert Cheater
Reputation: 0

Joined: 30 Oct 2007
Posts: 108

PostPosted: Thu Aug 06, 2009 12:16 pm    Post subject: Reply with quote

VB hates alpha channels Sad
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Thu Aug 06, 2009 4:36 pm    Post subject: Reply with quote

that's why you should use directdraw or direct3d with vb. It runs pretty well (surprisingly). (You should use Direct3D since directdraw doesn't support alpha channels or at least I can't find them...)
Back to top
View user's profile Send private message
angerist
Grandmaster Cheater Supreme
Reputation: 0

Joined: 18 Jun 2007
Posts: 1011
Location: Australia.

PostPosted: Fri Aug 07, 2009 1:55 am    Post subject: Reply with quote

So what would be the most logical way around this. It's really difficult to get the gradient on the target to match the gradient on the background image so photoshop isn't really an option. Some snippets would be really helpful but I know that's a lot to ask.

EDIT: I've been doing some research I found this.


http://msdn.microsoft.com/en-us/library/dd183370%28VS.85%29.aspx
Quote:
BitBlt Function

The BitBlt function performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context.

_________________
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Fri Aug 07, 2009 10:17 am    Post subject: Reply with quote

angerist wrote:
So what would be the most logical way around this. It's really difficult to get the gradient on the target to match the gradient on the background image so photoshop isn't really an option. Some snippets would be really helpful but I know that's a lot to ask.

EDIT: I've been doing some research I found this.


http://msdn.microsoft.com/en-us/library/dd183370%28VS.85%29.aspx
Quote:
BitBlt Function

The BitBlt function performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context.


Ahh Yes, GDI32. I wrote a class to use this but lost it... I'm pretty sure you can find in on planetsourcecode.
Back to top
View user's profile Send private message
sven3107
Expert Cheater
Reputation: 0

Joined: 04 Feb 2009
Posts: 118
Location: Belgium

PostPosted: Fri Aug 07, 2009 10:26 am    Post subject: Reply with quote

I know that C# has a class "System.Drawing.Drawing2D.ColorBlend".

I doubt it will be of any use though. :\
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Polynomial
Grandmaster Cheater
Reputation: 5

Joined: 17 Feb 2008
Posts: 524
Location: Inside the Intel CET shadow stack

PostPosted: Sat Aug 08, 2009 10:55 am    Post subject: Reply with quote

Best thing to do is use a tranparent PNG. Load the image up in Photoshop, select the grey background section, then delete it. It'll show up as transparency. Go to File -> Save As, set the file type to PNG. Make sure that you enable transparency, leave interlacing as none.

Make sure you set the background colour of the picture box to Transparent.
Back to top
View user's profile Send private message
angerist
Grandmaster Cheater Supreme
Reputation: 0

Joined: 18 Jun 2007
Posts: 1011
Location: Australia.

PostPosted: Sun Aug 09, 2009 1:27 am    Post subject: Reply with quote

Dude the image isn't grey. The form colour is grey. The image already is transparent.
_________________
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Sun Aug 09, 2009 2:06 am    Post subject: Reply with quote

Using the .NET drawing class is probably the smartest way in this case... but I've never used GDI+ so I'm not sure if there's a nice, native way of ignoring a certain color.

There seems to be a method for locking the bits to the image though. I suppose you can manually iterate through each pixel and ignore what should be transparent, but this may be overkill and out of your scope.



Looking through MSDN though it looks like you should be able to just create a Bitmap object, set the PixelFormat to 32 ARGB, set the transparency key with the MakeTransparent method and draw it.
Back to top
View user's profile Send private message
angerist
Grandmaster Cheater Supreme
Reputation: 0

Joined: 18 Jun 2007
Posts: 1011
Location: Australia.

PostPosted: Wed Aug 12, 2009 4:46 am    Post subject: Reply with quote

I'll look into that. Even though almost everything is out of my scope. I'm not a big fan of vb.net. But yeah I'll keep researching. Any snippets that you can give me would be nice Smile.
_________________
Back to top
View user's profile Send private message
Luigi
Grandmaster Cheater Supreme
Reputation: 1

Joined: 24 Mar 2008
Posts: 1082

PostPosted: Wed Aug 19, 2009 2:26 pm    Post subject: Reply with quote

Snootae wrote:
short answer, vb says no

i have tested this before, it doesnt like the fact that there are controls underneath, if its set to transperant it just uses the form colour, so id say you need to photoshop that sucker
You most certainly can use transparent. I made a useless program that was completely transparent excluding text. It's just like glass (HURR DURR)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites