AndreLuiz
(Getting the hang of it)
2017-03-26 09:49 PM
[help]Img trasparent[help]

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.


Schavuit
(Fresh Scripter)
2017-03-27 09:10 AM
Re: [help]Img trasparent[help]

Are you trying to open an image? or trying to add an image to something?

AndreLuiz
(Getting the hang of it)
2017-03-27 01:22 PM
Re: [help]Img trasparent[help]

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?


Mart
(KiX Supporter)
2017-03-28 09:13 AM
Re: [help]Img trasparent[help]

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)
....


ShaneEP
(MM club member)
2017-03-28 03:13 PM
Re: [help]Img trasparent[help]

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.

Mart
(KiX Supporter)
2017-03-28 04:49 PM
Re: [help]Img trasparent[help]

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.

ShaneEP
(MM club member)
2017-03-30 03:17 PM
Re: [help]Img trasparent[help]

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?

JochenAdministrator
(KiX Supporter)
2017-04-26 09:05 PM
Re: [help]Img trasparent[help]

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


JochenAdministrator
(KiX Supporter)
2017-04-26 09:17 PM
Re: [help]Img trasparent[help]

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 \:\)


JochenAdministrator
(KiX Supporter)
2017-04-26 09:56 PM
Re: [help]Img trasparent[help]

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