|
-
Jun 4th, 2006, 10:03 AM
#1
Thread Starter
New Member
Placing a form within a frame
Hi,
In developing a GUI I need to place a form within a frame in a windows depending upon the button the user clicks. Is there any way to to place a form "frmContent" within a frame "frmEvents" placed in frmMain.
Thanks
shibdas
-
Jun 4th, 2006, 10:24 AM
#2
Re: Placing a form within a frame
Welcome to the Forums.
Yes, since a frame has a window handle you can nest a form inside it using the SetParent API.
VB Code:
Option Explicit
Private Declare Function SetParent Lib "user32.dll" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Sub Form_Load()
Load Form2
SetParent Form2.hWnd, Frame1.hWnd
Form2.Move 0, 0, Frame1.Width, Frame1.Height
Form2.Show
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Unload Form2
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 4th, 2006, 02:05 PM
#3
New Member
Re: Placing a form within a frame
Hi,
I have just used your code, however I was wondering how to make it so when you click within the frame it doesn't treat the form as if you've clicked another one.
Thanks
-
Jun 4th, 2006, 02:36 PM
#4
Re: Placing a form within a frame
meaning you don't want user to be able to move or resize form2?
On form2 set
BorderStyle = 1
Caption = ""
ControlBox=False
MinButton=False
MaxButton=False
-
Jun 4th, 2006, 02:45 PM
#5
New Member
Re: Placing a form within a frame
http://www.ingomania.co.uk/problem.jpg
This is my problem.. I've already done all that !
-
Jun 4th, 2006, 02:47 PM
#6
Re: Placing a form within a frame
do you mean the parent window titlebar loses focus?
http://www.vbaccelerator.com/home/vb...wn/article.asp
(your pic is 404)
-
Jun 4th, 2006, 02:53 PM
#7
New Member
Re: Placing a form within a frame
Yea that's what I mean. I'm not too sure what code to use from that site.. And the images seems to work this end :/
ps thanks
-
Jun 4th, 2006, 03:20 PM
#8
New Member
Re: Placing a form within a frame
Could anyone help me with the code in the link http://www.vbaccelerator.com/home/vb...wn/article.asp
Thanks
-
Jun 4th, 2006, 06:00 PM
#9
Re: Placing a form within a frame
You'll need to do a little research on subclassing. Search the forums for subclass or subclassing
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|