コード例 #1
0
//---------------------------------------------------------------------------
void __fastcall TFormCosts::DBGrid1DrawColumnCell(TObject *Sender, const TRect &Rect,
          int DataCol, TColumn *Column, TGridDrawState State)
{
    if(ADOQuery1->Fields->FieldByName("Вычитать")->AsInteger == 0)
    {
        DBGrid1->Canvas->Font->Color = clGrayText;
    }
    else
    {      
        //DBGrid1->Canvas->Brush->Color = clSkyBlue;
        DBGrid1->Canvas->Font->Color = clBlack;
    }
    if(State.Contains(Grids::gdSelected) && ADOQuery1->Fields->FieldByName("Вычитать")->AsInteger == 0)
    {
        DBGrid1->Canvas->Brush->Color = clSkyBlue;
        DBGrid1->Canvas->Font->Color = System::Uitypes::TColor(0x222222);
    }
    if(State.Contains(Grids::gdSelected) && ADOQuery1->Fields->FieldByName("Вычитать")->AsInteger == 1)
    {
        //State.Contains(Grids::gdRowSelected)
        DBGrid1->Canvas->Brush->Color = clSkyBlue;
        DBGrid1->Canvas->Font->Color = clBlack;
    }
    DBGrid1->Canvas->FillRect(Rect);
    DBGrid1->Canvas->TextOut(Rect.Left+2, Rect.Top+2, Column->Field->Text);
}
コード例 #2
0
void __fastcall TCustomStringGrid::DrawCell(int ACol, int ARow, const TRect & ARect, TGridDrawState AState)
{
	if(this->Enabled)
	{
		this->Canvas->Font->Color=this->Font->Color;
		//this->Canvas->Font->Color=clGrayText;
		if(AState.Contains(gdSelected) && !AState.Contains(gdFocused))
		{
			this->Canvas->Font->Color=clHighlightText;
		}
		RECT temp = Rect(ARect.left+1,ARect.Top+1,ARect.Right-1,ARect.Bottom-1);
		//DrawText(this->Canvas->Handle,this->Cells[ACol][ARow].c_str(),-1,&temp,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
		DrawText(this->Canvas->Handle,this->Cells[ACol][ARow].c_str(),-1,&temp,this->TextDrawOptions);
	}
	else
	{
		this->Canvas->Font->Color=clGrayText;
		if(AState.Contains(gdSelected) && !AState.Contains(gdFocused))
		{
			this->Canvas->Font->Color=clInactiveCaptionText;
		}
		RECT temp = Rect(ARect.left+1,ARect.Top+1,ARect.Right-1,ARect.Bottom-1);
		DrawText(this->Canvas->Handle,this->Cells[ACol][ARow].c_str(),-1,&temp,this->TextDrawOptions);
    }
}
コード例 #3
0
ファイル: CadCentral.cpp プロジェクト: pbvieira/azindustria
void __fastcall TFCadCentral::DBGSetorDrawColumnCell(TObject *Sender,
      const TRect &Rect, int DataCol, TColumn *Column,
      TGridDrawState State)
{
    if(DModuleCliente->CDSSetor->RecNo % 2){
        DBGSetor->Canvas->Brush->Color = 15138520;
    }else{
        DBGSetor->Canvas->Brush->Color = clWindow;
    }

    if(State.Contains(gdSelected)){
        DBGSetor->Canvas->Brush->Color = clTeal;
    }

    DBGSetor->DefaultDrawColumnCell(Rect, DataCol, Column, State);
}
コード例 #4
0
//---------------------------------------------------------------------------
void __fastcall TFOConsOcorrenciasContatos::DBGContatosDrawColumnCell(
      TObject *Sender, const TRect &Rect, int DataCol, TColumn *Column,
      TGridDrawState State)
{
    if(FOcorrenciaPai->CDSContato->RecNo % 2){
        DBGContatos->Canvas->Brush->Color = 15138520;
    }else{
        DBGContatos->Canvas->Brush->Color = clWindow;
    }

    if(State.Contains(gdSelected)){
        DBGContatos->Canvas->Brush->Color = clTeal;
    }

    DBGContatos->DefaultDrawColumnCell(Rect, DataCol, Column, State);
}
コード例 #5
0
void __fastcall TfrmRetrievalJobList::sgJobsDrawCell(TObject *Sender, int ACol, int ARow, TRect &Rect, TGridDrawState State) {
    LCDbCryoJob * job;
    TColor background = clWindow;
    if (0 == ARow)
        job = NULL;
    else
        job = (LCDbCryoJob *)sgJobs->Objects[0][ARow];
    if (NULL == job) {
        if (0 == ARow) {
            background = clBtnFace; // header row
        } else {
            background = RETRIEVAL_ASSISTANT_ERROR_COLOUR; // error
        }
    } else {
        switch (job->getStatus()) {
        case LCDbCryoJob::Status::NEW_JOB:
            background = RETRIEVAL_ASSISTANT_JOB_NEW_COLOUR; break;
        case LCDbCryoJob::Status::INPROGRESS:
            background = RETRIEVAL_ASSISTANT_JOB_INPROGRESS_COLOUR; break;
        case LCDbCryoJob::Status::DONE:
            background = RETRIEVAL_ASSISTANT_JOB_COMPLETED_COLOUR; break;
        case LCDbCryoJob::Status::DELETED:
            background = RETRIEVAL_ASSISTANT_JOB_DELETED_COLOUR; break;
        default:
            background = RETRIEVAL_ASSISTANT_ERROR_COLOUR;
        }
    }
    TCanvas * cnv = sgJobs->Canvas;
	cnv->Brush->Color = background;
	cnv->FillRect(Rect);
    if (State.Contains(gdSelected)) {
        TFontStyles oldFontStyle = cnv->Font->Style;
        TPenStyle oldPenStyle = cnv->Pen->Style;
        cnv->Pen->Style = psDot;
        cnv->Rectangle(Rect.Left+1, Rect.Top+1, Rect.Right-1, Rect.Bottom-1);
        cnv->Font->Style = TFontStyles() << fsBold; // << fsItalic;
    	cnv->TextOut(Rect.Left+5, Rect.Top+5, sgJobs->Cells[ACol][ARow]);
        cnv->Pen->Style     = oldPenStyle;
        cnv->Font->Style    = oldFontStyle;
	} else {
        cnv->TextOut(Rect.Left+5, Rect.Top+5, sgJobs->Cells[ACol][ARow]);
    }
}