Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ej48_RichTextBoxIntermedio
- Uso mas a fondo del control RichTextBox */
- #include <radc++.h>
- Form form1("Rich Text Box Intermedio - RAD C++ Ejemplo");
- COLORREF last_color=0x000000; //some default color - black
- Button bbtn("Negrita", AUTO_ID,50,10,50,20,form1);
- Button ibtn("Cursiva",AUTO_ID,100,10,50,20,form1);
- Button ubtn("Subrayado",AUTO_ID,150,10,70,20,form1);
- ColorButton cbtn(AUTO_ID,220,10,50,20,form1,last_color);
- Label label("Margenes", -1,50,40,60,20,form1);
- Track track(AUTO_ID,110,40,200,20,form1);
- RichTextBox rich("", AUTO_ID,50,70,300,180,form1);
- FormProcedure proc(FormProcArgs) { //implementation of form procedure
- ON_CLOSE() Application.close();
- //bold the selection
- ON_COMMAND_BY(bbtn) {
- rich.selectionToBold();
- rich.focus();
- }
- //make the selected text italic
- ON_COMMAND_BY(ibtn) {
- rich.selectionToItalic();
- rich.focus();
- }
- //underline selected text
- ON_COMMAND_BY(ubtn) {
- rich.selectionToUnderline();
- rich.focus();
- }
- //change color of selected text
- ON_COMMAND_BY(cbtn) {
- if(form1.selectColor(last_color)) {
- rich.colorSelection(last_color);
- cbtn.color = last_color;
- }
- rich.focus();
- }
- //change the left and right margins of richtext box
- ON_TRACK_CHANGE(track) {
- rich.leftMargin = track.position;
- rich.rightMargin = track.position;
- }
- return 0;
- }
- rad_main()
- form1.procedure = proc;
- track.maxRange = 50; //set range of trackbar
- rad_end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement