Home » U++ Library support » RichText,QTF,RTF... » Constant font size in resizeable RichEdit?
Re: Constant font size in resizeable RichEdit? [message #40945 is a reply to message #40933] |
Fri, 11 October 2013 11:02 |
iST1
Messages: 107 Registered: August 2013
|
Experienced Member |
|
|
Both solutions do not come:
class ExtRichEdit : public RichEdit {
public:
typedef AppRichEdit 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();
#if 0
//Mirek's solution: to big font
SetPage(Size(minmax(GetSize().cx, 50, 10000), INT_MAX));
#else
//Alendar's solution: to small font
long editor_cx = GetSize().cx;
long adaptive_cx = (editor_cx * zoomlevel); // Smaller the number, the bigger the text
SetPage(Size(adaptive_cx, INT_MAX));
#endif
}
};
GUI_APP_MAIN
{
ExtRichEdit edit;
TopWindow r;
r.Add(edit.SizePos());
TopWindow wnd;
SplitterFrame sp;
wnd.AddFrame(sp.Right(r, 300));
wnd.AddFrame(NullFrame());
wnd.Run();
}
|
|
|
|
|
Constant font size in resizeable RichEdit?
|
|
|
Re: Constant font size in resizeable RichEdit?
By: mirek on Sun, 27 December 2009 19:57
|
|
|
Re: Constant font size in resizeable RichEdit?
By: iST1 on Mon, 07 October 2013 18:18
|
|
|
Re: Constant font size in resizeable RichEdit?
By: mirek on Tue, 08 October 2013 08:05
|
|
|
Re: Constant font size in resizeable RichEdit?
By: koldo on Tue, 08 October 2013 12:22
|
|
|
Re: Constant font size in resizeable RichEdit?
By: mirek on Tue, 08 October 2013 19:59
|
|
|
Re: Constant font size in resizeable RichEdit?
By: koldo on Wed, 09 October 2013 08:15
|
|
|
Re: Constant font size in resizeable RichEdit?
By: iST1 on Fri, 11 October 2013 11:02
|
|
|
Re: Constant font size in resizeable RichEdit?
By: koldo on Fri, 11 October 2013 14:21
|
|
|
Re: Constant font size in resizeable RichEdit?
By: iST1 on Fri, 11 October 2013 14:23
|
|
|
Re: Constant font size in resizeable RichEdit?
By: iST1 on Mon, 21 October 2013 17:58
|
|
|
Re: Constant font size in resizeable RichEdit?
By: koldo on Tue, 22 October 2013 16:10
|
|
|
Re: Constant font size in resizeable RichEdit?
By: iST1 on Tue, 22 October 2013 16:28
|
|
|
Re: Constant font size in resizeable RichEdit?
By: mirek on Tue, 29 October 2013 18:57
|
|
|
Re: Constant font size in resizeable RichEdit?
By: koldo on Wed, 30 October 2013 13:04
|
|
|
Re: Constant font size in resizeable RichEdit?
By: mirek on Wed, 30 October 2013 13:07
|
|
|
Re: Constant font size in resizeable RichEdit?
By: koldo on Wed, 30 October 2013 23:07
|
|
|
Re: Constant font size in resizeable RichEdit?
By: Tooraj on Tue, 18 December 2018 16:41
|
Goto Forum:
Current Time: Sat May 18 10:35:54 CEST 2024
Total time taken to generate the page: 0.00866 seconds
|