Borderless MDI form

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jun 2007
Posts: 19
Reputation: Es Sayen is an unknown quantity at this point 
Solved Threads: 0
Es Sayen Es Sayen is offline Offline
Newbie Poster

Borderless MDI form

 
0
  #1
Jun 10th, 2007
hello all,

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.
Sayen
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 59
Reputation: PVBert is an unknown quantity at this point 
Solved Threads: 5
PVBert PVBert is offline Offline
Junior Poster in Training

Re: Borderless MDI form

 
0
  #2
Jun 10th, 2007
Why don't you use the query unload event and place 'cancel = true' there?

Otherwise look here: http://vbnet.mvps.org/index.html?cod.../killclose.htm

*change: Private Sub Form_Load() IN Private Sub MDIForm_Load()
Last edited by PVBert; Jun 10th, 2007 at 4:46 pm. Reason: added the alternative
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 537
Reputation: choudhuryshouvi is an unknown quantity at this point 
Solved Threads: 49
choudhuryshouvi's Avatar
choudhuryshouvi choudhuryshouvi is offline Offline
Posting Pro

Re: Borderless MDI form

 
0
  #3
Jun 11th, 2007
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
End Sub

'in load event add this
Private Sub MDIForm_Load()
RemoveMenus Me, True
End Sub

'within your exit option add this
ReadyToClose = True
End
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 19
Reputation: Es Sayen is an unknown quantity at this point 
Solved Threads: 0
Es Sayen Es Sayen is offline Offline
Newbie Poster

Re: Borderless MDI form

 
0
  #4
Jun 13th, 2007
hello,

thank you. both of you. it really works and i appreciate for your reply.

Thanks again.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1
Reputation: freQ is an unknown quantity at this point 
Solved Threads: 0
freQ freQ is offline Offline
Newbie Poster

Re: Borderless MDI form

 
0
  #5
Feb 27th, 2008
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".
Last edited by freQ; Feb 27th, 2008 at 1:01 pm.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC