Solved

Window form isn't in the top left corner

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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