NC Designer2中表格控件Table设置行颜色 光标颜色 其他数据颜色

$GNCTable00000-OnCreate
GCSChangeActiveFocus(-1,"GNCTable00000");
long num;
num = 0;
while(num !=7)do1;
        num = num+1;
        GCSNCTableSetCellBackColor(-1,"GNCTable00000",HC4FFE1,0,num);
    end1;
$End
$GNCTable00000-OnKeyRelease
GMEM mem;
long _lShiftKey;
long _lCtrlKey;
long _lMainKey;
long _Address;
long num;
long num1;
short _col;
short _row;
_lShiftKey = LUPARAM & H1;
_lCtrlKey = LUPARAM & H2;
_lMainKey = LLPARAM;
mem = GMEMCreate("TestMem",4);
GCSNCTableGetSubCursorNum(-1,"GNCTable00000",mem);
_row = GMEMGetShort(mem,0);
_col = GMEMGetShort(mem,2);
num = _col;
num1 = _col;
if((0 == _lCtrlKey) &&(0==_lShiftKey)&&(( _lMainKey == 38 )||(_lMainKey == 40)))
    while(num !=0)do1;
        num = num-1;
        GCSNCTableSetCellBackColor(-1,"GNCTable00000",HC4FFE1,_row,num);
    end1;
    while(num1 !=7)do1;
        num1 = num1+1;
        GCSNCTableSetCellBackColor(-1,"GNCTable00000",HC4FFE1,_row,num1);
    end1;
    GCSNCTableSetCellBackColor(-1,"GNCTable00000",HC4FFE1,_row,_col);
endif;
$End

$GNCTable00000-OnKeyPress
GMEM mem;
long _lShiftKey;
long _lCtrlKey;
long _lMainKey;
long _Address;
long num;
long num1;
short _col;
short _row;
_lShiftKey = LUPARAM & H1;
_lCtrlKey = LUPARAM & H2;
_lMainKey = LLPARAM;
mem = GMEMCreate("TestMem",4);
GCSNCTableGetSubCursorNum(-1,"GNCTable00000",mem);
_row = GMEMGetShort(mem,0);
_col = GMEMGetShort(mem,2);
num = _col;
num1 = _col;
if((0 == _lCtrlKey) &&(0==_lShiftKey)&&(( _lMainKey == 38 )||(_lMainKey == 40)))
    while(num !=0)do1;
        num = num-1;
        GCSNCTableSetCellBackColor(-1,"GNCTable00000",HFFFBF0,_row,num);
    end1;
    while(num1 !=7)do1;
        num1 = num1+1;
        GCSNCTableSetCellBackColor(-1,"GNCTable00000",HFFFBF0,_row,num1);
    end1;
    GCSNCTableSetCellBackColor(-1,"GNCTable00000",HFFFBF0,_row,_col);
endif;
$End

posted @ 2022-07-15 16:39  PoirotArvin  阅读(211)  评论(0)    收藏  举报