Results 1 to 8 of 8

Thread: A "not square" window ?!

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    1

    Unhappy A "not square" window ?!

    Does anyone nows how to make window to apear not squaer ????

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Try this
    VB Code:
    1. Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
    2. Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
    3. Private Declare Function DeleteObject Lib "gdi32.dll" (ByVal hObject As Long) As Long
    4.  
    5. Private Sub Form_Load()
    6. Dim fwidth As Long, fheight As Long
    7. Dim rval As Long, nhwnd As Long
    8. fwidth = Me.Width / Screen.TwipsPerPixelX
    9. fheight = Me.Height / Screen.TwipsPerPixelY
    10. 'Create Round Rectangular Region
    11. nhwnd = CreateRoundRectRgn(0, 0, fwidth - 25, fheight - 25, fwidth - 50, fheight - 50)
    12. 'Create Elliptic Region
    13. 'nhwnd = CreateRoundRectRgn(0, 0, fwidth - 50, fheight - 50, fwidth - 50, fheight - 50)
    14. 'Set Round Rectangular Region on form
    15. rval = SetWindowRgn(Me.hWnd, nhwnd, True)
    16. rval = DeleteObject(nhwnd)
    17. End Sub

  3. #3
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    mlewis posted an excellent example on that somewhere lately. you should search for it, you can use a bmp and set one color as the one to be transparent... it's pretty neat!
    Sanity is a full time job

    Puh das war harter Stoff!

  4. #4
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Oregon
    Posts
    962
    I have an OCX which allows you to make the form invisibale except the controls on it (label and imagebox will be invisable).

    It allows you to do more then this too. Some stuff it allows:
    -Tiled Background Images
    -Flashing Caption
    -Min/Max Size (maximize free cell to see what I mean)
    -A few more options, which I can't rember

    If you wish, I will upload it when I get home (don't know if this is what you want though).
    Involved in: Sentience

  5. #5
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    I am not sure but I think you could archieve the same thing (not showing the form at all) by setting the region of it to 0... I am not sure though.. if not it was something similar...
    Sanity is a full time job

    Puh das war harter Stoff!

  6. #6
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Oregon
    Posts
    962
    I know that there are other ways, but the control allows you to do more, and easier, with the control then with any one API.
    Involved in: Sentience

  7. #7
    Frenzied Member /\/\isanThr0p's Avatar
    Join Date
    Jul 2000
    Location
    They can't stop us! We're on a misson from God.
    Posts
    1,181
    that's true. I just think it's always better to use API instead of Controls! Controls are not your code (well that is not a big problem if they are free) , but I hate them because if you transfer the tinyest program you need to install those too and I really don't like spamming the windows directory...
    Sanity is a full time job

    Puh das war harter Stoff!

  8. #8
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Oregon
    Posts
    962
    I know what you mean, and this one was downloaded as freeware. The nice thing about controls (and dlls), is that you only need one copy of it. If you write your own code (not in a dll or control), you have to install it each time the program is setup. A dll or control only needs to be installed once, although you still should include it in each program which uses it.

    Anyways, I attached the control to this post.
    Involved in: Sentience

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