Skip to content

Commit

Permalink
changed CenterWindow to PositionWindow
Browse files Browse the repository at this point in the history
updated NuGet packages, buddy window disabled maximize button
  • Loading branch information
erfg12 committed Feb 4, 2022
1 parent ee3b2c5 commit 77bafc1
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 59 deletions.
18 changes: 16 additions & 2 deletions aol_4/Classes/location.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,25 @@ public static string getCurrentWeather()
/// Must be called after form is shown
/// </summary>
/// <param name="f">the form to center</param>
public static void CenterWindow(Form f)
/// <param name="position">0 = center, 1 = right</param>
public static void PositionWindow(Form f, int position = 0)
{
Form ParentForm = f.MdiParent;
if (ParentForm != null)
f.Location = new Point((ParentForm.Width / 2) - (f.Width / 2), (ParentForm.Height / 2) - (f.Height / 2));
{
switch (position)
{
case 0:
f.Location = new Point((ParentForm.Width / 2) - (f.Width / 2), (ParentForm.Height / 2) - (f.Height / 2));
break;
case 1:
f.Location = new Point((ParentForm.Width) - (f.Width + 10), (ParentForm.Height / 2) - (f.Height / 2));
break;
default:
break;
}

}
}

/*public static List<string> getForecastWeather()
Expand Down
2 changes: 1 addition & 1 deletion aol_4/Forms/account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private void panel1_MouseMove(object sender, MouseEventArgs e)

private void accForm_Shown(object sender, EventArgs e)
{
location.CenterWindow(this);
location.PositionWindow(this);
if (screenName.Items.Contains(Properties.Settings.Default.lastAcc))
screenName.Text = Properties.Settings.Default.lastAcc;
else
Expand Down
1 change: 1 addition & 0 deletions aol_4/Forms/browse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ private void miniBtn_Click(object sender, EventArgs e)

private void Form1_Shown(object sender, EventArgs e)
{
location.PositionWindow(this);
ToolTip toolTip1 = new ToolTip();
toolTip1.SetToolTip(this.closeBtn, "Close Window");
toolTip1.SetToolTip(this.maxBtn, "Maximize Window");
Expand Down
95 changes: 48 additions & 47 deletions aol_4/Forms/buddies_online.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion aol_4/Forms/buddies_online.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ private void miniBtn_Click(object sender, EventArgs e)

private void maxBtn_Click(object sender, EventArgs e)
{
maxiMini();
//maxiMini();
}

private void closeBtn_Click(object sender, EventArgs e)
Expand All @@ -325,6 +325,7 @@ public buddies_online()

private void buddies_online_Shown(object sender, EventArgs e)
{
location.PositionWindow(this, 1);
shuttingDown = false; // reset on re-login
buddyTreeView.Nodes[0].Text = "Online 0/" + total.ToString();
buddyTreeView.Nodes[1].Text = "Offline 0/" + total.ToString();
Expand Down
7 changes: 2 additions & 5 deletions aol_4/Forms/home_menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ private void StartForm()

private void home_menu_ShownAsync(object sender, EventArgs e)
{
location.PositionWindow(this);

rects.Add(new Rectangle(5, 155, 175, 80)); // 0 mailbox
rects.Add(new Rectangle(5, 335, 175, 80)); // 1 channels
rects.Add(new Rectangle(5, 425, 175, 80)); // 2 chat_list
Expand All @@ -205,11 +207,6 @@ private void home_menu_ShownAsync(object sender, EventArgs e)
public home_menu()
{
FormBorderStyle = FormBorderStyle.None;
Form frm = this.MdiParent;
if (frm != null)
{
this.Location = new Point((frm.Width / 2) - (this.Width / 2), (frm.Height / 2) - (this.Height / 2));
}
InitializeComponent();
}
#endregion
Expand Down
Loading

0 comments on commit 77bafc1

Please sign in to comment.