Results 1 to 5 of 5

Thread: WindowsStyle = Boarderless but with fade in ?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2021

    WindowsStyle = Boarderless but with fade in ?

    Is there a way to remove the titlebar of a window, or craete a boarderless form but have the factory fade in and fade out animations when loading and minimizing?

  2. #2
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Yaddlethorpe, North Lincolnshire, England.

    Re: WindowsStyle = Boarderless but with fade in ?

    Hi ProElectronicZR, you could try something like this:

    You don't say how many animations so I'll just give two as an example.
    I shall also assume you're using GIF files for the animations and that they are all of different durations, and also that you're setting up a second Form (Visible = false) behind Form1.
    Form1 has PictureBox1 (Dock = Fill) and two Timers as its only controls.
    You should have all of your GIF files loaded in Recourses (Build Action = Embedded Recourse).

    Public Class Form1  
            Public gif1 As Image = New Bitmap(Me.GetType(), "Animation1.gif")
            Public gif2 As Image = New Bitmap(Me.GetType(), "Animation2.gif")  
            Public tim() as Integer = {5200, 8600}  ' Duration of gif1, gif2.
    Private Sub Form1_Load() Handles MyBase.Load
            Me.WindowState = FormWindowState.Maximized
            Me.FormBorderStyle = FormBorderStyle.None
            Me.AllowTransparency = True  'Important !  (Stop 'Blink')
            Me.Opacity = 1
            PictureBox1.Image = gif1
            Timer1.Interval = 2500
            Timer2.Interval= tim(0)
            Timer2. Start()
            ' Plus whatever
        End Sub
        Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
            Static fade as Boolean = True
            Static anim as Integer = 1                   ' Number of animations - 1.    
            Timer1.Interval = 100
            If fade then 
                    Me.Opacity -= 0.1
                    Me.Opacity += 0.1
            If Me.Opacity = 0 Or Me.Opacity = 1 Then fade = Not fade
        End Sub
        Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
            Static vue as Integer = 1
            If vue = 2 then        ' Total number of animations. 
                    Me.Opacity = 1
            Timer2.Interval = tim(vue)
            PictureBox1.Image = gif(vue)
            vue += 1
        End Sub
    You may need to adjust the number of animations, or the rate of fade in order to get the time you need to set-up your application. You may also wish to hide Form1 and show your next Form at Timer1.Stop().

    Last edited by Poppa Mintin; Jan 16th, 2022 at 09:21 PM. Reason: Typo !
    Along with the sunshine there has to be a little rain sometime.

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Chelmsford UK

    Re: WindowsStyle = Boarderless but with fade in ?

    If you want fade in / fade out animations, use…

    Private Sub FadeForm(frm As Form, fadeOut As Boolean)
        frm.Opacity = If(fadeOut, 1, 0)
        For o as Decimal = If(fadeOut, 1, 0) To If(fadeOut, 0, 1) Step if(fadeOut, -0.1, 0.1)
            frm.Opacity = o
    End Sub

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Sep 2021

    Re: WindowsStyle = Boarderless but with fade in ?

    I am aware of this solution, however I want to create a custom theme for my software that involves custom titlebar with buttons for minimize and exit... I'm interasted in making it have the effects as if it was a Sizable form.. The opacity thing is a very ugly solution... I have seen some people make it boarderless yet have the animations as if it wasn't..

  5. #5
    Junior Member
    Join Date
    Jan 2022

    Re: WindowsStyle = Boarderless but with fade in ?

    From my experience, WinForms is a workhorse for throwing together quick and dirty applications, dare I say... legacy. If you want to start getting all fancy schmansy you should look to WPF.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width