Click here to Skip to main content
15,907,497 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
How can a windows form call itself ?
Basically I'm not looking for a tool strip menu bar, what I want is for example if I click "home" from the menu bar I want it to display some functions on the window, if I click "file" from the menu bar I want it to display other different options in the same window.
Thanks hope you understand what I tried to explain.
Posted
Updated 23-Oct-10 16:40pm
v2
Comments
Henry Minute 23-Oct-10 22:41pm    
What does "display some functions on the window" mean? You should edit your question to make this clearer or, I'm afraid, you are unlikely to get any answers.
Chirry 24-Oct-10 6:37am    
What im trying to do is to do an audio editor, this application will have a menu but i dont want it as a tool strip menu bar to display the available options what i want instead is that when u click on one option of the menu bar it provides the user with different buttons according to the option from the menu bar clicked. (im taking as an example the Music editor free audio editor)
when i try to do it im using differentt forms to get what i want, istead i want it all to happen in the same form
I hope i made it clear now. thank u so much for ur patient and time

You are describing a TabControl. So, you may either use one or, if you don't like its appearance, you may fake it using z-axis stacked panels. Then, if a panel is needed, you can simply call the Panel.BringToFront() method.
If you need further explanation, feel free to ask. Good luck!
 
Share this answer
 
Comments
Chirry 25-Oct-10 1:45am    
yess that is exaclty what i need thank youu.
Would you mind explaining me how can i use the panels,im just learning c# im not an expert on it, been learning for two months and now i got to do a project on in and its really worrying me.
God bless for ur help
Well...
1. Place the MainMenu on your Form.
2. Create the MenuItems.
3. Create the first Panel.
4. Set its Dock property to DockStyle.Fill.
5. Place whatever Controls you want on it.
6. Repeat steps 3 to 5 for all the other Panels.
Note: There is an issue. Since the Panels are all on the same Form and all have Dock = DockStyle.Fill, only the uppermost one will be visible in the designer. But that's exactly what you want it to be, right? Ok, but you want to add some Controls on the invisible ones. So, right-click on the visible one and click Send To Back. The Panel below will now be visible. And so on.
7. Create Click event handlers for your MenuItems, for example:
private void menuHome_Click(object sender, EventArgs e)
{
    this.panelHome.BringToFront();
}

That's all!
 
Share this answer
 
Comments
Chirry 25-Oct-10 8:53am    
woooooww !!! i will do that right now.. i doo really appreciate ur help i doo!! thanks a lott
thank u for ur time an patient with me as well..
can i sak u one more thing, can i call a class from the click of a button. for example. i got a class call recording, when the button REC is clicked i want it to call the class to performe the action instead of putting the whole code behin the buttons.
Im sorry if they are stupid questions but im just trying to get the philosophy of c# and a clear understanding of it. im just confuse because apparently there are code all around i mean there are code behin buttons in the classes here there, so im just confusing myself over it.
Thanks again i feel dumb but hope u understand me
Chirry 25-Oct-10 12:06pm    
i tried to implement what u said but when i try to run it it wont work. this is what i wrote

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace GUI_application
{
public partial class Frm_audioeditor : Form
{
public Frm_audioeditor()
{
InitializeComponent();
}

private void homeToolStripMenuItem_Click(object sender, EventArgs e)
{
this.panel1.BringToFront();

}

private void fileToolStripMenuItem_Click(object sender, EventArgs e)
{
this.panel2.BringToFront();
}

private void editToolStripMenuItem_Click(object sender, EventArgs e)
{
this.panel3.BringToFront();
}

private void effectsToolStripMenuItem_Click(object sender, EventArgs e)
{
this.panel4.BringToFront();
}




}
}
Toli Cuturicu 25-Oct-10 16:32pm    
How exactly does it NOT work? What happens?
And why do you need using System.Data; using System.Text; using System.Linq;? Do you actually use anything from these namespaces in your class?
Toli Cuturicu 25-Oct-10 16:33pm    
Make sure you added the panels to your form and you set their Dock property to DockStyle.Fill.
Toli Cuturicu 25-Oct-10 16:34pm    
You can't call a class! This has no meaning at all. You can call a public static method of a class, or create an instance of that class and call a public method of it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900