Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
alendar is currently offline  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
 
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: [RTF format] - change tables and pictures
Next Topic: Get String from RichText
Goto Forum:
  


Current Time: Sun May 12 15:19:22 CEST 2024

Total time taken to generate the page: 0.04049 seconds