473,588 Members | 2,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to save font change by ctrl+mouse wheel in RichTextBox

I need to save font selected by user by Ctrl+MouseWheel in Winforms
RichTextBox.

I tried override below but this does not remember font: in this method
Font.Size property
seems to be always *initial* Font size when RichTextBox is created, *not*
the font size set by ctrl+mouse wheel.

How to find the font size set by Ctrl+Mouse wheel ?

Andrus.

partial class MyRichTextBox : RichTextBox
{
protected override void OnMouseWheel(Mo useEventArgs e)
{
base.OnMouseWhe el(e);
Settings.Defaul t.TextBoxFont = new SerializableFon t(Font);
}
}

Aug 5 '08 #1
1 4912
On 5 août, 19:33, "Andrus" <kobrule...@hot .eewrote:
I need to save font selected by user by Ctrl+MouseWheel in Winforms
RichTextBox.

I tried override below but this does not remember font: in this method
Font.Size property
seems to be always *initial* Font size when RichTextBox is created, *not*
the font size set by ctrl+mouse wheel.

How to find the font size set by Ctrl+Mouse wheel ?

Andrus.

* * partial class *MyRichTextBox : RichTextBox
* * {
* * * * protected override void OnMouseWheel(Mo useEventArgs e)
* * * * {
* * * * * * base.OnMouseWhe el(e);
* * * * * * Settings.Defaul t.TextBoxFont = new SerializableFon t(Font);
* * * * }

}- Masquer le texte des messages précédents -

- Afficher le texte des messages précédents -
I seem to have misread your question (and forgot to send the answer at
the same time, but both errors should cancel each other out).

When you Ctrl-Wheel inside a RichTextbox, you're not changing the
font, you're only changing the property "ZoomFactor " of the
RichTextbox. So you should be able to save that property to your
Settings and bind it back when necessary (it seems that the zoom
factor is just that, a zoom factor, so when the factor is 2, the font
is twice its normal size. Not sure though, just a visual guess, but
maybe you could use something like : myFont.Size = myFont.Size *
myRTB.ZoomFacto r;).

Michel
Aug 5 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1601
by: Marek Mänd | last post by:
How to prevent selecting table cells with CTRL+mouse left click in Gecko based browsers?
6
10810
by: Carlos García-Carazo | last post by:
Hello, I am working on a C# application for an industrial machine, using Windows Forms, where the user could look at the screen from a 90 degree rotated position, like he could turn the monitor to leave it standing on its left (or right) side. There are many ways to show a "turned" interface in this case, but the problem is that when he moves the mouse right, in a turned screen the mouse cursor goes down (or up), when he moves it up...
2
9619
by: Tee | last post by:
Hi, From my main form, I am executing another application using System.Diagnostics.Process.Start. The application has its own window displaying when the applicaiton is run. I want to change the cursor to a hourglass. But I only can change my own form's cursor using Cursor.Current, whenever I move my mouse cursor into the window, the mouse cursor back to default cursor. I want to change the cursor in the process's window too. Can...
2
13378
by: Kevin L | last post by:
Is there a way to tell when a user, for example, Clicks the right mouse button while also pressing the Ctrl Key?
6
13911
by: Jan Heppen | last post by:
Is it posible to set something so that when my vb.net (visual studio 2005, framework 2.0) application is busy that the mouse pointer change into a hourglass ? Or do i have to set everywhere where my application do something Windows.Forms.Cursor.Current = Cursors.WaitCursor ?? something is for example calling the sql-server database to get/set data please help me
1
2687
by: Terry Olsen | last post by:
I'm trying to change the color table of a RichTextBox. When the app starts, it has the following RTF: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 A2like;}} {\colortbl ;\red255\green255\blue0;} \viewkind4\uc1\pard\fi-375\li375\cf1\f0\fs24\par } Calling the following code to alter the color table from Form1.Load:
1
1473
by: eBob.com | last post by:
After a lot of debugging effort I have to conclude that it does. Or at least can. I take a substring (RichTextBox.Text.Substring) before setting SelectionStart and after and get a different result. The second result begins two characters to the right of the first. In an earlier version of the program I did not have this problem. But in that version the RichTextBox actually appeared on a form. In the version of the program with the...
2
9182
by: shanmugamit | last post by:
hi, i want to change mouse pointer to hand symbol over the select button. but i my code not work... c function fnover(id) { document.getElementById("id").style.cursor="hand"; }
2
21413
by: muddasirmunir | last post by:
I want that my mouse pointer will change to hand when we move our mouse to a text and come to arrorw again when we leave. Just like same as we move our mouse over a hyperlink in explorer. any help ? i had tried on mousemove event of text but did not succeed as the pointer change but did not come back to arrorw again.also i do not know what to write to change to hand pointer instead of hour glass in above code. Thanks
0
7929
marktang
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...
0
8228
Oralloy
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...
0
8357
jinu1996
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...
0
8223
tracyyun
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...
1
5729
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2372
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
1
1459
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1196
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.