Click here to Skip to main content
15,920,005 members
Home / Discussions / C#
   

C#

 
QuestionSome Sources! Pin
mrkeivan29-Aug-07 23:16
mrkeivan29-Aug-07 23:16 
AnswerRe: Some Sources! Pin
Developer61129-Aug-07 23:24
Developer61129-Aug-07 23:24 
AnswerRe: Some Sources! Pin
Michael Sync29-Aug-07 23:37
Michael Sync29-Aug-07 23:37 
GeneralRe: Some Sources! Pin
mrkeivan29-Aug-07 23:55
mrkeivan29-Aug-07 23:55 
GeneralRe: Some Sources! Pin
Michael Sync30-Aug-07 0:10
Michael Sync30-Aug-07 0:10 
QuestionUrgent Please Help me Pin
Cape Town Developer29-Aug-07 22:46
Cape Town Developer29-Aug-07 22:46 
AnswerRe: Urgent Please Help me Pin
Michael Sync29-Aug-07 23:32
Michael Sync29-Aug-07 23:32 
QuestionConvert Font size Pin
Lucy29-Aug-07 22:25
Lucy29-Aug-07 22:25 
HI I have created an application that uses the registry.

On the application there are two textboxes and a button. When the form is loaded the first textbox displays a font that has been declared in the registry and the second text box displays the font size, again declared in the registry. The button allows the user to change the font and font size using a FontDialog. When this dialog is opened (by clicking the button), the selected font is the font declared in the registry. I also want the font size that is declared in the registry to be selected in the dialog. The font name works perfectly fine, I am just having trouble with converting the font size.

First of here is my code:


string font;

int size;

FontDialog selectFont = new FontDialog();

font = Convert.ToString(Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\RegKey_test", "Font", ""));

selectFont.Font = (Font)TypeDescriptor.GetConverter(typeof(Font)).ConvertFromString(font);

size = Convert.ToInt32(Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\RegKey_test", "FontSize", ""));

selectFont.Font.Size = (Size)TypeDescriptor.GetConverter(typeof(Size)).ConvertFrom(size);

if (selectFont.ShowDialog() == DialogResult.OK)

{

Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\RegKey_test", "Font", selectFont.Font.Name.ToString());

TBFont.Text = selectFont.Font.Name.ToString();

Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\RegKey_test", "FontSize", selectFont.Font.Size, RegistryValueKind.DWord);

TBFontSize.Text = selectFont.Font.Size.ToString();

}


I am unsure if I should set the variable size as an integer or a string, and then according to this how is it converted to Font.Size?

Lucy

AnswerRe: Convert Font size Pin
Michael Sync29-Aug-07 23:27
Michael Sync29-Aug-07 23:27 
GeneralRe: Convert Font size Pin
Lucy29-Aug-07 23:46
Lucy29-Aug-07 23:46 
Questionserializin an Ellipse Pin
Mamphekgo Bahula29-Aug-07 22:18
Mamphekgo Bahula29-Aug-07 22:18 
AnswerRe: serializin an Ellipse Pin
jith - iii30-Aug-07 0:58
jith - iii30-Aug-07 0:58 
Questionsorte DataGridView Pin
Thaer Hamael29-Aug-07 21:21
Thaer Hamael29-Aug-07 21:21 
Questionworking with DataGridViewComboBoxColumn cell in c# Pin
drweb8629-Aug-07 20:51
drweb8629-Aug-07 20:51 
QuestionCustom Listbox with Only Left Key Enabled Pin
Sukhjinder_K29-Aug-07 20:36
Sukhjinder_K29-Aug-07 20:36 
AnswerRe: Custom Listbox with Only Left Key Enabled Pin
Martin#29-Aug-07 21:07
Martin#29-Aug-07 21:07 
GeneralRe: Custom Listbox with Only Left Key Enabled Pin
Sukhjinder_K29-Aug-07 21:32
Sukhjinder_K29-Aug-07 21:32 
GeneralRe: Custom Listbox with Only Left Key Enabled Pin
Martin#29-Aug-07 21:51
Martin#29-Aug-07 21:51 
GeneralRe: Custom Listbox with Only Left Key Enabled Pin
Sukhjinder_K29-Aug-07 22:06
Sukhjinder_K29-Aug-07 22:06 
QuestionHow to impose expiry date to various documents using C# Pin
sachinkalse29-Aug-07 20:01
sachinkalse29-Aug-07 20:01 
AnswerRe: How to impose expiry date to various documents using C# Pin
Dave Kreskowiak30-Aug-07 6:28
mveDave Kreskowiak30-Aug-07 6:28 
GeneralRe: How to impose expiry date to various documents using C# Pin
sachinkalse30-Aug-07 20:50
sachinkalse30-Aug-07 20:50 
GeneralRe: How to impose expiry date to various documents using C# Pin
Dave Kreskowiak1-Sep-07 4:08
mveDave Kreskowiak1-Sep-07 4:08 
GeneralRe: How to impose expiry date to various documents using C# Pin
sachinkalse2-Sep-07 15:14
sachinkalse2-Sep-07 15:14 
QuestionCan run Oracle application without installing Oracle Client? Pin
Anez.A29-Aug-07 19:48
Anez.A29-Aug-07 19:48 

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.