SupportsTransparentBackColor?

Nifty dimming credits...

After reading this thread, My previous thred about "Transparent Controls" is now fully answered :D Thanx Guys!!

One of the things I wanted to be able to do this for was for the creation of dimming and undimming text, almost like credits from the end of a movie or video game...

I ramped up this lil code to make it work the way I intended it to...

First, on form1, create label1 and out whatever text in it you want...

After the control comes into view, wait 3 seconds and watch again...

Code:
Dim x As Int16, xTag As Boolean

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  Me.Label1.BackColor = Color.FromArgb(0, Me.Label1.BackColor)
Also create a timer1 control on form1...

Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  If x >= 256 Then x = 255 : Timer1.Interval = 10 : xTag = True
  If x <= -1 Then x = 0 : Timer1.Interval = 10 : xTag = False
    Me.Label1.ForeColor = Color.FromArgb(x, 255, 0, 255)
  If xTag = False Then x += 1
  If xTag = True Then x -= 1
  If x >= 256 Then Timer1.Interval = 3000
  If x <= -1 Then Timer1.Interval = 3000
End Sub
 
Transparency with multiple controls

I have an application that is drawing some boxes on a Panel, ( kinda like Visio). I have a class Box which has the following styles set

this.SetStyle( ControlStyles.SupportsTransparentBackColor, true);
this.BackColor = Color.Transparent;

Several boxes are added to a Panel like this.

Controls.Add( new Box() );

This appears to work, except when I drag another one box over another box. It appears that the transparent area shows through to the Panel and ignores the box that I am on top of. I want a transparent section but for it to show the box that I am on top of. Any way to do this?
 
So it seems only the background form can have a single layer of transparent objects on top of it..Individual objects cannot keep their transparency if layered on top of one another...Thats too bad..I was really hoping to have multiple transparent layers. There must be a way to do this...
 
transparency

Basically the way I fixed this was to not have my Box just be a regular class and not extend Control and basically rewrite the functionality of Control that I needed. The control that holds my Box class now directly calls paint on the Box, which allows for transparency because you are just drawing on another control.
 
Back
Top