locked
Borderless form - help please :'( RRS feed

  • Question

  • I've created a form like this :

     in vb.net. Main form is transparent and I added big picture box to hold background image. Then I added transparent panel to this form but now i can see my desktop trough that form. I don't wanna c my desktop or other windows. How can I avoid this without changing panel background color? coz I want same image as my panel bg too. help me guys..

     

    thank you..

    Wednesday, August 11, 2010 5:11 PM

Answers

  •  ... to use a picturebox to hold this background image and it works. But now I can see through my all other elements :(


    I think your point is that it doesn't work.   It seems you are trying to use a transparent background to define the form shape.  That's the wrong way to go about it, for exactly the reasons you have discovered.  Windows forms simply don't support multiple transparent layers very well.  A better approach is to set the form region to the proper shape you want it to be, rather than trying to define the form shape using transparency.

    Thursday, August 12, 2010 2:13 AM
  • Private Sub vrk_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        e.Graphics.Clear(Color.Transparent)
        e.Graphics.DrawImage(BMP, 0, 0, BMP.Width, BMP.Height)
        Me.SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint, True)
      End Sub
    
    ok dune stopped flickering.. thankx all
    Thursday, August 12, 2010 5:47 AM

All replies

  • I am not sure I understand why you are making the form transparent in the first place. It sounds like you want a background image on the form and a panel on the form that will show the image that is under it. If that is the case, the form should just have its background image set to your image, and the panel should be transparent.

    What is the case for the form itself to be transparent?


    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com
    Wednesday, August 11, 2010 5:44 PM
    Moderator
  • I am not sure I understand why you are making the form transparent in the first place. It sounds like you want a background image on the form and a panel on the form that will show the image that is under it. If that is the case, the form should just have its background image set to your image, and the panel should be transparent.

    What is the case for the form itself to be transparent?


    Matt Kleinwaks - MSMVP MSDN Forums Moderator - www.zerosandtheone.com


    I've designed a rounded corner background for my form and gave it as a form background. But problem is when I'm moving my form to monitor's edges, something happening to form it's like flickering (specially loading form and moving it from monitor's edges to center). That's why I decided to use a picturebox to hold this background image and it works. But now I can see through my all other elements :(

     

    thankx klei nma

    Thursday, August 12, 2010 1:00 AM
  •  ... to use a picturebox to hold this background image and it works. But now I can see through my all other elements :(


    I think your point is that it doesn't work.   It seems you are trying to use a transparent background to define the form shape.  That's the wrong way to go about it, for exactly the reasons you have discovered.  Windows forms simply don't support multiple transparent layers very well.  A better approach is to set the form region to the proper shape you want it to be, rather than trying to define the form shape using transparency.

    Thursday, August 12, 2010 2:13 AM
  • Private Sub vrk_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        e.Graphics.Clear(Color.Transparent)
        e.Graphics.DrawImage(BMP, 0, 0, BMP.Width, BMP.Height)
        Me.SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint, True)
      End Sub
    
    ok dune stopped flickering.. thankx all
    Thursday, August 12, 2010 5:47 AM