473,385 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Difference between Form.DesktopLocation() and Form.Location() ??

153 100+
The code below shows the same values for both
private void mainform_Move(object sender, EventArgs e)
{
lbllocation.Text = "location" + this.Location.ToString();
lbldesktoplocation.Text = "location" + this.DesktopLocation.ToString();
}

what exactly is the difference ?
Dec 3 '08 #1
14 4970
PRR
750 Expert 512MB
i guess they are same ...
"In lieu of using the Location property, the DesktopLocation property can be used to set the location of your form. This property sets the location of your form relative to the taskbar and is useful if the taskbar has been docked to the top or left of the user's monitor. Docking the taskbar in this fashion obscures the desktop coordinates (0,0)." -MSDN
Desktoplocation: A Point that represents the location of the form on the desktop.
Location :The Point that represents the upper-left corner of the Form in screen coordinates
Desktop Location
Dec 3 '08 #2
akshaycjoshi
153 100+
Hmm there must be atleast some minor difference, will wait for others for answer.
Dec 3 '08 #3
Curtis Rutland
3,256 Expert 2GB
DesktopLocation is exactly that...where it is on the desktop. So if you have extra toolbars or you have your task bar moved to the side or the top, your DesktopLocation will be different than your Location.

Location is always relative to (0,0) of the screen. But if you move your windows taksbar to the top, your Y coordinates will differ by about 34, because the DesktopLocation starts where the Desktop actually starts...after the taskbar.

If you want to try it out, make a form with a label. Handle the form's Move event. In the handler, do something like this:
Expand|Select|Wrap|Line Numbers
  1. 'VB code, because I already had a vb project open:
  2. Dim m As String = String.Format("Loc: {0},{1}  |  Des: {2},{3}", Me.Location.X, Me.Location.Y, Me.DesktopLocation.X, Me.DesktopLocation.Y)
  3. Label2.Text = m
And you'll see the difference...if there is any for you. If there isn't, unlock your taskbar and move it to the top. Then you will see a difference.
Dec 3 '08 #4
akshaycjoshi
153 100+
@insertAlias
Ohh thanks for the explaination insertAlias!
Dec 3 '08 #5
Plater
7,872 Expert 4TB
I would guess it probably plays into if you have multiple screens too
Dec 3 '08 #6
Curtis Rutland
3,256 Expert 2GB
That doesn't seem to affect it, Plater. Just things that take up desktop space that don't belong to the desktop, like toolbars.
Dec 3 '08 #7
akshaycjoshi
153 100+
@Plater
let me content with one screen as of now hahhaha (what is multiple screen now ?)
Dec 3 '08 #8
Curtis Rutland
3,256 Expert 2GB
@akshaycjoshi
....more than one monitor connected to the same PC?
Dec 3 '08 #9
akshaycjoshi
153 100+
hmmm what is the use of connecting multiple monitore to the same PC when all will display the same thing.
Anyways this is out-of-topic so you can ignore this question :)
Dec 3 '08 #10
Curtis Rutland
3,256 Expert 2GB
No, I'll answer.

They don't have to both show the same thing...you can extend your desktop across both of them, making it act like one large display, except maximizing still only fills one window. It's especially nice for coding, if you have to look at your database at the same time. Have your code up in one, your DB up in the other. Or if you have to compare documents...or anything that requires more than one window at a time.

So, for example, I have two 19 inch monitors right now. They're both at 1280x1024 resolution. My desktop is actually 2560x1024 pixels, because it treats them as one big screen.

Also, there are some good uses for the "cloned view" where both show the same thing...like for projectors. Also, I saw a setup in a photographer's place, where they had a monitor facing forward and backwards, so that the client could sit on the other side of the desk, and preview pics with them.
Dec 3 '08 #11
balabaster
797 Expert 512MB
@insertAlias
I have 3 and some days I still wonder if I could have more. I'm working my way up to the 6 that John Travolta has in Operation: Swordfish.
Dec 3 '08 #12
Curtis Rutland
3,256 Expert 2GB
IIRC that was seven, and that would be all kinds of neat...having them all wall mounted....
/drools


Anyway, I think you can go up to nine without specialized hardware...I heard that somewhere from someone, so I have no idea if that's true.
Dec 3 '08 #13
balabaster
797 Expert 512MB
@insertAlias
I doubt very much my boss would let me have all that equipment and if I "wasted" that kind of money my home computer, my wife would kill me. hehe. I guess I should've married a woman that's as into computers as I am :o)
Dec 3 '08 #14
Curtis Rutland
3,256 Expert 2GB
No, because then you'd be buying her those monitors ;)

But seriously, I'm picking up a 24" over the holidays....it's going to be great.

At home I like to have one big monitor, because I play games. Working, I like multiples.
Dec 3 '08 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: saiho.yuen | last post by:
Hi, Is anyone know what is the difference between Location.href and Window.location.href Thanks you very much:) Saiho
3
by: Jarek Mielcarek | last post by:
hi, I've problem to locate form on screen. I'd like to show modal form near a textbox after user click on it. here is the code: Private Sub myTextBox_MouseDown(ByVal sender As Object, ByVal e As...
4
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps...
4
by: Philip Wagenaar | last post by:
I have made a form with a tab that containts groupboxes and those contain checkboxes. When I run the application sometimes the outlining for some groupboxes are not shown, if I switch tabs and...
14
by: Galen Somerville | last post by:
My current screen resolution is set to 1024 x 768. My form size always comes up as 1032 x 748. I have tried the help sample ' Retrieve the working rectangle from the Screen class ' using the...
2
by: Rich | last post by:
Greetings. I have a child form inside an MID parent form. The child form is wider than the MID parent form. The child form contains a number of textboxes which are positioned from left to...
8
by: Ryan | last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip, data binding elements (dataset, binding source, table adapter), tab control with 7 tab pages, each page contains a...
1
by: Marc the Demi-Programmer | last post by:
I am overriding WncProc to make sure my form's location stays within specified parameters. Basically, it has to stay at the top of the screen and not be off to either of the sides. All that works...
2
by: Steve Richter | last post by:
I am using ShowDialog to show a popup form and want to position the popup relative to the control on the form the popup is pertinent to. For this, I am using FormStartPosition.Manual to set the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.