Solved

Window form isn't in the top left corner

Posted on 2010-11-23
4
641 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

785 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