473,418 Members | 2,086 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

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(MouseEventArgs e)
{
base.OnMouseWheel(e);
Settings.Default.TextBoxFont = new SerializableFont(Font);
}
}

Aug 5 '08 #1
1 4890
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(MouseEventArgs e)
* * * * {
* * * * * * base.OnMouseWheel(e);
* * * * * * Settings.Default.TextBoxFont = new SerializableFont(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.ZoomFactor;).

Michel
Aug 5 '08 #2

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

Similar topics

1
by: Marek Mänd | last post by:
How to prevent selecting table cells with CTRL+mouse left click in Gecko based browsers?
6
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...
2
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...
2
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
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...
1
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...
1
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...
2
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.