glow effect to a form using GDI+

tyonuts

Well-known member
Joined
Dec 27, 2005
Messages
78
Location
Romania
Programming Experience
3-5
Hi everyone. My question is: how can you add a glow effect to a form using GDI+? I mean, something similar to Adobe Acrobat's Splash Screen? Using a png seems to work, but only until the form is repainted (eg: when i move the form).
And another one: I tried creating a control that inherits from RichTextBox. I need to make it transparent, so I used SetStyle. The problem is, when I use the UserPaint method, the background is transparent, but the text isn't visible anymore. How can I repaint the text, so that I can still have scrollbars available? Thanks a lot in advance!
 
Last edited by a moderator:
Oh... and vis781.... I think that tyonuts is trying to use a specific image here... e.g., not something that can be easily drawn with GDI+. For example, he may be using a background image with a special shape (let's say, for example, the outline of a Ferarri). It would be a great deal easier to add the glow effect to this in Photoshop (or PSP) then save it as a PNG.
 
thanks forunderstanding fauxquixote
but don't play around with all that
just create a new project, with a main form
and set that image (in DESIGN mode) as the forms back
then run it and move the form
and tell me what happens...
 
Actually... I've been playing around and I decided to try this from a different approach... there's some visual delay when moving the form in a debug build, but it gets the job done:

VB.NET:
Public Sub New()
   InitializeComponent()
   Me.DoubleBuffered = True '<- to avoid flicker.
   Me.Opacity = (254 / 255)
   RefreshBackground()
End Sub
 
Private Sub RefreshBackground()
   Dim bmpTmp As New Bitmap(imageToDraw.Width, imageToDraw.Height)
   Dim gphTmp As Graphics = Graphics.FromImage(bmpTmp)
   gphTmp.CopyFromScreen(Me.PointToScreen(New Point(0, 0)), New Point(0, 0), Me.ClientSize)
   gphTmp.DrawImage(imageToDraw, 0, 0) '<- supply an image here.
   gphTmp.Dispose()
   Me.BackgroundImage = bmpTmp
End Sub
 
Private Sub MainForm_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Move
   RefreshBackground()
End Sub

Also, another downside is that changes taking places behind the window won't be visible until RefreshBackground() is called again. If that's important to you, you could always use a Timer, I suppose. Also, you can get rid of the parts that are fully transparent by changing the region of the window.

Anyway, I hope this at least helps.
 
If i understand you correctly you want the form to go from transparrent to normal?

What i did is i set the transparrency key to black, i added a black backgroundimage and then i slowely looped the transparrency key to white.
 
Back
Top