|
Hi,
Graphics.MeasureString() takes the same parameters as DrawString() except for the starting
point, and returns the size of the text.
You could first measure with some font size, then if too wide, reduce the font size
proportionally; as soon as the font size has been reduced by 50%, you could use the same
height to show two lines of text!
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi!
I need to activate a function after 5 seconds that the form is running, i created this void fnction in the general class of the project and now i am trying to run it from the TimerHandler function and i get this error:
Error 1 An object reference is required for the nonstatic field, method, or property 'Update_Installer.Form1.Form1_Main()' C:\Documents and Settings\Yossi_Tubis\My Documents\Visual Studio 2005\Projects\Update_Installer\Update_Installer\Update_Installer\Form1.cs 121 13 Update_Installer
this is the TimerFunction:
private static void TimerHandler(Object myObject, EventArgs myEventArgs)
{
Form1_Main();
}
What i am doing wrong?
Thanks
|
|
|
|
|
Are you accessing a normal method withing a static one. In that case, you need to have an instance member and then call the normal method using the instance member right?
|
|
|
|
|
Are you sure you need your handler to be static? I never do...
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
If i do not do it as static i am getting this error:
Error 1 An object reference is required for the nonstatic field, method, or property 'Update_Installer.Form1.TimerHandler(object, System.EventArgs)' C:\Documents and Settings\Yossi_Tubis\My Documents\Visual Studio 2005\Projects\Update_Installer\Update_Installer\Update_Installer\Form1.cs 112 31 Update_Installer
|
|
|
|
|
Hi
guys, i am working on console application in C# , from which i have to generate emails in large number, i want to give delay between sending emails, i am sending emails one by one with System.Net.Mail class and smtp classes, hows this possible any one got any idea, kindly let me know in ASAP, thanks in advance ,
regards,
|
|
|
|
|
Other than the delay in SMTP, SystemNetMail does not seem to have any Waits. One thing is that you can introduce a Thread.Sleep between email transmissions. The other way would be to check whether Persits MailSender MailQueue addresses your requirement.
|
|
|
|
|
King Shez wrote: from which i have to generate emails in large number,
People on CodeProject generally don't like spam. Is that what you are doing?
|
|
|
|
|
Going by his profile and the nature of the messages that he has posted, I just thought he should be a newbie with a requirement like Newsletters or similar thing.
|
|
|
|
|
Man i am not generating spam emails, i have to generate legal emails from my application to our users,
regards,
|
|
|
|
|
King Shez wrote: i am sending emails one by one with System.Net.Mail class and smtp classes
King Shez wrote: i want to give delay between sending emails
So you want a delay between each email? Why?
Anyway there are many forms but the simplest would be to use System.Threading.Thread.Sleep( milliseconds)
|
|
|
|
|
How can i get the name of the Tree Node in Tree View that where check?
|
|
|
|
|
That's easy:
treeView1.SelectedNode.ToString();
Virtual1ty
"Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
Sir, thank you for replying to my question.. .. sir, what im trying to do is to get the name of the tree node that were checked.. how can i get the name of the tree node that where checked?
|
|
|
|
|
The function should return the name of the tree node that was checked.
According to MSDN:
"TreeView.SelectedNode Property
Gets or sets the tree node that is currently selected in the tree view control."
Read about it here[^]
Virtual1ty
"Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
Selected and Checked are two different things in the TreeView. As stated by PIEBALDconsult, you will need to loop over all the nodes and look at their Checked property.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
You'll have to enumerate the Nodes inspecting each.
|
|
|
|
|
As others have said, you can itterate through the treenodes and check the state of each node.
I've needed to do something similar in a recent app with a significant number of nodes and I found it much quicker to create a custom TreeView with a checkedItems property of type List<treenode> and add or remove from that list using the existing AfterCheck/BeforeCheck methods.
|
|
|
|
|
I'm a SQL guy and a novice to VS. I have to develop - rather quickly - a plug-in for a certain commercial windows product (RMS) that is promised to be re-released by microsoft using .NET 2.0 - although it's doubtful it will be released bug-free and on schedule.
I'm supposed to develop the app in C# but one of the things I don't want to re-invent are calendaring, datebook, coltrols ala Outlook.
here I found a number of potential components that look like they could be what I need:
http://www.componentsource.com/features/calendar-schedule/index.html
in particular, this one seems to have all the bells and whistles I'm looking for:
http://www.componentsource.com/products/codejock-xtreme-calendarpro-activex/index.html
however, it comes in two flavors, activeX COM, and MFC C++
my question is, should it matter that they are not .NET and C#? On the one hand, I assume that all the properties and methods I need will be exposed and I don't anticipate a need to alter their code. On the other hand, I don't suppose it's very future proof since eventually, after my demo beta, and after MS finally releases the .NET version of RMS, I should get to 100% C# .NET.
could someone shed some light on relevent factors of this decision or make some recommendations?
Thank you
|
|
|
|
|
If you are developing in C#, then the Code Jock components would not be the best way to go. There are other vendors with calender type controls available here[^]. On the left side you can further filter the list depending on whether you are developing a WinForms or Web app.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Try Infragistics controls. They gel well with C# applications.
|
|
|
|
|
I've heard good things about Telerik RAD controls, both for Win.Forms and Web.Forms, the common criticism about Infragistics is that the controls are bloated.
|
|
|
|
|
I went with Devexpress. I'm very impressed with their product and especially their website tutorial support.
|
|
|
|
|
Hy,
How can I simulate a BackSpace on a RichTextBox in OnKeyPress or OnKeyDown methods?
thx
|
|
|
|
|
Write the following code in the RichTextBox's OnKeyPress or OnKeyDown event handler:
SendKeys.Send("{BACKSPACE}"); And that's it.
If you don't want the user to write text in the RichTextBox, just set it's property ReadOnly to true instead of doing this.
-- modified at 11:16 Thursday 27th September, 2007
Virtual1ty
"Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|