walter21 Posted January 11, 2003 Posted January 11, 2003 SupportsTransparentBackColor? UserPaint? How does it work? How can I use it? Thanks Quote
*Gurus* divil Posted January 11, 2003 *Gurus* Posted January 11, 2003 You use it in your own derived controls, if you want your control to be able to have transparent or translucent areas in. If you set both those styles on, then when the time comes to paint your control you can do so using colors with an alpha component. Microsoft URL on the topic Windows Forms FAQ on the topic Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
UCM Posted January 12, 2003 Posted January 12, 2003 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... 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... 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 Quote UCM >-)
benlitchfield Posted March 28, 2003 Posted March 28, 2003 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? Quote
*Gurus* divil Posted March 29, 2003 *Gurus* Posted March 29, 2003 I don't think so. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
nem33 Posted April 13, 2003 Posted April 13, 2003 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...That's too bad..I was really hoping to have multiple transparent layers. There must be a way to do this... Quote
benlitchfield Posted April 14, 2003 Posted April 14, 2003 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.