Problem with placing labels and aligning texts on them

  • Thread starter Thread starter C
  • Start date Start date
C

C

What worked in VB6 does not work with VB.net This looks like a simple
problem but labels behave in a different way in VB.net, so I am not
making much progress with this little problem.

I would like to place labels under the x-axis (500 pixels wide) with
numbers and the variable name on the same level. For example, if the x-
axis was time in minutes from 0 to 34.4, I would like to place 0 left
justified at the left extreme, 17.2 in the middle centred, and then
34.4 on the right, right justified. I can place three labels (fixed
size or autosizable) with the alignments and it works all right.

Then I would like to place "time, min" centred between the texts 0 and
17.2, or centred around one-fourth the width of the x-axis (125 pixels
from the beginning of the axis). Placing a label there with centred
alignment will sometimes overlap on the numbers, and make parts of
either labels covered.

What is a good way to put these four labels? Should the labels be
autosizable or fixed size? Thanks for any advice.
 
It is amazing, something is working in VB6 and not in VB7, or VB7.1 or VB8
or VB9 or VB10 (can you give us a clue).

However,

Are you talking about the string in a label or about a label.

A label can be located precise with its starting point on a pixel.

If you want to do a centre alignment of a pixel then you have endless way,
you can put them in a groupbox or panel and use the designer tools to centre
them in those.

Be aware that there is a big difference in an fixed or an autosize label, so
with telling to us that you use both you give us also misinformation.

Can you not be more clear. With telling us in minutes what you want to be
done, you make the given text by you even more difficult to understand.

Cor

"C" wrote in message

What worked in VB6 does not work with VB.net This looks like a simple
problem but labels behave in a different way in VB.net, so I am not
making much progress with this little problem.

I would like to place labels under the x-axis (500 pixels wide) with
numbers and the variable name on the same level. For example, if the x-
axis was time in minutes from 0 to 34.4, I would like to place 0 left
justified at the left extreme, 17.2 in the middle centred, and then
34.4 on the right, right justified. I can place three labels (fixed
size or autosizable) with the alignments and it works all right.

Then I would like to place "time, min" centred between the texts 0 and
17.2, or centred around one-fourth the width of the x-axis (125 pixels
from the beginning of the axis). Placing a label there with centred
alignment will sometimes overlap on the numbers, and make parts of
either labels covered.

What is a good way to put these four labels? Should the labels be
autosizable or fixed size? Thanks for any advice.
 
Am 29.08.2010 12:39, schrieb C:
What worked in VB6 does not work with VB.net This looks like a simple
problem but labels behave in a different way in VB.net, so I am not
making much progress with this little problem.

I would like to place labels under the x-axis (500 pixels wide) with
numbers and the variable name on the same level. For example, if the x-
axis was time in minutes from 0 to 34.4, I would like to place 0 left
justified at the left extreme, 17.2 in the middle centred, and then
34.4 on the right, right justified. I can place three labels (fixed
size or autosizable) with the alignments and it works all right.

Then I would like to place "time, min" centred between the texts 0 and
17.2, or centred around one-fourth the width of the x-axis (125 pixels
from the beginning of the axis). Placing a label there with centred
alignment will sometimes overlap on the numbers, and make parts of
either labels covered.

Isn't it because there is just not enough space?
What is a good way to put these four labels? Should the labels be
autosizable or fixed size? Thanks for any advice.

How can we know? Usually I set Autosize = True, unless I want to make
use of the TextAlign property.
 
It is amazing, something is working in VB6 and not in VB7, or VB7.1 or VB8
or VB9 or VB10 (can you give us a clue).

However,

Are you talking about the string in a label or about a label.

Both. Sometimes the numbers will be small, so I would like to use the
extra space for the variable name. In VB6, you could have labels with
transparent background, so overlapping was not a problem.
A label can be located precise with its starting point on a pixel.

If you want to do a centre alignment of a pixel then you have endless way,
you can put them in a groupbox or panel and use the designer tools to centre
them in those.

Be aware that there is a big difference in an fixed or an autosize label,so
with telling to us that you use both you give us also misinformation.

I tried both, but it does not help much. I have to then change the
size and location of the label for the variable name. It gets messy.
Can you not be more clear. With telling us in minutes what you want to be
done, you make the given text by you even more difficult to understand.

Cor

I would like "clean and decent-looking" text under the x-axis, which
can look like the following

0.0 time, min 13.5 27.0

65 temperature 90 115

0.024 thickness 0.032 0.040

If necessary, I can write here the code I have at present, which does
not work well.

Thanks.
 
Am 29.08.2010 12:39, schrieb C:








Isn't it because there is just not enough space?

When there isn't enough space, nothing is going to help. I want the
stuff on the same level, and not write the variable name under the
level of the numbers.

How can we know? Usually I set Autosize = True, unless I want to make
use of the TextAlign property.

I will have to use TextAlign or I will have to count pixels of each
label text and size the labels, resulting in very messy code.
 
It seems to me that you have used in VB6 a non proportional font and are
using now a proportional one.

http://en.wikipedia.org/wiki/Proportional_font#Proportional_font



"C" wrote in message

It is amazing, something is working in VB6 and not in VB7, or VB7.1 or VB8
or VB9 or VB10 (can you give us a clue).

However,

Are you talking about the string in a label or about a label.

Both. Sometimes the numbers will be small, so I would like to use the
extra space for the variable name. In VB6, you could have labels with
transparent background, so overlapping was not a problem.
A label can be located precise with its starting point on a pixel.

If you want to do a centre alignment of a pixel then you have endless way,
you can put them in a groupbox or panel and use the designer tools to
centre
them in those.

Be aware that there is a big difference in an fixed or an autosize label,
so
with telling to us that you use both you give us also misinformation.

I tried both, but it does not help much. I have to then change the
size and location of the label for the variable name. It gets messy.
Can you not be more clear. With telling us in minutes what you want to be
done, you make the given text by you even more difficult to understand.

Cor

I would like "clean and decent-looking" text under the x-axis, which
can look like the following

0.0 time, min 13.5 27.0

65 temperature 90 115

0.024 thickness 0.032 0.040

If necessary, I can write here the code I have at present, which does
not work well.

Thanks.
 
Back
Top