The code below shows the same values for both
private void mainform_Move(o bject sender, EventArgs e)
{
lbllocation.Tex t = "location" + this.Location.T oString();
lbldesktoplocat ion.Text = "location" + this.DesktopLoc ation.ToString( );
}
what exactly is the difference ?
14 5024 PRR 750
Recognized Expert Contributor
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
Hmm there must be atleast some minor difference, will wait for others for answer.
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: - 'VB code, because I already had a vb project open:
-
Dim m As String = String.Format("Loc: {0},{1} | Des: {2},{3}", Me.Location.X, Me.Location.Y, Me.DesktopLocation.X, Me.DesktopLocation.Y)
-
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.
Plater 7,872
Recognized Expert Expert
I would guess it probably plays into if you have multiple screens too
That doesn't seem to affect it, Plater. Just things that take up desktop space that don't belong to the desktop, like toolbars.
@Plater
let me content with one screen as of now hahhaha (what is multiple screen now ?)
@akshaycjoshi
....more than one monitor connected to the same PC?
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 :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
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
|
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 (...)
Dim r As New Rectangle(TextBox.Width, 1, 16, 18)
If r.Contains(New Point(e.X, e.Y)) Then
With popUp
.DesktopLocation = PointToScreen(New Point(r.Right - popUp.Size.Width,
r.Bottom + 2))
|
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 further away, completely leaving the
selector box area.
Any ideas? VS 2003 and VB.Net
This is a simple application at the moment but the form is inherited from a
|
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 back sometimes all outlining is shown and
sometimes are not shown. I have no idea what is going wrong.
What also is weird is that when I open the form from my main application I
can resize the form, even though it is locked, and that when I cut...
|
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 PrimaryScreen and the WorkingArea properties.
Dim workingRectangle As System.Drawing.Rectangle = _
Screen.PrimaryScreen.WorkingArea
' Set the size of the form slightly less than size of
| |
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 right on the child form where the textbox on the
right is not viewable because it extends beyond the right border of the MDI
parent form. What I need to happen is when I tab through the textboxes -
when I tab into the textbox on the right side of...
|
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 picture box, lots of text boxes (for
input).. you get the idea. All of a sudden everything on the form has
disappeared, it looks like a blank, newly created form. I can still get to
the properties of every item on the form using the drop-down box in...
|
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 when the
form is in its minimal size. However, when the form is maximized using
the appropriate button the code that is supposed to set the location is
ignored. When the form is switched back to the standard dimensions
through the restore...
|
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 position of
the form relative to the desktop.
I can calc the location of a control relative to the client rect of a
form. But since I am positioning the popup form relative to the
desktop, I need to know the DesktopLocation of controls on the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |