|
-
July 1st, 2012, 10:04 PM
#1
C# Form Help
Hello,
I am trying to create a Windows Form App that when a button is clicked, it pulls up a different "form". I want the new "Form" to be in the same area and not its own pop up. What I have so far is below.
Code:
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;
using System.IO;
using System.Net;
namespace Exposure_Photography_V2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void MainForm()
{
int ButtonSize = 175;
int SidesBorder = 150;
int ButtonFontSize = 20;
this.Size = new Size(900, 600);
this.Show();
Height = this.Size.Height;
Width = this.Size.Width;
BackColor = Color.Black;
Text = "Exposure Photography";
Button PubPhoto = new Button();
Button PriPhoto = new Button();
Button UpdateSite = new Button();
int ButtonVerticalLoc1 = ((Width - 2 * SidesBorder) / 3) - ButtonSize / 4;
int ButtonVerticalLoc2 = ((Width - 2 * SidesBorder) / 3) * 2 - ButtonSize / 4;
int ButtonVerticalLoc3 = (Width - 2 * SidesBorder) - ButtonSize / 4;
int ButtonHeightLoc = Height / 2 - 100 - ButtonSize / 8;
PubPhoto.Parent = this;
PubPhoto.Size = new Size(ButtonSize, ButtonSize);
PubPhoto.Location = new Point(ButtonVerticalLoc1, ButtonHeightLoc);
PubPhoto.Text = "Add a Public Photoshoot";
PubPhoto.Font = new Font(Font.FontFamily, ButtonFontSize);
PubPhoto.BackColor = Color.White;
PubPhoto.Click += new EventHandler(PubPhoto_Click);
PubPhoto.Show();
PriPhoto.Parent = this;
PriPhoto.Size = new Size(ButtonSize, ButtonSize);
PriPhoto.Location = new Point(ButtonVerticalLoc2, ButtonHeightLoc);
PriPhoto.Text = "Add a Private Photoshoot";
PriPhoto.Font = new Font(Font.FontFamily, ButtonFontSize);
PriPhoto.BackColor = Color.White;
PriPhoto.Click += new EventHandler(PriPhoto_Click);
PriPhoto.Show();
UpdateSite.Parent = this;
UpdateSite.Size = new Size(ButtonSize, ButtonSize);
UpdateSite.Location = new Point(ButtonVerticalLoc3, ButtonHeightLoc);
UpdateSite.Text = "Update the Website";
UpdateSite.Font = new Font(Font.FontFamily, ButtonFontSize);
UpdateSite.BackColor = Color.White;
UpdateSite.Click += new EventHandler(UpdateSite_Click);
UpdateSite.Show();
}
void PubPhoto_Click(object sender, EventArgs e)
{
//Will hide the starting buttons and show the things needed for PubPhoto
}
void PriPhoto_Click(object sender, EventArgs e)
{
//Same as Pub but slightly different code
}
void UpdateSite_Click(object sender, EventArgs e)
{
//FTP Code but clears the buttons also
}
private void Form1_Load(object sender, EventArgs e)
{
MainForm();
}
}
}
If you have any resources that will help me or any advice, it will be much appreciated.
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
|