Solved

Window form isn't in the top left corner

Posted on 2010-11-23
4
640 Views
Last Modified: 2012-05-10
Hello
I have a WindowsForms Application with the main window Form1 . Form1 has the Size 1280x1024 and should cover the complete Screen (Windows Taskbar must be hidden)

But somehow I can't paint the Window on the top of the monitor. The whole application has like an offset from around 30 pixels on the top and from around 10 pixels on the left. That gives me a gap on the top and on the left where I still can see the desktop.

This is how I located the Form1 :

namespace MainWindowLocation
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();

      this.Top = 0;
      this.Left = 0;

    }
  }
}

I work with VS2010 on Windows 7.

What can I do tho locate my Form 100% in the monitor?
0
Comment
Question by:ICSAutomation
  • 3
4 Comments
 
LVL 10

Expert Comment

by:james-ct16
ID: 34194634
Howdy
The following code sample should do the job for you.

Hope that helps

James
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;

            this.Width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;

            this.Height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;

            this.TopMost = true;

            this.StartPosition = FormStartPosition.CenterScreen;

Open in new window

0
 
LVL 10

Expert Comment

by:james-ct16
ID: 34194645
Apologies, you probably want FormBorderStyle.None
0
 
LVL 9

Assisted Solution

by:shadow77
shadow77 earned 45 total points
ID: 34195222
Why not just set the WindowState property of your form to Maximized?
0
 
LVL 10

Accepted Solution

by:
james-ct16 earned 80 total points
ID: 34195574
Howdy
the reason my solution did not include setting window state maximised was becuase the question states that the task bar must be hidden. if the use does not have auto hide turned on it would still be visible when maximised.
James
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now