MagistrAnatol
Silver Member | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору Вот доконал, может кому пригодится Не пойму почему, но LowerCase и AnsiLowerCase - отрабатывали некорректно Код: void __fastcall TfrmOper::AdvMultiButtonEdit2Change(TObject *Sender) { String txtToFind=AnsiUpperCase(AdvMultiButtonEdit2->Text); V_sprOper->Invalidate(true); if (txtToFind!="") { V_sprOper->DataController->Filter->BeginUpdate(); TcxFilterCriteriaItemList *AItemList = V_sprOper->DataController->Filter->Root->AddItemList(fboAnd); AItemList->Criteria->Options>>fcoCaseInsensitive; AItemList->AddItem(V_sprOperOPER_NAME,foLike,"%"+txtToFind+"%","%"+txtToFind+"%"); V_sprOper->DataController->Filter->EndUpdate(); V_sprOper->DataController->Filter->Active=true; } else { V_sprOper->DataController->Filter->BeginUpdate(); V_sprOper->DataController->Filter->RemoveItemByItemLink(V_sprOperOPER_NAME); V_sprOper->DataController->Filter->EndUpdate(); } txtToFind=NULL; } //--------------------------------------------------------------------------- void __fastcall TfrmOper::V_sprOperOPER_NAMECustomDrawCell(TcxCustomGridTableView *Sender, TcxCanvas *ACanvas, TcxGridTableDataCellViewInfo *AViewInfo, bool &ADone) { TRect ARect, ATextToDrawRect; String ACellText, ASearchText, ATextToDraw; int ACol; int i, iStart; ACol = AViewInfo->Item->Index; ACanvas->Canvas->Brush->Style = bsSolid; ACanvas->Canvas->FillRect(AViewInfo->Bounds); ACellText = AViewInfo->GridRecord->DisplayTexts[0]; ATextToDraw = ACellText; ASearchText = AdvMultiButtonEdit2->Text; ARect = AViewInfo->TextAreaBounds; iStart = Pos(AnsiUpperCase(ASearchText), AnsiUpperCase(ACellText)); if (ASearchText.Length() > 0 && iStart > 0) { // Draw pre-matched text ATextToDrawRect = ARect; ATextToDraw = ACellText.SubString(1, iStart - 1); if (ATextToDraw != "" ) { ATextToDrawRect.Right = ATextToDrawRect.Left + ACanvas->TextWidth(ATextToDraw); SetBkMode(ACanvas->Handle, TRANSPARENT); ACanvas->Font->Assign(AViewInfo->Style->Font); ACanvas->FillRect(ATextToDrawRect); ACanvas->DrawTexT(ATextToDraw, ATextToDrawRect, DT_LEFT); ATextToDrawRect.Left = ATextToDrawRect.Right; } // Draw matched text ATextToDraw = ACellText.SubString(iStart, ASearchText.Length()); ACanvas->Font->Color = clWhite; ACanvas->Brush->Color = clGreen;//clBlue; ACanvas->Font->Style=TFontStyles()<<fsBold; ATextToDrawRect.Right = ATextToDrawRect.Left + ACanvas->TextWidth(ATextToDraw); ACanvas->FillRect(ATextToDrawRect); ACanvas->DrawTexT(ATextToDraw, ATextToDrawRect, DT_LEFT); // Prepare post-matched text ATextToDrawRect.Left = ATextToDrawRect.Right; ATextToDrawRect.Right = ARect.Right; ARect = ATextToDrawRect; ATextToDraw = ACellText.SubString(iStart + ASearchText.Length(), ACellText.Length()); } SetBkMode(ACanvas->Handle, TRANSPARENT); ACanvas->Font->Assign(AViewInfo->Style->Font); ACanvas->DrawTexT(ATextToDraw, ARect, 0); ADone = true; } |
|