Solved

Window form isn't in the top left corner

Posted on 2010-11-23
4
645 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
[X]
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
  • 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
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…

752 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