U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » RichText,QTF,RTF... » Constant font size in resizeable RichEdit?
Re: Constant font size in resizeable RichEdit? [message #41029 is a reply to message #41020] Tue, 22 October 2013 16:10 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
My proposal:

class RichEdit2 : public RichEdit {
public:
	RichEdit2() {
		zoomlevel = 7;
	}
	virtual void Layout() {
		RichEdit::Layout();
		SetPage(Size(int(zoomlevel*GetSize().cx), INT_MAX));	// Smaller the total, the bigger the text
	}
	virtual void MouseWheel(Point p, int zdelta, dword keyflags) {
		if (keyflags == K_CTRL) {		// Zooms font
			zoomlevel += zdelta/240.;
			if (zoomlevel < 1)
				zoomlevel = 10;
			else if (zoomlevel > 9)
				zoomlevel = 1;
			RefreshLayoutDeep();
		} else 							// Scrolls down
			RichEdit::MouseWheel(p, zdelta, keyflags);			
	}
	double zoomlevel;
};


Best regards
IƱaki

[Updated on: Tue, 22 October 2013 16:11]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: EncodeRTF bullet bug
Next Topic: RichText over an image background - weird scroll (on windows)
Goto Forum:
  


Current Time: Sat May 16 23:21:27 GMT+2 2026

Total time taken to generate the page: 0.00639 seconds