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

Placing two labels exactly after eachother

Hello,

I was wondering how to oder two labels in a ASP.NET web form exactly after
eachother by settings its LEFT and WIDTH propertys. Depending on the font
used and length of the string, this is dynamic. Is there an exact way to
calculate how many pixels a label is?

Regards,
Christer Bermar
Jul 21 '05 #1
3 1109
Christer,

In my opinion it should be accoording to this page, which is of course as
well for the heigth.

http://msdn.microsoft.com/library/de...widthtopic.asp

I hope this helps?

Cor

"Christer Bermar" <no@spam.com> >

I was wondering how to oder two labels in a ASP.NET web form exactly after
eachother by settings its LEFT and WIDTH propertys. Depending on the font
used and length of the string, this is dynamic. Is there an exact way to
calculate how many pixels a label is?

Jul 21 '05 #2
Yes i understand that it is the width property, but it is what to put there
that is what im looking for. If a user inputs "label1" in the left label
with a font "Arial" it will be x pixels long. This is what i want to
calculate so i can position the right label after the left label.

How does one calculate the number of pixels a string/label consumes? If i
can get the number of pixels a label is long, i can just position the other
label with label.Width=Unit.Pixel(x);

Regards,
Christer Bermar

"Cor Ligthert" <no************@planet.nl> wrote in message
news:Os**************@TK2MSFTNGP11.phx.gbl...
Christer,

In my opinion it should be accoording to this page, which is of course as
well for the heigth.

http://msdn.microsoft.com/library/de...widthtopic.asp

I hope this helps?

Cor

"Christer Bermar" <no@spam.com> >

I was wondering how to oder two labels in a ASP.NET web form exactly
after eachother by settings its LEFT and WIDTH propertys. Depending on
the font used and length of the string, this is dynamic. Is there an
exact way to calculate how many pixels a label is?


Jul 21 '05 #3
Christer,

Untested to get the lenght of the string text of the time now
\\\
Dim textSize As SizeF =
Graphics.FromHwnd(Me.Handle).MeasureString(Now.ToS tring, Me.Font)
///
I hope this helps?

Cor

"Christer Bermar" <no@spam.com>
Yes i understand that it is the width property, but it is what to put
there that is what im looking for. If a user inputs "label1" in the left
label with a font "Arial" it will be x pixels long. This is what i want to
calculate so i can position the right label after the left label.

How does one calculate the number of pixels a string/label consumes? If i
can get the number of pixels a label is long, i can just position the
other label with label.Width=Unit.Pixel(x);

Regards,
Christer Bermar

"Cor Ligthert" <no************@planet.nl> wrote in message
news:Os**************@TK2MSFTNGP11.phx.gbl...
Christer,

In my opinion it should be accoording to this page, which is of course as
well for the heigth.

http://msdn.microsoft.com/library/de...widthtopic.asp

I hope this helps?

Cor

"Christer Bermar" <no@spam.com> >

I was wondering how to oder two labels in a ASP.NET web form exactly
after eachother by settings its LEFT and WIDTH propertys. Depending on
the font used and length of the string, this is dynamic. Is there an
exact way to calculate how many pixels a label is?



Jul 21 '05 #4

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

Similar topics

12
by: dave | last post by:
Hello, I've got a site project that i've got to design a layout without resorting to tables. I want to use a table for tabular data not any formatting layout, primarily emphasis needs to be on...
1
by: sandyuhd | last post by:
HI, i'm creating acomposite web control. for this i'm using iframe as dropdown. Through javascript i'm creating iframe onthe page. and ihave to display labels and textboxesin the iframe which...
2
by: Fred | last post by:
Hi. Sorry, but I don't know where else to ask. I wrote a access shipping database and we currently use the web interface for DHL to print shipping labels. That means we have to manualy transpose...
3
by: Grim Reaper | last post by:
I print mailing labels out of Access 2000 databases about 3 to 4 times a week. I have been having problems with one thing since I have been printing mailing labels. I print mailing labels by...
7
by: Jared | last post by:
Here is my situation. I have multiple labels on a form but only certain ones will become visible while using the form. Depending on which check box(s) you pick, on another form, determines the...
2
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to...
3
by: Christer Bermar | last post by:
Hello, I was wondering how to oder two labels in a ASP.NET web form exactly after eachother by settings its LEFT and WIDTH propertys. Depending on the font used and length of the string, this is...
24
by: Mike Otten | last post by:
Any help greatly appreciated. The validated page is at: http://myweb.stedwards.edu/michaelo/ddtab.htm The trouble is with the radio buttons (2/3-down the left column). The radios are...
3
by: Bram2 | last post by:
When putting a form on a webpage, I prefer the labels and edit boxes for all fields to be aligned, e.g. like this: http://i44.tinypic.com/6dvceo.png This is easily done by putting it all in a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
jinu1996
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...
0
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...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.