Click here to Skip to main content
15,915,501 members
Home / Discussions / C#
   

C#

 
GeneralRe: Articles not on Office Add-Ins Pin
Heath Stewart8-May-04 19:52
protectorHeath Stewart8-May-04 19:52 
GeneralRe: Articles not on Office Add-Ins Pin
Tony Archer9-May-04 9:07
Tony Archer9-May-04 9:07 
GeneralRe: Articles not on Office Add-Ins Pin
Heath Stewart9-May-04 9:30
protectorHeath Stewart9-May-04 9:30 
GeneralNullReference Exception in system.dll at System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback Pin
kayhustle7-May-04 13:48
kayhustle7-May-04 13:48 
GeneralRe: NullReference Exception in system.dll at System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback Pin
Heath Stewart8-May-04 19:48
protectorHeath Stewart8-May-04 19:48 
GeneralRe: NullReference Exception in system.dll at System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback Pin
kayhustle10-May-04 20:35
kayhustle10-May-04 20:35 
GeneralRe: NullReference Exception in system.dll at System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback Pin
Heath Stewart11-May-04 2:59
protectorHeath Stewart11-May-04 2:59 
GeneralDisplaying long string in tab page label Pin
Flack7-May-04 13:15
Flack7-May-04 13:15 
Hello,

I am drawing the tab control myself and here is the problem:

In the app the user is allowed to change the tab name. However, if the string he/she enters is too long, not all of it is displayed on the tab label. Here is the code I am using:

<br />
private void buttonsTab_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)<br />
		{<br />
			Font f;<br />
			Brush foreBrush;<br />
<br />
			f = new Font(e.Font, FontStyle.Italic | FontStyle.Bold);<br />
                        foreBrush = Brushes.Black;<br />
<br />
			string tabName = this.buttonsTab.TabPages[e.Index].Text;<br />
			StringFormat sf = new StringFormat();<br />
			sf.Alignment = StringAlignment.Center;<br />
			Rectangle r = e.Bounds;<br />
			r = new Rectangle(r.X, r.Y + 3, r.Width, (int)f.GetHeight() + 2);<br />
			e.Graphics.DrawString(tabName, f, foreBrush, r, sf);<br />
}<br />


I set the height of the rectangle I use in DrawString to the font height. I dont want the string to wrap and start on a new line.

Is there anyway that I can ensure that the entire string is displayed at once?
Is my only option to limit how long the new name that the user enters can be?

Thanx for the help Big Grin | :-D
-Flack
GeneralRe: Displaying long string in tab page label Pin
leppie7-May-04 13:52
leppie7-May-04 13:52 
GeneralRe: Displaying long string in tab page label Pin
Flack7-May-04 14:55
Flack7-May-04 14:55 
GeneralRe: Displaying long string in tab page label Pin
Heath Stewart8-May-04 19:42
protectorHeath Stewart8-May-04 19:42 
GeneralOverriding OpenFileDialog Pin
MrEyes7-May-04 13:10
MrEyes7-May-04 13:10 
GeneralRe: Overriding OpenFileDialog Pin
CWIZO7-May-04 20:59
CWIZO7-May-04 20:59 
GeneralRe: Overriding OpenFileDialog Pin
Heath Stewart8-May-04 19:34
protectorHeath Stewart8-May-04 19:34 
GeneralRe: Overriding OpenFileDialog Pin
Heath Stewart8-May-04 19:37
protectorHeath Stewart8-May-04 19:37 
GeneralRe: Overriding OpenFileDialog Pin
CWIZO8-May-04 19:46
CWIZO8-May-04 19:46 
QuestionGraphic problem? Pin
Alan Zhao7-May-04 11:48
Alan Zhao7-May-04 11:48 
AnswerRe: Graphic problem? Pin
kayhustle7-May-04 14:19
kayhustle7-May-04 14:19 
GeneralUpload Very Large Files to SQL Server Pin
Adam Hable7-May-04 11:42
Adam Hable7-May-04 11:42 
GeneralRe: Upload Very Large Files to SQL Server Pin
leppie7-May-04 13:49
leppie7-May-04 13:49 
GeneralRe: Upload Very Large Files to SQL Server Pin
Colin Angus Mackay7-May-04 23:59
Colin Angus Mackay7-May-04 23:59 
Questionhow can I get post or get data that send by "Microsoft Web Browser" Pin
Renegade_c7-May-04 11:12
Renegade_c7-May-04 11:12 
GeneralPassing Public int Variable to Win Form Pin
Dave Brighton7-May-04 10:53
Dave Brighton7-May-04 10:53 
GeneralRe: Passing Public int Variable to Win Form Pin
Colin Angus Mackay7-May-04 13:02
Colin Angus Mackay7-May-04 13:02 
GeneralRe: Passing Public int Variable to Win Form Pin
Dave Brighton7-May-04 14:11
Dave Brighton7-May-04 14:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.