将进度条添加到cxGrid列的最佳方法是什么

时间:2011-08-30 06:03:18

标签: devexpress c++builder c++builder-2010

我正在为第一个网格的带状tableview列的每一行添加进度条! 我的方式=>我在表单上放了4个进度条 btvArrProgGetProperties(TcxCustomGridTableItem *Sender, TcxCustomGridRecord *ARecord, TcxCustomEditProperties *&AProperties)通过更改推送的进度条属性将属性分配给特定行。 这是我的代码

void __fastcall TfMain::btvArrProgGetProperties(TcxCustomGridTableItem *Sender, TcxCustomGridRecord *ARecord,
          TcxCustomEditProperties *&AProperties)
    {
          if ( StrToInt(ARecord->Values[ARecord->RecordIndex,1])==4 ){
            ARecord->Values[ARecord->RecordIndex,0]=100;
            AProperties=pCancel->Properties;
          }
          else
            if ( StrToInt(ARecord->Values[ARecord->RecordIndex,1])==2) {
                ARecord->Values[ARecord->RecordIndex,0]=100;
                AProperties=pDep->Properties;
          }
              else  {

                  if (StrToInt(ARecord->Values[ARecord->RecordIndex,1])==1) {
                        if ((ARecord->Values[ARecord->RecordIndex,7])!=0 && (ARecord->Values[ARecord->RecordIndex,12])!=0) {
                            //now time
                            nwTm=Now().FormatString("hh:mm:ss");
                            //get dep time
                            dpTm=StrToDateTime(ARecord->Values[ARecord->RecordIndex,7]);
                            dpTm.DecodeTime(&dpH,&dpM,&dpS,&dpMS);
                            //get reg time
                            rgTm=StrToDateTime(ARecord->Values[ARecord->RecordIndex,12]);
                            //find difference between dep and reg
                            dif=(1.0 + Double(dpTm)-Double(rgTm));
                            //get difference hours and mins
                            dif.DecodeTime(&difH,&difM,&difS,&difMS);
                            //diff between dep and reg in seconds
                            pReg->Properties->Max=difH*3600+difM*60+difS;
                            nwTm=Now().FormatString("hh:mm:ss");
                            nwTm.DecodeTime(&nwH,&nwM,&nwS,&nwMS);

                            if ((dpH>nwH) || ((dpH>nwH) && (dpM>=nwM ||dpM<=nwM)) || (dpH==nwH && dpM>nwM)  ) {
                                fltRem =(1.0 + Double(dpTm)-Double(nwTm));
                                fltRem.DecodeTime(&remH,&remM,&remS,&remMS);
                                _result=remH*3600+remM*60+remS;


                                pReg->Properties->Text=getTimeBySecs(_result);
                                ARecord->Values[ARecord->RecordIndex,0]=pReg->Properties->Max-_result;
                                pReg->Position=- _result;
                            }
                            else
                            {
                                    pReg->Properties->Max=100;
                                    ARecord->Values[ARecord->RecordIndex,0]=100;
                                    pReg->Properties->Text="Готово";

    /*
                                        ARecord->Values[ARecord->RecordIndex,0]=pReg->Properties->Max;

                                        pReg->Position=pReg->Properties->Max;

    */
                            }
                            AProperties=pReg->Properties;

                        }
                  }

            }

    }

我认为这不是一个很好的方法来解决我的问题(将进度条添加到一个位置得到动态更改的列),因为当我点击每个行时,进度条的位置会因为最后一个值设置为进度条而改变!

我更喜欢在运行时动态创建进度条集名称和其他属性,并分配到GetProperties事件的特定行。 最好的方法是什么? 这个问题有没有演示?如果是,你可以分享! 提前谢谢!

0 个答案:

没有答案