Experts,
I have a textbox which displays some contents in some font. I am providing the user a dialog which will provide him the options to change the font. The change is getting refelcted only when the user restarts the application.I want to change the font of the text box dynamically; ie; when the user selects the new font,it should be displayed in that font, just like "NotePad". How can I do that ?
With advance thanks and regards
Nikhil Unnikrishnan K
8 2142
Show us the code you are using currently to change the font.
Hi, - private void SaveUISettings(UIConfig uiConfig)
-
{
-
uiConfig.EditorFontString = editorFontTextBox.Text;
-
uiConfig.LogViewerFontString = logViewerFontTextBox.Text;
-
}
-
.
-
.
-
.
-
public void CallSaveUISettings(UIConfig uiConfig)
-
{
-
editorFontTextBox.Font = uiConfig.EditorFont;
-
logFileNameTextBox.Font = uiConfig.LogViewerFont;
-
SaveUISettings(uiConfig);
-
}
These are the two major areas where code changing occurs. But the font change effects only when we restart the application. Why it is not happening instantly ?
Please remember to use [code] tags when you post code. This is a requirement on this forum.
MODERATOR
That code does not say very much...you are saving the TextBox string in one function and setting the Font in another...we do not see where you create the Font from the string.
Nonetheless, at first glance it looks like you are setting the Font with the old settings, and then saving the new Font to uiConfig afterwards, which would explain why the Font change does not happen until you re-start, where it reads the last Font you saved.
If you are using uiConfig to set the Font, then try saving the new settings to uiConfig first and then setting the Font.
Hi,
The "SaveUISettings " will be always having the latest provided font from uiConfig. It is saving the latest font only. Then it is using the same font to display in the text box. That is why I am confused !
I am adding the following piece of code to do the same when restart button is clicked. [Restart button restarts the application]. -
-
private void menuItemRestart_Click(object sender, System.EventArgs e)
-
{
-
Stop();
-
UIConfig uiConfig = new UIConfig();
-
IapetusConfig iaConfig = new IapetusConfig();
-
InitializeHSMS();
-
logViewerForm.Font = this.config.UIConfig.LogViewerFont;
-
uiConfig.EditorFont = this.config.UIConfig.EditorFont;
-
}
-
-
-
.
-
.
-
.
-
.
-
.
-
.
-
-
private void SaveUISettings(UIConfig uiConfig)
-
{
-
uiConfig.EditorFontString = editorFontTextBox.Text;
-
uiConfig.LogViewerFontString = logViewerFontTextBox.Text;
-
}
-
-
-
public void CallSaveUISettings(UIConfig uiConfig)
-
{
-
editorFontTextBox.Font = uiConfig.EditorFont;
-
logFileNameTextBox.Font = uiConfig.LogViewerFont;
-
SaveUISettings(uiConfig);
-
}
-
-
I am getting the desired results only when the application is closed and restarted.
I am suggesting you try this: -
public void CallSaveUISettings(UIConfig uiConfig)
-
{
-
SaveUISettings(uiConfig);
-
editorFontTextBox.Font = uiConfig.EditorFont;
-
logFileNameTextBox.Font = uiConfig.LogViewerFont;
-
}
-
Hi,
Can any one give any alternate plans ?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Paul Gobée |
last post by:
What is the parent element of a button (IE6 on Win, transitional mode)?
Is it the BODY, the browser default stylesheet, or something else?
Contra "body is parent-element":
- Buttons with no style specified have a different font-size than the body's
font-size.
- If I change the body's font-size, a button with no style specified remains
at the same font-size
|
by: Hugo |
last post by:
I have a dual boot machine, runs Win XP pro and Win XP Pro 64, XP boots from
C and XP 64 boots from D.
They both have VS 2005 Beta 2 installed.
I have a webapp developed in Win XP (32) which has gone well and runs fine
in XP.
I Now want to get this same app running under IIS on XP 64.
|
by: Mr.Baha |
last post by:
Hello,
I have a situation where I am appending text to a multi-line
(rich)textbox in a C# form. Now depending on which event does the
appendtext, i want to distinguish the lines in the textbox by having
them written in different font colors. So my multi-line textbox will
contain lines of various colored text.
I tried setting the textboxe's ForeColor property, but quickly realized
that the fore color will change every line within the...
|
by: Ed West |
last post by:
Hello,
I have a simple form with some input boxes. After validation if one
fails, then I would like to at the top of the page say something like
"The following fields in red are required" and then change the label in
front of the textbox or dropdown list to red... is this possible with
asp.net? It seems you can only put a RequiredFieldValidator on the
page, and if it fails validation then that text is displayed... ?
Thanks
|
by: Luis Esteban Valencia |
last post by:
Hello. I have a datagrid with one row. I have a button that adds a new row.
I am trying to implement that when the user selects one product it must
change the price on the quantity column. Anyway when the user selects the
first dropdownlist the dropdownselected_indexchanged is firring but when the
user chagnes the second dropdownlist its not firing.
aahh! if the user selects any of both dropdownlist the datagrid stays with
only one row?...
| |
by: Peter Rilling |
last post by:
I have controls on a page such as a textbox where I would like the font to
match the rest of the page. The CSS style applied to the <body> tag does
not seem to be used by the textbox. Can the textbox font be changed? Also,
same thing for buttons.
|
by: keith |
last post by:
The function return quite rough pixels.
e.g. if you use Font: Verdana, Font style:Regular, Size:8 and type 60 upper
case
character C, the functuion returns pixels 478.3639, but actualy it occupies
a textbox
that has width 545 pixels, that is about 13% difference. When using the
function to
get pixels and grow a textBox, the textBox is not big enough to show all
characters.
|
by: Blasting Cap |
last post by:
I keep getting errors that pop up when I am trying to convert an
application from dotnet framework 1.1 to framework 2.0. The old project
was saved in sourcesafe from Visual Studio 2003, and I have opened it in
Visual Studio 2005.
I've cleared up most errors, but have one that beats the heck out of me.
I have a page:
sales/Item.aspx that has several datagrids in it.
|
by: andrew.ames |
last post by:
Hi
I have a pretty basic windows application created in Visual Studio
2005 and VB.NET.
I set my Form's font to Arial 8.25pt, so when i added a label and a
button they automatically have a font of Arial and 8.25pt.
Great.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |