Page 1 of 1 1
Topic Options
#212381 - 2017-03-26 09:49 PM [help]Img trasparent[help]
AndreLuiz Offline
Getting the hang of it

Registered: 2015-10-07
Posts: 88
Loc: Brasil, João pessoa
Olá a todo eu queria saber como faço para exibir uma imagem .png, ou melhor queria saber como fazer para exibir imagens com fundo transparente no kixforms clássico.
Eu preciso muito disso para o meu projeto!
Obrigado desde já até.

[ENG]
Hello all I wanted to know how do I display an image .png, or rather wanted to know how to display transparent background images with no classic kixforms.
I really need this for my project!
Thank you from now until.

Top
#212383 - 2017-03-27 09:10 AM Re: [help]Img trasparent[help] [Re: AndreLuiz]
Schavuit Offline
Fresh Scripter

Registered: 2016-09-30
Posts: 14
Loc: South Korea
Are you trying to open an image? or trying to add an image to something?
Top
#212384 - 2017-03-27 01:22 PM Re: [help]Img trasparent[help] [Re: Schavuit]
AndreLuiz Offline
Getting the hang of it

Registered: 2015-10-07
Posts: 88
Loc: Brasil, João pessoa
Estou tentando exibir imagens com fundo transparente na minha picturebox, exemplo:

Quando uso um .ico com fundo transparente ai funciona certinho!

Porém quando uso uma imagem .png ele não carrega, só carrega imagens .bmp.
e até onde eu sei imagens .bmp não tem fundo transparente, então o que faço?

[ENG]
I'm trying to display transparent background images in my picturebox, example:

When I use a .ico with transparent background then it works fine!

But when I use a .png image it does not load, it only loads .bmp images.
And as far as I know images .bmp has no transparent background, so what do I do?

Top
#212385 - 2017-03-28 09:13 AM Re: [help]Img trasparent[help] [Re: AndreLuiz]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4665
Loc: The Netherlands
Kixforms classic does not support .png images. I might be missing something but in the 12+ years I've been using it I only used .bmp images because that is what is supported in KF classic.

Kixforms.NET does support other formats like .png with transparent background like shown below.

 Code:
....
$PictureBoxLogo = $System.PictureBox()
$PictureBoxLogo.BorderStyle = 0
$PictureBoxLogo.Left = 10
$PictureBoxLogo.Top = 10
$PictureBoxLogo.Height = 80
$PictureBoxLogo.Image = $System.Bitmap(@SCRIPTDIR + "\Images\logo.png")
$PictureBoxLogo.Width = 80
$nul = $FormMain.Controls.Add($PictureBoxLogo)
....
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#212386 - 2017-03-28 03:13 PM Re: [help]Img trasparent[help] [Re: Mart]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2097
Loc: Tulsa, OK
Just out of curiosity, have you tried a good old fashioned transparent GIF file? I could have sworn I'd gotten it to work in Classic before. But can't recall how.
Top
#212387 - 2017-03-28 04:49 PM Re: [help]Img trasparent[help] [Re: ShaneEP]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4665
Loc: The Netherlands
Never tried that before but I just did a small test with KF classic and all I get is an empty picturebox when setting a .gif with a transparent background. Maybe there is some kind of undocumented feature...... Up until now, I used KF.net when I needed/wanted to use images with a transparent background.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#212394 - 2017-03-30 03:17 PM Re: [help]Img trasparent[help] [Re: Mart]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2097
Loc: Tulsa, OK
Wish I had kixforms on my work computer, I could maybe help more. Perhaps just change the background of the image to match the color of the form?
Top
#212463 - 2017-04-26 09:05 PM Re: [help]Img trasparent[help] [Re: ShaneEP]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Hmmm
I once wrote a sample for a guy over on the now gone german kixforms forum with a logo that could
be moved over the form .. just don't remember if it had the same color as the background of the form or was transparent

Let me dig a bit, let's see if I kept that one
_________________________



Top
#212464 - 2017-04-26 09:17 PM Re: [help]Img trasparent[help] [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Well well,

not dug out yet, but this got the old synapses going... was using the .TransparentColor Property of, ehhhm, forgot the object* I used back then \:D ... let me dig more

edith: *object must be .ImageList \:\)


Edited by Jochen (2017-04-26 09:26 PM)
_________________________



Top
#212465 - 2017-04-26 09:56 PM Re: [help]Img trasparent[help] [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Got it..

The .bmp was converted to a base64 string for ease of demo (iirc there were no attachments possible on the german board). If you use a Bitmap from file you will have to alter the Code to $Bitmap = $System.Bitmap([path\]filename)


The Original bmp can be found attached (Notice the Black/White Symbol)
Be aware that the movable Icon was attached to a Toolbutton that does nothing. It was the only way I was able to get that transparent thing going \:D
The movability is just for fun and giggles and maybe educational purposes.

 Code:
Break on

$System = CreateObject("Kixtart.System")

$Bitmap = $System.Bitmap.FromBase64String(YingYangImageString())

$frm = $System.Form()
$frm.ClientSize = $System.Size(400, 300)
$frm.Text = "TransparentColor Demo"
$frm.BackColor = "KiXtart"

$ImageList = $System.ImageList()
$ImageList.ImageSize = 111, 109
$ImageList.TransparentColor = "white"
$ImageList.Images.AddStrip($Bitmap)

$btn1 = $frm.Toolbutton
$btn1.Size = 111, 109
$btn1.FlatStyle = 0
$btn1.BorderStyle = 0
$btn1.BackColor = "Transparent"
$btn1.Icon = $ImageList.Images(0)
$btn1.OnMouseDown = "$$x = $$btn1.MouseX $$y = $$btn1.MouseY"
$btn1.OnMouseMove = "MouseMove()"

$btn1.Center


$frm.Show

While $frm.Visible
 $=Execute($frm.DoEvents)
Loop 

Exit 1 

function YingYangImageString()
$YingYangImageString =

"Qk0OBwAAAAAAAD4AAAAoAAAAbwAAAG0AAAABAAEAAAAAAAAAAAAAAAAAAAAAAAIAAAACAAAA
AAAAAP///wD///////QAAf///////gAA//////+AAAAP//////4AAP/////4ACSAAf/////+
AAD/////wAf/8AA//////gAA/////wD///wAB/////4AAP////wH////AAH////+AAD////w
P////8AAf////gAA////wP/////gAB////4AAP///wP/////+AAP///+AAD///4P//////wA
A////gAA///4H//////+AAH///4AAP//8H///////wAA///+AAD//+D///////8AAH///gAA
///D////////gAAf//4AAP//h////////8AAH//+AAD//w/////////AAAf//gAA//4f////
////4AAD//4AAP/8P////////+AAAf/+AAD/+H/////////gAAH//gAA//D/////////8AAA
//4AAP/h/////Af///AAAH/+AAD/4/////gB///wAAA//gAA/8f////wAf//8AAAH/4AAP+H
////4AD///gAAB/+AAD/j////+AAf//4AAAP/gAA/x/////AAH//+AAAB/4AAP4f////wAB/
//gAAAf+AAD+P////8AAf//4AAAD/gAA/D/////AAH//+AAAA/4AAPx/////4AB///gAAAH+
AAD4/////+AA///wAAAB/gAA+P/////wAP//8AAAAP4AAPH/////8AH///AAAAD+AADx////
//wD///wAAAAfgAA4///////L///4AAAAH4AAOP//////////+AAAAA+AADj///////////g
AAAAPgAAx///////////wAAAAD4AAMf//////////8AAAAAeAADH//////////+AAAAAHgAA
j///////////gAAAAB4AAI///////////wAAAAAeAACP//////////4AAAAADgAAj///////
///+AAAAAA4AAJ///////////AAAAAAOAAAf//////////gAAAAADgAAH//////////wAAAA
AA4AAB//////////wAAAAAAOAAAf/////////4AAAAAABgAAH/////////4AAAAAAAYAAB//
///////4AAAAAAAGAAAf////////4AAAAAAABgAAH////////wAAAAAAAAYAAB////////AA
AAAAAAAGAAA///////gAAAAAAAAABgAAH//////AAAAAAAAAAAYAAB//////AAAAAAAAAAAG
AAAf/////AAAAAAAAAAABgAAH/////AAAAAAAAAAAAYAAB/////gAAAAAAAAAAAGAAAf////
wAAAAAAAAAAADgAAH////4AAAAAAAAAAAA4AAB////4AAAAAAAAAAAAOAACf///+AAAAAAAA
AAAADgAAj////AAAAAAAAAAAAA4AAI////gAAAAAAAAAAAAOAACP///4AAAAAAAAAAAAHgAA
j///8AAAAAAAAAAAAB4AAMf///AAAAAAAAAAAAAeAADH///gAAAAAAAAAAAAHgAAx///4AAA
AAAAAAAAAD4AAOP//8AAAAAAAAAAAAA+AADj///AAAAAAAAAAAAAPgAA4///wAAA/gAAAAAA
AH4AAPH//4AAA/8AAAAAAAB+AADx//+AAAP/gAAAAAAAfgAA8P//gAAH/8AAAAAAAP4AAPj/
/4AAD//AAAAAAAD+AAD4f/+AAA//4AAAAAAB/gAA/H//gAAP/+AAAAAAAf4AAP4//4AAD//g
AAAAAAP+AAD+P/+AAA//4AAAAAAD/gAA/h//gAAP/8AAAAAAB/4AAP8P/4AAB//AAAAAAA/+
AAD/j/+AAAf/gAAAAAAP/gAA/8f/wAAD/4AAAAAAH/4AAP/D/8AAAf4AAAAAAD/+AAD/4f/A
AAA4AAAAAAA//gAA//H/wAAAAAAAAAAAf/4AAP/4f+AAAAAAAAAAAP/+AAD/+H/gAAAAAAAA
AAH//gAA//wf8AAAAAAAAAAD//4AAP/+H/AAAAAAAAAAB//+AAD//wf4AAAAAAAAAA///gAA
//+D+AAAAAAAAAAf//4AAP//4fwAAAAAAAAAP//+AAD///D+AAAAAAAAAH///gAA///4PwAA
AAAAAAD///4AAP///A+AAAAAAAAD///+AAD///8HwAAAAAAAB////gAA////geAAAAAAAB//
//4AAP///+B4AAAAAAA////+AAD////4HAAAAAAA/////gAA/////gMAAAAAA/////4AAP//
//+AAAAAAA/////+AAD/////4AAAAAB//////gAA//////wAAAAD//////4AAP//////wAAA
P//////+AAD///////9AF////////gAA"

endfunction

Function MouseMove()

   If $btn1.MouseButton = 1
      $frm.BeginUpdate
      $btn1.Location  = $frm.MouseX - $x , $frm.MouseY - $y
      $frm.EndUpdate
   EndIf

EndFunction


Hope this helps a little bit


Attachments
yingyang.bmp.zip (513 downloads)
Description: Original Logo (Background) File


_________________________



Top
Page 1 of 1 1


Moderator:  ShaneEP, Mart, Radimus, Jochen, Allen, Glenn Barnas 
Hop to:
Shout Box

Who's Online
0 registered and 170 anonymous users online.
Newest Members
vertage, dimi575, Drecksnacken, Nlill, webtools321
17735 Registered Users

Generated in 0.047 seconds in which 0.015 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org