473,785 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

text alignment and buttons using dotnet Windows Forms

I have a problem where, depending on the text of a button, the display of
that text seems to change size or alignment.

Here is the code:

HomeScoreNameBu tton.ForeColor = Color.Green;
HomeScoreNameBu tton.Font = new System.Drawing. Font("Tahoma",
8.50F, System.Drawing. FontStyle.Regul ar,
System.Drawing. GraphicsUnit.Po int, ((System.Byte)( 0));
this.HomeScoreN ameButton.Locat ion = new System.Drawing. Location(10,10) ;
this.HomeScoreN ameButton.Name = "HomeScoreNameB utton";
this.HomeScoreN ameButton.Size = new System.Drawing. Size(24,16);
this.HomeScoreN ameButton.Text = "Sunset";
this.HomeScoreN ameButton.TextA lign = System.Drawing. ContentAlignmen t.MiddleRight;

the buttons are small (24,16) for a reason, and I can't make them bigger.
when the text of the button (which changes), is too long to display, it is
simply truncated from the right.

If the button text is "Sunset Girls", then it displays as "Sunset G"
(truncated to fit), and displays properly.

However, if the text is "Sunset Boys", then it displays as "Sunset"
(truncated), which is fine, but now the "S" (capital S) loses the topmost
line of the font, as if the vertical alignment of the button text has
changed, or the size of the font has changed.

Any ideas about what is happening?

Terry Brown
www.stickmansoftware.com

Jan 13 '06 #1
0 1139

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

Similar topics

4
12345
by: Stuart Norris | last post by:
Dear Readers, I am attempting to draw box around some text using unicode on multiline label. The label is forty characters wide and 12 lines deep. I have been trying to draw a box around text (centered in the label) on this label. My font on this label is Courier new - hence fixed width character cells.
0
1824
by: Frnak McKenney | last post by:
One of the reasons given for the Allied victory in WWI is that the Nazi armament industry invested so much effort in creating new weapons (e.g. the jet plane) it wasn't able to develop any of them to the point of mass-production. There are days when I experience the same difficulties with C# and dotNET: there are twelve ways to do 'most _any_thing, and I wind up exploring six before I find an acceptable solution. <grin> Case in...
10
1177
by: Aussie Rules | last post by:
Hi, For some reason my App has stopped displaying buttons and other such controls with the XP style. They have all reverted back to the standard style button. I have the buttons.flatstyle set to = system, but they are the same as standard.
2
8093
by: John Smith | last post by:
Hi all; Putting "Due" into the column header of a datagrid. Font is a proportional fort. When the alignment is left, there is some space between the column separator bar and the D in Due. When the alignment is center, Due is centered in the header box. When the alignment is right, the e in Due is partially covered by the column separator bar. Adding space after Due (i.e.. "Due ") does not work. HeaderText seems to be trimmed before...
3
4197
by: Simon Abolnar | last post by:
Is it possible to align headers and text in different way. Because with: dgts.GridColumnStyles(0).Alignment = HorizontalAlignment.Center alignment is set for all column (header and text). Thanks for help! Simon
7
15971
by: Terry Brown | last post by:
I have a problem where, depending on the text of a button, the display of that text seems to change size or alignment. Here is the code: HomeScoreNameButton.ForeColor = Color.Green; HomeScoreNameButton.Font = new System.Drawing.Font("Tahoma", 8.50F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)); this.HomeScoreNameButton.Location = new System.Drawing.Location(10,10);
3
5149
by: MikeY | last post by:
Can anyhow direct me on how to make text trasnparent. The Text is loctated in my custom buttons. A Sample of my code is below. Font fn = new Font("Tahoma",8, System.Drawing.FontStyle.Bold); string str= "Sauteed Spinach & Bacon";
0
1806
by: VorTechS | last post by:
I'm having a problem with an inherited label, applying text rotation to aligned text. If text rotation is applied to the aligned text, the alignment goes 'nuts'. I can find no logic to what is happening. I've built the following code from several examples on the web, if you remove the rotation then alignment works fine: Imports System.ComponentModel
11
19229
by: C.W.Holeman II | last post by:
I what to hide an input element and the following text. I have the selector for the input working and just need to grab the text following it. CSS: form{ display:table; text-align:center; }
0
9645
marktang
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...
0
10330
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, 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...
0
8976
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7500
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
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...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.