![]() |
#7 |
Участник
|
коллега, спасибо за попытку!
ваш вариант не работает, потому что при последующей отрисовке формы будет взят последний заданный цвет для каждого элемента. задача решается через метод таблицы EditControl, где мы можем манипулировать цветом фона каждого элемента (control) (на базе стандартной формы tutorial_Form_Table) 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) // all color codes are at [url]http://web.njit.edu/~kevin/rgb.txt.html[/url] 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; } } X++: public void activeCellChanged() { ; super(); // do not forget to repaint the form! element.redraw(); }
__________________
Felix nihil admirari Последний раз редактировалось wojzeh; 27.10.2019 в 19:35. |
|