Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Window form isn't in the top left corner

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

837 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