Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    MJLover's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    Neverland
    Posts
    759
    Reputation
    33
    Thanks
    110
    My Mood
    Cheerful

    Smile [Tutorial] Windows Vista/7 Glass Window

    NextGenEdit: Original Code By DFXBB's

    Hi !

    One of the most coolest features of Windows Vista/7 is its glass effect in Forms.

    In this short tutorial I'll show you how to make your form entirely transparent. The difference is that by default Windows do transparency in title bar. But we can change that and apply the transparency to complete Form.

    Here we go:

    Create a new project.

    Add this namespace:
    Code:
    Imports System.Runtime.InteropServices
    Then add this:

    Code:
    'This will declare margins for transparency of our window...
    <StructLayout(LayoutKind.Sequential)> _
        Public Structure WinMargins
            Public LWidth As Integer
            Public THeight As Integer
            Public RWidth As Integer
            Public BHeight As Integer
        End Structure
    Then declare the following API:
    Note: The following API is only present in Windows Vista /7
    Code:
    <DllImport("dwmapi.dll")> _
        Public Shared Function DwmExtendFrameIntoClientArea(ByVal hWnd As IntPtr, ByRef pMarinset As WinMargins) As Integer
        End Function
    Now Double Click The Form and add the following code:
    Code:
    Dim margins As WinMargins = New WinMargins
    'The value of -1 is used when you want to use full window as transparency...
             Dim WM As WinMargins = New WinMargins
            WM.LWidth = -1
            WM.RWidth = -1
            WM.THeight = -1
            WM.BHeight = -1
    'The handle of your window..
            Dim handle As IntPtr = Me.Handle
    ' Finally call the API function by inputing window handle and your window margins ..
            DwmExtendFrameIntoClientArea(handle, WM)
    Note: Transparency will not turned on unless you change the Form's back color to Black.


    Credits: MSDN for API DwmExtendFrameIntoClientArea Function (Windows)

    Here's a screen shot:


    Greetz, MJLover
    Last edited by NextGen1; 03-27-2010 at 02:50 PM.

  2. The Following 6 Users Say Thank You to MJLover For This Useful Post:

    DarkByte7 (11-05-2011),House (09-28-2010),kokoiv (03-07-2012),ovenran (11-07-2010),Spookerzz (03-27-2010),trevor206 (03-27-2010)

  3. #2
    Zoom's Avatar
    Join Date
    May 2009
    Gender
    male
    Location
    Your going on my 24/7 DDoS hit list.
    Posts
    8,552
    Reputation
    127
    Thanks
    5,971
    My Mood
    Happy
    Awesome.
    GOod tutorial

  4. #3
    Spookerzz's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    4,647
    Reputation
    26
    Thanks
    572
    Woah VB can do everything!

    Well written tutorial.
    I'm back.

  5. #4
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,109
    thanks for sharing



  6. #5
    tremaster's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Posts
    523
    Reputation
    10
    Thanks
    95
    My Mood
    Amazed
    Public Class Form2

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    MyNewSub()
    End Sub
    Sub MyNewSub()
    TransparencyKey = BackColor

    End Sub
    End Class

    something like that?

  7. #6
    MJLover's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    Neverland
    Posts
    759
    Reputation
    33
    Thanks
    110
    My Mood
    Cheerful
    You're welcome. If I get time I'll write some more tutorials because Aero API is very rich and offers many other great effects

    And yes VB can do anything. All .NET languages are equivalently powerful
    Last edited by MJLover; 03-27-2010 at 12:15 PM.

  8. #7
    tremaster's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Posts
    523
    Reputation
    10
    Thanks
    95
    My Mood
    Amazed
    yo mang pm me back

  9. #8
    MJLover's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    Neverland
    Posts
    759
    Reputation
    33
    Thanks
    110
    My Mood
    Cheerful
    Quote Originally Posted by tremaster View Post
    Public Class Form2

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    MyNewSub()
    End Sub
    Sub MyNewSub()
    TransparencyKey = BackColor

    End Sub
    End Class

    something like that?
    No, buddy not like that. I think you didn't followed the tutorial. Plus I doubt that you are not using Vista/7.

    Anyways tutorial is easy. Follow it and hopefully you will get the effect

  10. #9
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Looks Great, thanks for sharing.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  11. #10
    tempta43's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Posts
    980
    Reputation
    23
    Thanks
    295
    My Mood
    Bored
    Sorry, im a newb to Visual Basic, and I don't understand most of this tutorial, you don't have to, but can you make this more newb friendly or make a video? Cause' I really wanna know how to do this. If you can't, its all good.

    I'M BACK.. I guess. :S

  12. #11
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed


    Thread Reopened, Credit to author added to post 1







    Last edited by NextGen1; 03-27-2010 at 02:50 PM.


     


     


     



    The Most complete application MPGH will ever offer - 68%




  13. The Following User Says Thank You to NextGen1 For This Useful Post:

    why06 (03-27-2010)

  14. #12
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,204
    My Mood
    Flirty
    While this thread might be repoened lets get a couple things straight:

    1. It's is not our responsibility to make sure you credit your sources.

    2. It is not right to claim others work as your own, in order to make urself look good.

    There is nothing wrong with sharing a tutorial that you found interesting, preferably not from a rival site though, but if you want to link to MSDN, or even share some interesting snippets that is no big deal, but you can not just outright use someone else's work without even attempting to mention them.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  15. The Following 2 Users Say Thank You to why06 For This Useful Post:

    NextGen1 (03-27-2010),tempta43 (03-27-2010)

  16. #13
    trevor206's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Posts
    324
    Reputation
    12
    Thanks
    107
    wow it looks so cool but i cant get it to work (i think its cause i have XP)

  17. #14
    tempta43's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Posts
    980
    Reputation
    23
    Thanks
    295
    My Mood
    Bored
    I love this so much.
    Probably going to use this for everything now.

    I'M BACK.. I guess. :S

  18. The Following User Says Thank You to tempta43 For This Useful Post:

    MJLover_2 (03-28-2010)

  19. #15
    trevor206's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Posts
    324
    Reputation
    12
    Thanks
    107
    Quote Originally Posted by tempta43 View Post
    I love this so much.
    Probably going to use this for everything now.
    lol thanks for rubbing it in lol

Page 1 of 2 12 LastLast

Similar Threads

  1. [Tutorial] Fully Themed Windows Vista Controls In Your Apps
    By Hassan in forum Visual Basic Programming
    Replies: 7
    Last Post: 06-07-2010, 08:36 PM
  2. [Tutorial] Fully Themed Windows Vista Controls In Your Apps
    By Hassan in forum Visual Basic Programming
    Replies: 9
    Last Post: 06-06-2010, 04:29 AM
  3. [Tutorial] Windows 7 JumpLists
    By MJLover in forum Visual Basic Programming
    Replies: 13
    Last Post: 03-29-2010, 08:51 PM
  4. Glass CMD in Vista in Windows 7.
    By EndRiT in forum General
    Replies: 2
    Last Post: 05-04-2009, 02:26 PM
  5. [Tutorial]Disabaling emu windows in your runnable
    By HolyFate in forum Gunz General
    Replies: 14
    Last Post: 02-09-2006, 11:16 PM