Advertisement
idsystems

CPP_RAD_Ejercicio48

Jun 21st, 2012
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.48 KB | None | 0 0
  1. /* ej48_RichTextBoxIntermedio
  2. Uso mas a fondo del control RichTextBox */
  3. #include <radc++.h>
  4.  
  5. Form      form1("Rich Text Box Intermedio - RAD C++ Ejemplo");
  6.  
  7. COLORREF last_color=0x000000; //some default color - black
  8.  
  9. Button      bbtn("Negrita",  AUTO_ID,50,10,50,20,form1);
  10. Button      ibtn("Cursiva",AUTO_ID,100,10,50,20,form1);
  11. Button      ubtn("Subrayado",AUTO_ID,150,10,70,20,form1);
  12. ColorButton cbtn(AUTO_ID,220,10,50,20,form1,last_color);
  13.  
  14. Label label("Margenes",  -1,50,40,60,20,form1);
  15. Track track(AUTO_ID,110,40,200,20,form1);
  16.  
  17. RichTextBox rich("",      AUTO_ID,50,70,300,180,form1);
  18.  
  19.  
  20. FormProcedure proc(FormProcArgs) { //implementation of form procedure
  21.     ON_CLOSE() Application.close();
  22.    
  23.     //bold the selection
  24.     ON_COMMAND_BY(bbtn) {
  25.         rich.selectionToBold();
  26.         rich.focus();
  27.     }
  28.     //make the selected text italic
  29.     ON_COMMAND_BY(ibtn) {
  30.         rich.selectionToItalic();
  31.         rich.focus();
  32.     }
  33.     //underline selected text
  34.     ON_COMMAND_BY(ubtn) {
  35.         rich.selectionToUnderline();
  36.         rich.focus();
  37.     }
  38.  
  39.     //change color of selected text
  40.     ON_COMMAND_BY(cbtn) {
  41.         if(form1.selectColor(last_color)) {
  42.             rich.colorSelection(last_color);
  43.             cbtn.color = last_color;
  44.         }
  45.         rich.focus();
  46.     }
  47.     //change the left and right margins of richtext box
  48.     ON_TRACK_CHANGE(track) {
  49.         rich.leftMargin = track.position;
  50.         rich.rightMargin = track.position;     
  51.     }
  52.  
  53.    
  54.     return 0;
  55. }
  56.  
  57. rad_main()
  58.  
  59.     form1.procedure = proc;
  60.     track.maxRange = 50; //set range of trackbar
  61.        
  62. rad_end()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement