|
To achieve this first post this question on the appropriate forum, please. This one is for C#, and what you're asking is for Windows Forms development. There's a Windows Forms forum here.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
If you change the font size of your form, your controls (on the form) will follow this change and will resize automatically. So the only thing you need is to change the font size of your form.
Here is an example for you:
public partial class Form1 : Form
{
float defaultFontSize;
float bigFontSize;
public Form1()
{
InitializeComponent();
defaultFontSize = this.Font.Size;
bigFontSize = 16;
}
private void Form1_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Maximized)
{
if (this.Font.Size < bigFontSize)
{
FontFamily ff = this.Font.FontFamily;
this.Font.Dispose();
this.Font = new System.Drawing.Font(ff, bigFontSize);
Invalidate();
}
}
else if (this.WindowState == FormWindowState.Normal)
{
if (this.Font.Size > defaultFontSize)
{
FontFamily ff = this.Font.FontFamily;
this.Font.Dispose();
this.Font = new System.Drawing.Font(ff, defaultFontSize);
Invalidate();
}
}
}
}
Put some controls on your form and see what happens.
|
|
|
|
|
Thank you for your prompt reply
|
|
|
|
|
You're welcome!
|
|
|
|
|
I would like to generate the data retrieved from a dictionary in a text file, and I would like your help please, if anyone can help me with ideas or examples. thank you
|
|
|
|
|
Please elaborate on your problem. Am I correct in assuming that you have a Dictionary<type, type> and you want to save it to a text file?
If so:
1) Open the file
2) Iterate through your dictionary
3) Write each entry to the file
4) Close the file
Which part are you having difficulties with?
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
I have a dictionary that contains the problems and solutions and I want to write the data into a text file as a table, I'm stuck in the writing of these data in text file
|
|
|
|
|
A simple way to accomplish this is to iterate over the KeyValuePair items and write them out to a Stream. You'll need to delimit the items somehow. I'm not saying this is the best way, but it may achieve exactly what you want.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
ok, thank you, I'll try and I'll gave the results
|
|
|
|
|
tek 2009 wrote: want to write the data into a text file as a table
Well, a text file doesn't hold tables, it only holds flat data, so you will have to decide how to store it so that you can retrieve it later. To save it as flat text is simple:
Dictionary<string, string> dict = new Dictionary<string, string>();
dict.Add("Hello", "There");
dict.Add("Hello again", "There you");
dict.Add("Hello again again", "There you are");
using (TextWriter tw = File.CreateText(@"C:\\temp.txt"))
{
foreach (KeyValuePair<string, string> kvp in dict)
{
tw.WriteLine(kvp.Key + ":" + kvp.Value);
}
tw.Close();
}
Anything more complex will need you to think about data storage in a bit more detail!
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
thank you vey much, it's works , thank you again
|
|
|
|
|
You're welcome.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Can you elaborate more on your question, what exactly you are trying to achieve?
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
Hi
Im not sure where to post this so I will just post it here.
I am getting this error in visual studio.
"Could not find type 'Server.Video'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU."
The project application works perfectly but I cant access the main forms design anymore. I really dont want to have to create the project again as its quite a large. Anyone have any ideas of how I can fix this?
Thanks
|
|
|
|
|
Answer is in your question only
TSWatson wrote: Please make sure that the assembly that contains this type is referenced
so please add reference of missing assembly
Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim
So Smile Please
|
|
|
|
|
hi
i jst wana know how to convert Google Guage Chart In Pdf Format...
is there any way to getting a url for guage chart like bar chart and pie chart..which i hv send and receve respective guage chart in Pdf format
plz solve the problem.....
|
|
|
|
|
Have you tried googling? If you use correct spelling it will help.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
Nagy Vilmos wrote: If you use correct spelling it will help.
I dunno, Google corrects my spelling all the time. Sometimes, it even gets it right!
(It's an impressive piece of spell check technology really - wish more people could use it)
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
i got voice conference code using h323(by fahdi) from here code project, the problem m facing is it works fine on same PC when i put both peers on a single PC. but when i try to run it on LAN receiving call PC get hanged, y is it.
thanks in advance. waiting for reply
here is the code. these are the h323 events i have used
void h323_RemoteBusy()
{
MessageBox.Show("User is busy");
}
void h323_Disconnected(string RemoteUserName)
{
MessageBox.Show("Call Disconnected ");
btnCall.IsEnabled = true;
btnEndCall.IsEnabled = false;
btnVideo.IsEnabled = false;
lblCallStatus.Visibility = Visibility.Hidden;
}
void h323_Connected(string RemoteUserName)
{
System.Windows.Forms.DialogResult myDialogResult = System.Windows.Forms.MessageBox.Show("Incomming Call by " + RemoteUserName + "\nDo u want to recieve Call?", "Message", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
if (myDialogResult == System.Windows.Forms.DialogResult.Yes)
{
h323.Answer();
}
else
{
h323.Hangup();
}
}
|
|
|
|
|
The chances are you would be better off asking the article author directly.
If you got the code from an article, then there is a "new message" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
he is not replying that's y i put question here. i really need help
|
|
|
|
|
I am trying to update my programming paradigm into the 21st century and learn some of the more recent design patterns, including WPF. So far I like what I see but it is not obvious how I accomplish something similar to the background worker threading model by dragging a control in the designer.
I can set up some threads to accomplish decoupling the UI from the worker process but it was nice to have this functionality in the designer where I could just drag a control onto the form and attach a few event handlers.
Is there a counterpart to the background worker control in WPF?
|
|
|
|
|
BackgroundWorker works well in WPF applications. But I am not sure that you can drag and drop it like you do in windows forms. BackgroundWorker uses SynchronizationContext for cross thread communications. So in WPF, it uses DispatcherSynchronizationContext[^] which is a derived type of SynchronizationContext .
To be honestly, I never found BW to be so useful. I always used to spawn my own threads or use a pooled one.
Best wishes,
Navaneeth
|
|
|
|
|
I usually have very simple requirements for windows based utilities. Thank you for the link.
|
|
|
|
|
You can use the BackgroundWorker in WPF - the control just wraps the BackgroundWorker class - all you need do is manually create the BackgroundWorker in your code. To be honest though, I normally use the SmartThreadPool[^] instead - it's a fantastic piece of code.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|