Home » U++ Library support » RichText,QTF,RTF... » RichEdit questions
Re: RichEdit questions [message #30231 is a reply to message #25472] |
Thu, 16 December 2010 23:37 |
alendar
Messages: 47 Registered: January 2010 Location: Idaho, USA
|
Member |
|
|
Here's a fun trick, I don't think I've seen it anywhere in the examples. Zooming with the mouse wheel whilest holding the control key down:
struct MyRichEdit : public RichEdit {
typedef MyRichEdit CLASSNAME;
float zoomlevel;
//==========================================================================================
virtual void MouseWheel(Point p, int zdelta, dword keyflags) {
if (keyflags == K_CTRL) {
// Zooms font
float fzdelta = zdelta;
zoomlevel+= (fzdelta / 240.0); // One bump on the mouse wheel is 120 on my machine
RefreshLayoutDeep();
} else {
// Scrolls down
RichEdit::MouseWheel(p, zdelta, keyflags);
}
}
//==========================================================================================
void Layout() {
RichEdit::Layout();
long editor_cx = GetSize().cx;
long adaptive_cx = (editor_cx * zoomlevel); // Smaller the number, the bigger the text
SetPage(Size(adaptive_cx, INT_MAX));
}
The RefreshLayoutDeep is required to redraw the text with the new font size.
cd7651feeb698f6ac6cec1f6deda5e5b
|
|
|
|
|
RichEdit questions
By: koldo on Thu, 25 February 2010 09:42
|
|
|
Re: RichEdit questions
|
|
|
Re: RichEdit questions
By: koldo on Thu, 25 February 2010 14:42
|
|
|
Re: RichEdit questions
By: fudadmin on Thu, 25 February 2010 15:01
|
|
|
Re: RichEdit questions
By: fudadmin on Thu, 25 February 2010 15:24
|
|
|
Re: RichEdit questions
By: koldo on Thu, 25 February 2010 17:29
|
|
|
Re: RichEdit questions
By: fudadmin on Thu, 25 February 2010 18:49
|
|
|
Re: RichEdit questions
By: mirek on Fri, 26 February 2010 15:26
|
|
|
Re: RichEdit questions
By: koldo on Sun, 28 February 2010 17:58
|
|
|
Re: RichEdit questions
By: mirek on Mon, 01 March 2010 10:47
|
|
|
Re: RichEdit questions
By: koldo on Mon, 01 March 2010 12:08
|
|
|
Re: RichEdit questions
By: mirek on Mon, 01 March 2010 12:10
|
|
|
Re: RichEdit questions
By: mirek on Mon, 01 March 2010 12:20
|
|
|
Re: RichEdit questions
By: koldo on Mon, 01 March 2010 13:07
|
|
|
Re: RichEdit questions
By: mirek on Mon, 01 March 2010 13:35
|
|
|
Re: RichEdit questions
By: alendar on Thu, 16 December 2010 22:55
|
|
|
Re: RichEdit questions
By: alendar on Thu, 16 December 2010 23:37
|
|
|
Re: RichEdit questions
By: koldo on Sat, 14 September 2013 23:43
|
Goto Forum:
Current Time: Sun May 12 15:19:22 CEST 2024
Total time taken to generate the page: 0.04049 seconds
|