9 Replies - 14462 Views - Last Post: 21 October 2009 - 06:28 AM Rate Topic: -----

#1 tom1597530  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 16-October 09

VB6: Making background of an image transparent

Post icon  Posted 16 October 2009 - 11:20 AM

Please, be tolerant, I am 13 years old and I am not English. I am Slovak. I am practicing VB6 and can you please tell me, how can I make a white background of an Image trasparent? I am making a game and it doesnn't look good. It doesn't matter how will you help me. I know, that you aren't giving code, but i will be very thankful, or a link where is it written or something, what will help me. Thank you.
Is This A Good Question/Topic? 0
  • +

Replies To: VB6: Making background of an image transparent

#2 vb5prgrmr  Icon User is offline

  • D.I.C Lover

Reputation: 109
  • View blog
  • Posts: 1,016
  • Joined: 21-March 09

Re: VB6: Making background of an image transparent

Posted 16 October 2009 - 06:28 PM

See http://vbaccelerator...ges/article.asp



Good Luck
Was This Post Helpful? 0
  • +
  • -

#3 tom1597530  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 16-October 09

Re: VB6: Making background of an image transparent

Posted 17 October 2009 - 01:00 AM

View Postvb5prgrmr, on 16 Oct, 2009 - 05:28 PM, said:


Thank you very much, but when I copy the code to th Module, this part:
			BitBlt lhDC, 0, 0, _
				picFrom.ScaleWidth \ Screen.TwipsPerPixelX,
				picFrom.ScaleHeight \ Screen.TwipsPerPixelY, _
				picFrom.hDC, 0, 0, SRCCOPY

becomes red and when I try it, it will show Syntax error. Can you please help me, how to solve that problem?
Was This Post Helpful? 0
  • +
  • -

#4 vb5prgrmr  Icon User is offline

  • D.I.C Lover

Reputation: 109
  • View blog
  • Posts: 1,016
  • Joined: 21-March 09

Re: VB6: Making background of an image transparent

Posted 17 October 2009 - 04:39 AM

it should be...
BitBlt lhDC, 0, 0, _
	  picFrom.ScaleWidth \ Screen.TwipsPerPixelX, _
	  picFrom.ScaleHeight \ Screen.TwipsPerPixelY, _
	  picFrom.hDC, 0, 0, SRCCOPY



It seems the code you copied is missing a line continuation character (_) or you could make it all one line...
BitBlt lhDC, 0, 0, picFrom.ScaleWidth \ Screen.TwipsPerPixelX, picFrom.ScaleHeight \ Screen.TwipsPerPixelY, picFrom.hDC, 0, 0, SRCCOPY





Good Luck
Was This Post Helpful? 0
  • +
  • -

#5 tom1597530  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 16-October 09

Re: VB6: Making background of an image transparent

Posted 17 October 2009 - 07:56 AM

Ok, but it only creates a mask. I tryied to use these colors: white, black, cyan, yellow and orange and I wanted the white to be transparent so I set the backcolor to white. But, when I try it, it WILL set the white transparent, but everything else becomes BLACK. How can I make ONLY the white transparent and all other colors as they were before???
Was This Post Helpful? 0
  • +
  • -

#6 giuseppe105  Icon User is offline

  • D.I.C Regular

Reputation: 9
  • View blog
  • Posts: 444
  • Joined: 15-May 08

Re: VB6: Making background of an image transparent

Posted 17 October 2009 - 12:53 PM

you need to draw your original image now all that code is doing is drawing the mask. draw your image on top of the mask now.
Was This Post Helpful? 0
  • +
  • -

#7 tom1597530  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 16-October 09

Re: VB6: Making background of an image transparent

Posted 17 October 2009 - 11:37 PM

But how? I tried to make another PictureBox and I moved it on top of Picturebox2 and Picturebox1, I made Image1. Please can you tell me more accurately, how can I finish it? Please :)
Was This Post Helpful? 0
  • +
  • -

#8 tom1597530  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 16-October 09

Re: VB6: Making background of an image transparent

Posted 20 October 2009 - 06:51 AM

THERE IS NOONE, WHO CAN HELP ME, I REALLY NEED THIS INFO, PLEASE HELP ME, SOMEONE I AM AMATEUR I DON'T KNOW HOW TO MAKE IT, I AM PLANNIG TO BUY SOME BOOKS BUT BEFORE THAT, I WANT TO LEARN THE BASICS + THIS INFO. PLEASEEEEEEEEEE I WILL BE VERY THANKFUL, REALLY.
Was This Post Helpful? 0
  • +
  • -

#9 vb5prgrmr  Icon User is offline

  • D.I.C Lover

Reputation: 109
  • View blog
  • Posts: 1,016
  • Joined: 21-March 09

Re: VB6: Making background of an image transparent

Posted 21 October 2009 - 12:57 AM

There are just so many ways in which to do this... Make your image a gif..

use regions...
http://www.vbforums....d.php?p=1992354



Good Luck
Was This Post Helpful? 0
  • +
  • -

#10 tom1597530  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 16-October 09

Re: VB6: Making background of an image transparent

Posted 21 October 2009 - 06:28 AM

OMG! It works, now! Thank you very much, you can't know how happy I am. Once again...thanx
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1