473,372 Members | 1,116 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,372 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 4881
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.