Borderless Borderless Form 
Author Message
 Borderless Borderless Form

My borderless form has a border, black (and a popup menu that I need).
So how do I get rid of the border on this borderless form?


Tue, 03 Apr 2012 00:11:48 GMT  
 Borderless Borderless Form
2nd attempt to post.

Borderless Borderless Form
? How to remove the border(black) from the borderless form (form has a menu
that I need) ?

==============================================================
The following is code to move and resize the borderless form.

Hope this is usefull to someone.  Did lots of searching and cobbled it
together today.

Public Const WM_NCLBUTTONDOWN    As Long = &HA1
Public Const HTCAPTION           As Integer = 2
Public Const HTBOTTOMRIGHT       As Integer = 17

Public Declare Function ReleaseCapture Lib "user32" () As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal
hwnd As Long, _
                                                                       ByVal
wMsg As Long, _
                                                                       ByVal
wParam As Long, _

lParam As Any) As Long

Private Sub Form_MouseMove(Button As Integer, _
                           ShiftState As Integer, _
                           X As Single, _
                           Y As Single)

    ResizeMove Button, ShiftState, X, Y

End Sub 'Form_MouseMove

Private Sub ResizeMove(Button As Integer, _
                           ShiftState As Integer, _
                           X As Single, _
                           Y As Single)

    Dim bSize As Boolean
    Const lSizeHotPct as Long = 10    ' percent of lower right corner as a
sizing hotspot
                                      ' otherwise a move hotspot
    bSize = False
    bMove = False

    Select Case Button
    Case vbLeftButton
        Select Case X
        Case Me.Width - Me.Width / lSizeHotPct To Me.Width
            Select Case Y
            Case Me.Height - Me.Height / lSizeHotPct To Me.Height
                bSize = True
            Case Else
                bMove = True
            End Select
        Case Else
            bMove = True
        End Select

        If bSize Then
            Screen.MousePointer = vbSizeNWSE
            ' start resize
            ReleaseCapture
            SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTBOTTOMRIGHT, 0&
        Else
            If bMove Then
                Screen.MousePointer = vbSizeAll
                ' start move
                ReleaseCapture
                SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&

            Else
                Screen.MousePointer = vbDefault

            End If
        End If

    Case Else
        Screen.MousePointer = vbDefault

    End Select

End Sub 'ResizeMove



Tue, 03 Apr 2012 00:27:37 GMT  
 Borderless Borderless Form

Quote:
> 2nd attempt to post.

Saw the first post. Sorry, I can't help.


Tue, 03 Apr 2012 00:34:45 GMT  
 Borderless Borderless Form
Bee escribi:

Quote:
> 2nd attempt to post.

> Borderless Borderless Form
> ? How to remove the border(black) from the borderless form (form has a menu
> that I need) ?

the problem is that when you add a menu, even when it's not visible,
Windows adds the title bar.

You could hide it creating a region.

Otherwise, I don't know if you can change the window's style once the
window is created. I think you'll have to subclass the form to remove
the title bar.

Here is the code that will do it with a region:

Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private Declare Function GetWindowRect Lib "user32" _
     (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function CreateRectRgn Lib "gdi32" _
     (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As _
     Long, ByVal Y2 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" _
     (ByVal hwnd As Long, ByVal hRgn As Long, ByVal _
     bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib "gdi32" _
     (ByVal hObject As Long) As Long

Private Declare Function GetSystemMetrics Lib "user32" _
     (ByVal nIndex As Long) As Long

Private Const SM_CYCAPTION = 4       ' Height of caption or title
Private Const SM_CXFRAME = 32        ' Width of window frame
Private Const SM_CYFRAME = 33        ' Height of window frame

Private mFormRegion As Long

Private Sub Form_Resize()
     Dim iWindowRect As RECT
     Dim iCaptionHeight As Long
     Dim iYFrameHeight As Long
     Dim iXFrameWidth As Long
     Dim iOldRegion As Long

     GetWindowRect Me.hwnd, iWindowRect
     iCaptionHeight = GetSystemMetrics(SM_CYCAPTION)
     iYFrameHeight = GetSystemMetrics(SM_CYFRAME)
     iXFrameWidth = GetSystemMetrics(SM_CXFRAME)
     iOldRegion = mFormRegion
     mFormRegion = CreateRectRgn(iXFrameWidth, iCaptionHeight + _
         iYFrameHeight, iWindowRect.Right - iWindowRect.Left - _
         iXFrameWidth, iWindowRect.Bottom - iWindowRect.Top - _
         iYFrameHeight)
     SetWindowRgn Me.hwnd, mFormRegion, True
     DeleteObject iOldRegion
End Sub

Private Sub Form_Unload(Cancel As Integer)
     DeleteObject mFormRegion
End Sub



Tue, 03 Apr 2012 02:49:08 GMT  
 Borderless Borderless Form


Quote:
> Otherwise, I don't know if you can change the window's style once the
> window is created. I think you'll have to subclass the form to remove
> the title bar.

How about using an entirely different form for the menu?  A form that
is loaded, but not shown.  The Pop up (context) menus don't care where
the menu comes from, all that needs to be done is supply the callback
(or event mechanism) to let the main form know what the user action was.

LFS



Tue, 03 Apr 2012 09:30:06 GMT  
 Borderless Borderless Form
Larry Serflaten escribi:

Quote:

>> Otherwise, I don't know if you can change the window's style once the
>> window is created. I think you'll have to subclass the form to remove
>> the title bar.

> How about using an entirely different form for the menu?  A form that
> is loaded, but not shown.  The Pop up (context) menus don't care where
> the menu comes from, all that needs to be done is supply the callback
> (or event mechanism) to let the main form know what the user action was.

I was going to test that but I didn't remember (I wasn't sure) if the
menu can be from other form.
Thanks for clarifying it.


Tue, 03 Apr 2012 10:19:05 GMT  
 Borderless Borderless Form

Quote:

> 2nd attempt to post.

> Borderless Borderless Form
> ? How to remove the border(black) from the borderless form (form has a menu
> that I need) ?

> ==============================================================
> The following is code to move and resize the borderless form.

> Hope this is usefull to someone.  Did lots of searching and cobbled it
> together today.

> Public Const WM_NCLBUTTONDOWN    As Long = &HA1
> Public Const HTCAPTION           As Integer = 2
> Public Const HTBOTTOMRIGHT       As Integer = 17

> Public Declare Function ReleaseCapture Lib "user32" () As Long
> Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal
> hwnd As Long, _
>                                                                        ByVal
> wMsg As Long, _
>                                                                        ByVal
> wParam As Long, _

> lParam As Any) As Long

> Private Sub Form_MouseMove(Button As Integer, _
>                            ShiftState As Integer, _
>                            X As Single, _
>                            Y As Single)

>     ResizeMove Button, ShiftState, X, Y

> End Sub 'Form_MouseMove

> Private Sub ResizeMove(Button As Integer, _
>                            ShiftState As Integer, _
>                            X As Single, _
>                            Y As Single)

>     Dim bSize As Boolean
>     Const lSizeHotPct as Long = 10    ' percent of lower right corner as a
> sizing hotspot
>                                       ' otherwise a move hotspot
>     bSize = False
>     bMove = False

>     Select Case Button
>     Case vbLeftButton
>         Select Case X
>         Case Me.Width - Me.Width / lSizeHotPct To Me.Width
>             Select Case Y
>             Case Me.Height - Me.Height / lSizeHotPct To Me.Height
>                 bSize = True
>             Case Else
>                 bMove = True
>             End Select
>         Case Else
>             bMove = True
>         End Select

>         If bSize Then
>             Screen.MousePointer = vbSizeNWSE
>             ' start resize
>             ReleaseCapture
>             SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTBOTTOMRIGHT, 0&
>         Else
>             If bMove Then
>                 Screen.MousePointer = vbSizeAll
>                 ' start move
>                 ReleaseCapture
>                 SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&

>             Else
>                 Screen.MousePointer = vbDefault

>             End If
>         End If

>     Case Else
>         Screen.MousePointer = vbDefault

>     End Select

> End Sub 'ResizeMove

No responses show on MS/communities
MS server broken?
Google Groups working.
Strange.

I thought about using the hidden form but I remember that there were issues
using the menu from the other form.  What is that?
And what about memory usage?
Since I am Set-ing multiple of the borderless forms it seems like a lot of
extra baggage having a hidden form (then also multiple) for just a menu.



Tue, 03 Apr 2012 14:28:01 GMT  
 Borderless Borderless Form

Quote:
> I thought about using the hidden form but I remember that there were issues
> using the menu from the other form.  What is that?
> And what about memory usage?
> Since I am Set-ing multiple of the borderless forms it seems like a lot of
> extra baggage having a hidden form (then also multiple) for just a menu.

You can share the menu form.

--

i-Catcher Development Team

iCode Systems



Tue, 03 Apr 2012 15:49:08 GMT  
 Borderless Borderless Form

Quote:
> No responses show on MS/communities
> MS server broken?
> Google Groups working.
> Strange.

  I've been wondering about that the last few days.
Just when it seemed like Microsoft had gone for
many weeks without a breakdown.  :)  I've been
seeing RE: posts, both here and in the scripting group.
For instance, Eduardo just answered a post
"VB6: Can't show control level help......."
I don't see where that post came from. In my reader
Eduardo's response is the initial post.


Tue, 03 Apr 2012 21:48:28 GMT  
 Borderless Borderless Form


Wed, 18 Jun 1902 08:00:00 GMT  
 Borderless Borderless Form


Quote:
>> No responses show on MS/communities
>> MS server broken?
>> Google Groups working.
>> Strange.

>    I've been wondering about that the last few days.
> Just when it seemed like Microsoft had gone for
> many weeks without a breakdown.  :)  I've been
> seeing RE: posts, both here and in the scripting group.
> For instance, Eduardo just answered a post
> "VB6: Can't show control level help......."
> I don't see where that post came from. In my reader
> Eduardo's response is the initial post.

I didn't see the original hear either
The server claims it is no longer there by ID so may have been deleted.

--

i-Catcher Development Team

iCode Systems



Tue, 03 Apr 2012 22:00:53 GMT  
 Borderless Borderless Form


<cut>

Quote:
> The server claims it is no longer there by ID so may have been deleted.

neat trick


Tue, 03 Apr 2012 22:01:27 GMT  
 Borderless Borderless Form
Dee Earley escribi:

Quote:


>>> No responses show on MS/communities
>>> MS server broken?
>>> Google Groups working.
>>> Strange.

>>    I've been wondering about that the last few days.
>> Just when it seemed like Microsoft had gone for
>> many weeks without a breakdown.  :)  I've been
>> seeing RE: posts, both here and in the scripting group.
>> For instance, Eduardo just answered a post
>> "VB6: Can't show control level help......."
>> I don't see where that post came from. In my reader
>> Eduardo's response is the initial post.

> I didn't see the original hear either
> The server claims it is no longer there by ID so may have been deleted.

I don't know, it's in GG:
http://groups.google.com/group/microsoft.public.vb.general.discussion...

Anyway to me also happen sometimes that my news server shows me "new
posts" with older dates (or hours) and with several answers already.

It must be something about the comunication (and synchronization)
between the news servers.



Tue, 03 Apr 2012 22:21:45 GMT  
 Borderless Borderless Form
Quote:
> I don't know, it's in GG:

http://groups.google.com/group/microsoft.public.vb.general.discussion...
_frm/thread/8b6a1b63117e929b/1f6d3e93b87d4c29?hl=es%01f6d3e93b87d4c29&pli=1

  That's the most bizarre mystery to me! This
is not the first time that's happened. I've posted
directly to msnews before and had it show up
only on Google. Yet it had to go through MSNews
to get there, didn't it? I don't understand how
that can happen, unless the MS server is just
dropping out data willy nilly.



Tue, 03 Apr 2012 22:33:42 GMT  
 Borderless Borderless Form
In the web based MS-Communities, the only two posts are Bee's posts.

http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg...

--



Tue, 03 Apr 2012 22:40:28 GMT  
 
 [ 15 post ] 

 Relevant Pages 

1. Drag borderless form/window?

2. borderless form automatically resizes?

3. Borderless Forms and TaskBar Titles

4. How to move a borderless form?

5. How can you move a borderless form around in 32-bit VB4 Enterprise

6. borderless form gets a border when a menu is added

7. Moving a shaped borderless form in real time??

8. ScaleHeight/ScaleWidth with borderless form - Not working, please help I am stumped

9. HELP with moving borderless forms around screen

10. VBWin Borderless Form

11. moving borderless window / form

12. Question About Borderless Forms

 

 
Powered by phpBB® Forum Software