12.07.2011, 02:11 | #1 |
Участник
|
Paint it black: How to color rows in Table form control
Источник: http://alexvoy.blogspot.com/2011/07/...r-rows-in.html
============== There a lot of answers on how to color grid lines and cells -- for example, this DisplayOption using from DAXGuy. However, my goal is to show how one can paint rows in Table form control. I use the standard tutorial form tutorial_Form_Table from AX2009. On the table control, we need to change a bit EditControl method where we define in which color the current row will be painted. (Here, I provided you with a link where you can choose RGB colors to paint the hell at your own.) X++: // Color the active line in a table FormControl editControl(int column, int row) { #DEFINE.colorDarkTurkoise(112,147,219) // colors at your personal perception of hell #DEFINE.colorNeonBlue(77,77,255) #DEFINE.colorRosyBrown(255,193,193) #DEFINE.colorSaddleBrown(139,69,19) int oldStrColor = WinApi::RGB2int(#colorRosyBrown); // colors for cells not in focus int oldIntColor = WinApi::RGB2int(#colorSaddleBrown); int newIntColor = WinApi::RGB2int(#colorNeonBlue); // colors for the selected line int newStrColor = WinApi::RGB2int(#colorDarkTurkoise); ; // this is columns with int controls if ((column == 2) || (column == 4)) { // not in the header if (row > 1) { // this is in the selected line if (row == table.row()) intEdit.backgroundColor(newIntColor); else intEdit.backgroundColor(oldIntColor); return intEdit; } // this is the header else { if (row == table.row()) editline.backgroundColor(newStrColor); else editline.backgroundColor(oldStrColor); return editline; } } else { if (row == table.row()) editline.backgroundColor(newStrColor); else editline.backgroundColor(oldStrColor); return editline; } } The second method where we redraw the form is activeCellChanged. X++: public void activeCellChanged() { ; super(); // do not forget to repaint the form! element.redraw(); } Источник: http://alexvoy.blogspot.com/2011/07/...r-rows-in.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|