|
AFAIK you got two options:
1. Make use of Graphics.MeasureString method and insert "\n" whenever the width of text goes over the label width.
2. There is an article here at CP that shows creating vertical labels. You can customize that and change the text draw mode while keeping the way label grows in size same.
"No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
|
|
|
|
|
I didnt get anything and now i am confused!
Please Help
|
|
|
|
|
Graphics.MeasureString returns the approximate width that will be needed to display the text on screen. Now, you know the width of the label. So, you can get the width of the text you want to print in the label. Next, add "\n" at appropriate places so that the width of each line is less than that of the label.
In the second way, you need to search the CP article for vertical labels. The only difference in that label and the one you need is the way text is displayed in the label. So. just change that and you should be done.
"No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
|
|
|
|
|
No ans!!!!!!!!!!!!!!!!!!!!!!!!1
|
|
|
|
|
What do you want us to do? Hold your hand while you type it in?
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
|
i ma copying a file from a location to a destination
but now i m unale to separate the file name that is come in with the whole path of the file
please help me
|
|
|
|
|
make (for)loop that run in reverse searching for('\\')char then(break)
|
|
|
|
|
Why? There is a string.LastIndexOf method...
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
There are quite a few ways to do this, it will depend on what file information you have available.
String: Use String.LastIndexOf to find the final '\' character, and String.Substring to extract just the file name. Or just use Path.GetFileName(string s) to extract it from any string.
FileInfo: Use FileInfo.Name to extract just the file name.
There are probably others, but these should cover most cases.
All those who believe in psycho kinesis, raise my hand.
My 's gonna unleash hell on your ass. tastic!
|
|
|
|
|
Read up on the Path class; it holds everything you could want about file path strings.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
That is the correct answer.
|
|
|
|
|
You can do it one of two ways:
string[] pathParts = myPath.Split('\\');
and you'll end up with an array of strings that represent the various components.
Or, you can use the various System.Path.IO.GetXXXXX methods.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Hi all,
I am having difficulties formatting the output of the following writeline statement.
Console.WriteLine("CYLINDER1:\n RADIUS:"+ t1.Rad+"\n LENGTH:"+ t1.Len+"\n AREA:"+ t1.findArea()+"\n VOLUME:" + t1.findVolume());
Both radius and length are of type double, and both methods, findArea() and findVolume(), are defined as follows:
public double findArea()
{
return 2*(Math.PI * radius * radius) + 2*(Math.PI * radius * length);
}
public double findVolume()
{
return Math.PI *(radius * radius *length);
}
I would like the outputs of Area and Volume to have 4 numbers behind the decimal place. Please take a look and see what I'd have to change to make it output what I want. Thank you in advance for your help.
|
|
|
|
|
I was not sure you meant 4 numbers 'before' or 'after' the number when you mentioned 'behind'.
To set 4 numbers before the decimal use -
Console.WriteLine("{0:D4}", t1.findArea());
To set 4 numbers after the decimal use -
Console.WriteLine("{0:N4}", t1.findArea());
|
|
|
|
|
Hi Abhinav S,
Thanks for responding however, I already thought about doing what you have suggested prior to posting this question. The reason I did not go that route is because if I had decided to use placeholders to hold the incoming data, I'd have to have a writeLine statement for every variable within my original write statement. As you can see in my post I did not use any placeholders at all in my writeline statement. All I used are the string literals for AREA and VOLUME followed by t1.findArea() and t1.findVolume() etc. Is there any way I can still have the outputs I'm looking for without having to resort to having a writeline statement for each variable within my original writeline statement? Thanks again for your help.
|
|
|
|
|
Console.WriteLine("CYLINDER1:\n RADIUS:"+ t1.Rad+"\n LENGTH:"+ t1.Len+"\n AREA:"+ t1.findArea().tostring(".0000")+"\n VOLUME:" + t1.findVolume().tostring(".0000"));
is that what you want?
|
|
|
|
|
Hi sanforjackass,
Thankyou so much that is exactly what I wanted.
|
|
|
|
|
|
Hi everyone,
Thank you, you all have really helped expand my knowledge on string formatting.
|
|
|
|
|
can anyone help me to get window using process thread
SUCIL
|
|
|
|
|
You can use this to get an instance to the current thread:
Thread _currentThread = Thread.CurrentThread
Cheer's,
Alex Manolescu
|
|
|
|
|
Are you looking for the main form in your own application ?
A main window in a different application?
Is the other process a .NET application?
Please explain
|
|
|
|
|
I assume that you want to get the window handle from a thread id. To do that, I would:
- Pass the thread id to GetProcessIdOfThread() to obtain a process id
- Because a process can open multiple windows, you need to return a collection. Iterate every window, getting their process ids. If it matches the id from 1., then add the window handle to the collection
|
|
|
|
|
i m try to save a file but it does not work
can anybody suggest me some good tectics using C# codings
|
|
|
|