PDA

View Full Version : [VB.Net] Gestione Trasparenze Label


M\'b
11-04-2004, 20:46
Salve!

Sto migrando da Vb 6 a Vb.Net, e per certe cose sono ancora 1 poco imbranato :D ... ma per fortuna esiste il forum! :)

Problema: in Vb 6 era prassi comume creare belle spalsh iniziali all'avvio del programma, quindi immagina super-mega ganza e label per il nome applicazione, versione programma, note legali etc etc.

Per fare questo, ovviamente, le label andavano impostate con la propriete "BackStile = 0 - Transparent"

Il problemino è la gestione della trasparenza in .NET! La proprietà BackStile non esiste più, e se si ricorre al help in linea per saperne di più, suggerisce di impostare il colore transparent con:

System.Drawing.Color.Transparent

ma l'help stesso fa osservare quanto segue: "In questo modo l'immagine di sfondo risulterà trasparente ma non rispetto ad altri controlli."

Difatti Image di sfondo con label impostata come sopra non rendono lo stesso effetto della proprietà BackStile di Vb6, ma un pseudo color grigio.

A questo punto non capisco: davvero in Vb.Net non è possibile impostare una trasparenza rispetto al controllo sottostante? :eek: Oppure mi sfugge qualche cosa?

Grazie, e scusate la lungaggine...

Ciao.Net :oink:

M\'b
14-04-2004, 20:48
Mi vien 1 dubbio...

Domanda troppo ardua oppure domanda troppo stupida? :confused: ;)


Il dubbio, come la speranza, resta....

Hi!

Geen
15-04-2004, 13:11
E' un problema conosciuto,bisogna girarci attorno per ora.
La soluzione e' tratta da internet,quindi non garantisco il funzionamento

I'm trying to make the background of my linklabel transparent so a picturebox will show through it. However, if I set the link label's BackColor property to Transparent the label still has a white background. Why?


Controls with a "Transparent" color actually render their parent's background, so you're seeing the White background of the Form, not the PictureBox. Three easy ways to deal with this:

* Use a Panel with it's "BackgroundImage" property set instead of a PictureBox, and parent the LinkLabels to the panel (PictureBoxes generally don't have children)
* Set the BackgroundImage of the Form to the image (basically the same as 1 above, but avoids the extra control)
* In code, set the Parent of the LinkLabel to be the PictureBox. You'll need to update the LinkLabel's position to match the new origin of the parent if the PictureBox isn't at (0,0)

M\'b
15-04-2004, 15:28
T'ks a lot!

Vedrò di provare le tips, poi vi farò sapere!


Saluti.Ciao :oink: