473,406 Members | 2,356 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,406 software developers and data experts.

Center of Drawing Area?

Err...this is kinda strange.

I created a windows form that is 240 pixels wide.

When I use DrawLine(pen, 120, 100, 120, 200)

I'm getting a vertical line but it is not exactly in the center of the form.

However, DrawLine(pen, 110, 100, 110, 200) looks pretty much centered.

What did I do wrong?

Are there some margins or borders that I need to account for?

Drew

Nov 15 '05 #1
2 1566
Oh wait...I'm painting inside a control that must be causing the offset, I
guess.

Drew
"Drew" <so*****@hotmail.com> wrote in message
news:u5**************@tk2msftngp13.phx.gbl...
Err...this is kinda strange.

I created a windows form that is 240 pixels wide.

When I use DrawLine(pen, 120, 100, 120, 200)

I'm getting a vertical line but it is not exactly in the center of the form.
However, DrawLine(pen, 110, 100, 110, 200) looks pretty much centered.

What did I do wrong?

Are there some margins or borders that I need to account for?

Drew

Nov 15 '05 #2
Are you aware of the ClientRectangle property?
http://msdn.microsoft.com/library/de...angletopic.asp

Erik

"Drew" <so*****@hotmail.com> wrote in message
news:u5**************@tk2msftngp13.phx.gbl...
Err...this is kinda strange.

I created a windows form that is 240 pixels wide.

When I use DrawLine(pen, 120, 100, 120, 200)

I'm getting a vertical line but it is not exactly in the center of the form.
However, DrawLine(pen, 110, 100, 110, 200) looks pretty much centered.

What did I do wrong?

Are there some margins or borders that I need to account for?

Drew

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tomi Holger Engdahl | last post by:
I am looking for a solution to add on-line drawing tool to a phpBB discussion board. The idea would be that the users can draw their own simple drawings with the tool and attach them easily as...
3
by: Mark Urish | last post by:
I want to center-align the text in 2 Label controls, and I want the 1st char of their text to line up ------------------------------------------------------------------------------ label1.TextAlign...
2
by: Champika Nirosh | last post by:
Hi, I want to create drawing board application that can draw Line, rectagle, circle and free hand drawing. Each drawing need to be transparent, moveable (draggable), have bring to front and...
7
by: Sean | last post by:
Hi, I have a tab control containing few tab pages. On each tab pages, I put an image on the tab page's title bar (the area on top of a tab page, ie where tooltip will appear). If i put both...
6
by: johannblake | last post by:
I am wondering whether it is easy to setup a coordinate system for drawing (using GDI+) that uses meters (or any custom scaling for that matter). Currently, I need to convert from pixels to meters...
3
by: jerry.ranch | last post by:
Hi I'm trying to figure out how to center forms on a page I have a form built with some tabbed pages, and I'm playing with the form properties, but it always displays top and left and not centered...
3
by: Chris Saunders | last post by:
I am fairly new to .Net and C# but am familiar with the Win32 API. I wish to set the pixels of the client area of a window one at a time with a specific color. I have so far discovered that...
7
by: raylopez99 | last post by:
I have a logical drawing space much bigger than the viewport (the screen) and I'd like to center the viewport (the screen) to be at the center of the logical drawing space. After following the...
6
by: charindal | last post by:
i am trying to create a program that is able to draw a housing plan. the user should be able to input the required meters then upon clicking a left,right,up, down button, the system draws a line in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
tracyyun
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.