can anyone tell, how can i make an mdi form borderless.
i don't want the user to click on the close button present in the title bar. i want them to exit the way i directed them.
thanks in advance.
Why don't you use the query unload event and place 'cancel = true' there?
Otherwise look here: http://vbnet.mvps.org/index.html?code/forms/killclose.htm
*change: Private Sub Form_Load() IN Private Sub MDIForm_Load()
you cannot make a mdiform borderless. instead of you can disable the close button on the titlebar of the mdiform. to disable the close button use this code :-
'declare these api functions in general section of the mdiform
Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, _
ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, _
ByVal bRevert As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private ReadyToClose As Boolean
'create a sub-routine like this
Private Sub RemoveMenus(frm As Form, remove_close As Boolean)
Dim hMenu As Long
hMenu = GetSystemMenu(hwnd, False)
If remove_close Then DeleteMenu hMenu, 6, MF_BYPOSITION
'in load event add this
Private Sub MDIForm_Load()
RemoveMenus Me, True
'within your exit option add this
ReadyToClose = True
thank you. both of you. it really works and i appreciate for your reply.
I am a .NET developer and don't have pre-.NET skills, so forgive me if this is version-incorrect. But I have made MDI forms borderless with no problems other than getting MdiLayout to work smoothly.
I set the MdiParent's FormBorderStyle to "None". Then, I created user controls for my new "skinned" form borders and docked them respectively in the Mdi parent form. When docking, z-order controls how they layout against each other. My new "Titlebar" control implements all the functionality to move, minimize, restore, and close the form. You could simply exclude these methods to accomplish what you want.
NOTE: I realize this thread is pretty old. But I though it might help someone who comes along via their own "googling".
I realize that this tread is some quite old, but...
1. freQ, really you can set FormBorderStyle in VB.Net environment; but, in earlier versions, this property doesn't exist;
2 choudhuryshouvi, if you use API for disable buttons in title bar, why not to disable border in the form? It's possible, but need a bit of work on it. Use two APIs of USER32 file: GETWINDOWLONG and SETWINDOWLONG;
3. PVBert, if the only aim of hide the MDI form's border is to prevent that the user can close the application, your sollution works fine... but, if you need to "redesign" your application, reshape the "Windows window" (this sounds very strange) with a picture, for example?
I made a "form picture", with "title", "borders" and so on (in a photoshop-like application), and need to take out the conventional border of the MDI and put my image in the background, simulating a "skin" for my VB6 program.
The result is very cool... and the above code solve my problem! ;)
It's adpated from
I hope this can be usefull for anyone that "googles" for borderless MDI form in pre-NET Visual Basic, and apologize for the bad writing (not speak english very well).
Sao Paulo - Brasil
'This is the API declaration; I suggest to put it in a module, OR change private to public Private Declare Function GetWindowLong Lib "USER32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "USER32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long 'Constants to make code more readable Private Const GWL_STYLE = (-16) Private Const WS_BORDER = &H800000 Private Const WS_CAPTION = &HC00000 'A generic function to make a form borderless Public Sub [B]RetiraBorda[/B](ByRef nFormHWND As Long) Dim nEstilo As Long On Error GoTo errRetiraBorda nEstilo = GetWindowLong(nFormHWND, GWL_STYLE) nEstilo = nEstilo And Not WS_CAPTION SetWindowLong nFormHWND, GWL_STYLE, nEstilo Exit Sub errRetiraBorda: MsgBox "Erro na execução da rotina:" & vbNewLine & vbNewLine & Err.Number & " - " & Err.Description, vbExclamation, "RetiraBorda" End Sub 'The function can be called this way, in the form for example Private Sub MDIForm_Activate() Dim rTela As tCoord [B]RetiraBorda[/B] Me.hwnd rTela = AreaTrabalho 'Some other code to initialize application '(...) End Sub
there is 1 issue with this code : when you have a statusbar on the bottom of your mdi form then the resize/grab handle of the statusbar is now functional and you can resize the statusbar instead of the mdi form
to make sure the statusbar itself cant be resized either have a look at : http://www.vbforums.com/showthread.php?t=552272
I was wondering if it was possible to create a software like visual studio (in addition simple, obviously). We could program in vb.net, c ++, etc.
Write a looping program for Theater Seating selection
The program will display the theater seating (shown later) and prompt the user to select a seat to purchase using the row ...
Hi Maam and Sir.
I need your expertise on vb.net.
I have two data grid with database on their own. I want to copy/update the data from one database to ...