本文整理汇总了C++中TCanvas::FillRect方法的典型用法代码示例。如果您正苦于以下问题:C++ TCanvas::FillRect方法的具体用法?C++ TCanvas::FillRect怎么用?C++ TCanvas::FillRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCanvas
的用法示例。
在下文中一共展示了TCanvas::FillRect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PaintPosition
void __fastcall TTScope::PaintPosition(void)
{
TCanvas *pCanvas = pBitmap->Canvas;
TRect rc;
rc.Top = 0;
rc.Bottom = GAGEWIDTH;
rc.Left = 0;
rc.Right = pBitmap->Width;
pCanvas->Brush->Color = clBlack;
pCanvas->FillRect(rc);
int xw = (m_XW * rc.Right) / pScope->m_ScopeSize;
int x = (m_XOFF * rc.Right) / pScope->m_ScopeSize;
int xc = (m_CursorX * rc.Right) / pScope->m_ScopeSize;
pCanvas->Brush->Color = clGreen;
rc.Left = x;
rc.Right = x + xw;
pCanvas->FillRect(rc);
pCanvas->Pen->Color = clYellow;
pCanvas->Pen->Style = psSolid;
pCanvas->MoveTo(xc, rc.Top);
pCanvas->LineTo(xc, rc.Bottom);
pCanvas->Font->Color = clWhite;
pCanvas->Font->Size = 8;
char bf[32];
sprintf(bf, "Gain:%.1lf", m_Gain);
::SetBkMode(pCanvas->Handle, TRANSPARENT);
pCanvas->TextOut(0, 0, bf);
}
示例2: DrawLevel
//---------------------------------------------------------------------------
void __fastcall TRxViewDlg::DrawLevel(void)
{
if( m_pRxSet == NULL ) return;
if( !m_pBitmapLevel ) return;
TCanvas *pCanvas = m_pBitmapLevel->Canvas;
TRect rc;
rc.Left = 0; rc.Top = 0;
rc.Right = m_levelXW; rc.Bottom = m_levelYW;
pCanvas->Brush->Color = clBlack;
pCanvas->Pen->Color = clBlack;
pCanvas->FillRect(rc);
// pCanvas->Pen->Color = clYellow;
int d = m_pRxSet->m_StgFFT.Sig - 500;
if( m_pRxSet->IsMFSK() && sys.m_MFSK_SQ_Metric ){
d = m_pRxSet->m_pDem->GetMFSKMetric(0);
}
if( d > LEVELMAX ) d = LEVELMAX;
if( m_pRxSet->m_pDem->m_AGC.GetOver() && !MainVARI->m_TX ){
pCanvas->Brush->Color = clRed;
}
else if( !m_pRxSet->m_pDem->m_Lock ){
pCanvas->Brush->Color = m_pRxSet->m_SQ ? clBlue : clGray;
}
else {
pCanvas->Brush->Color = m_pRxSet->m_SQ ? TColor(RGB(0,255,0)) : clGray;
}
rc.Right = (d * m_levelXW / LEVELMAX);
pCanvas->FillRect(rc);
pCanvas->Pen->Color = m_pRxSet->m_SQ ? clBlack : clWhite;
d = (m_pRxSet->m_SQLevel * m_levelXW / LEVELMAX);
pCanvas->MoveTo(d, 0); pCanvas->LineTo(d, m_levelYW);
}
示例3: lstModulesDrawItem
void __fastcall TfrmMainFormServer::lstModulesDrawItem(
TWinControl *Control, int Index, TRect &Rect, TOwnerDrawState State)
{
TRect cRect(0, 0, lstModules->Width, lstModules->Height);
TCanvas* pCanvas = ((TListBox*)Control)->Canvas;
pCanvas->FillRect(Rect); //This clears the rect
Graphics::TBitmap* bitmap = new Graphics::TBitmap();
AnsiString moduleName = lstModules->Items->Strings[Index];
if(Index == 0){
imgList->GetBitmap(1, bitmap); //table image
}else{
imgList->GetBitmap(0, bitmap); //table image
}
pCanvas->Draw(Rect.Left + 1, Rect.Top, bitmap);
delete bitmap;
pCanvas->TextOut(Rect.Left + 22, Rect.Top + 2, moduleName);
}
示例4: HostBoxDrawItem
//---------------------------------------------------------------------------
void __fastcall TConfDlg::HostBoxDrawItem(TWinControl *Control, int Index,
TRect &Rect, TOwnerDrawState State)
{
int Offset = 2;// default offset
TColor FC,BC,PC;
TListBox *ListBox = dynamic_cast<TListBox*>(Control);
TCanvas *Canvas = ListBox->Canvas;
BC=Canvas->Brush->Color;
PC=Canvas->Pen->Color;
Canvas->Brush->Color=clWindow;
HostData *actHost;
// display the text
FC=Canvas->Font->Color;
if(!Servers->Refreshing) {
actHost=(*Servers)[ListBox->Items->Strings[Index].c_str()];
if(!(actHost)||!actHost->Alive||!(actHost->State) || !(actHost->State->Valid))
Canvas->Font->Color=clRed;
else
Canvas->Font->Color=clWindowText;
} else Canvas->Font->Color=clGrayText;
if((ListBox->Focused() || AddBtn->Focused()) && State.Contains(odSelected)) {
Canvas->Brush->Color=Canvas->Font->Color;
Canvas->Font->Color=clHighlightText;
}
Canvas->Pen->Color=Canvas->Brush->Color;
Canvas->FillRect(Rect); // clear the rectangle
Canvas->TextOut(Rect.Left + Offset, Rect.Top, ListBox->Items->Strings[Index]);
Canvas->Font->Color=FC;
Canvas->Brush->Color=BC;
Canvas->Pen->Color=PC;
}
示例5: IntToStr
void
TGUIScoreView::InvalidateBuffer()
{
TCanvas *canvas = buffer->Canvas;
canvas->Font->Height = viewTRect.Height() / 2;
AnsiString successTrialsString = IntToStr( successTrials ),
totalTrialsString = IntToStr( totalTrials );
int successTrialsWidth = canvas->TextWidth( successTrialsString ),
totalTrialsWidth = canvas->TextWidth( totalTrialsString ),
maxWidth = MAX( successTrialsWidth, totalTrialsWidth );
buffer->Height = viewTRect.Height();
buffer->Width = maxWidth;
canvas->FillRect( TRect( 0, 0, buffer->Width, buffer->Height ) );
canvas->TextOut( maxWidth - successTrialsWidth, 0, successTrialsString );
canvas->TextOut( maxWidth - totalTrialsWidth, buffer->Height / 2, totalTrialsString );
TGUIView::InvalidateRect( TRect( viewTRect.Left,
viewTRect.Top,
viewTRect.Left + buffer->Width,
viewTRect.Top + buffer->Height ) );
}
示例6: SelectedBoxDrawItem
void __fastcall TConfDlg::SelectedBoxDrawItem(TWinControl *Control, int Index,
TRect &Rect, TOwnerDrawState State)
{
int Offset = 2;// default offset
TColor FC,BC,PC;
TListBox *ListBox = dynamic_cast<TListBox*>(Control);
TCanvas *Canvas = ListBox->Canvas;
BC=Canvas->Brush->Color;
PC=Canvas->Pen->Color;
FC = Canvas->Font->Color;
Canvas->Brush->Color=clWindow;
CHostRef *actHost;
TFontStyles FS;
FS = Canvas->Font->Style;
actHost=(CHostRef *)ListBox->Items->Objects[Index];
if((*actHost)->ProcData || (*actHost)->Account)
Canvas->Font->Style = FS<<fsBold;
Canvas->Font->Color=clWindowText;
if((ListBox->Focused() || RemoveBtn->Focused()) && State.Contains(odSelected)) {
Canvas->Brush->Color=Canvas->Font->Color;
Canvas->Font->Color=clHighlightText;
}
Canvas->Pen->Color=Canvas->Brush->Color;
Canvas->FillRect(Rect); // clear the rectangle
Canvas->TextOut(Rect.Left + Offset, Rect.Top, ListBox->Items->Strings[Index]);
Canvas->Font->Color=FC;
Canvas->Brush->Color=BC;
Canvas->Pen->Color=PC;
Canvas->Font->Style=FS;
}
示例7: GetCanvas
void
TGUIBackgroundView::Paint()
{
TCanvas *canvas = GetCanvas();
canvas->Pen->Color = TGUIView::GetElementColor( fbBackground ).cl;
canvas->Brush->Color = canvas->Pen->Color;
canvas->FillRect( viewTRect );
}
示例8: LBMessage_DrawItem
void LBMessage_DrawItem(TWinControl *Control, int Index, TRect &Rect, TOwnerDrawState State)
{
TListBox* lbox = dynamic_cast<TListBox*>(Control);
if (!lbox) return;
TCanvas* canvas = lbox->Canvas;
// Set defaults:
canvas->Brush->Color = lbox->Color;
canvas->Font->Style = lbox->Font->Style;
TLBMessageStyle style = (TLBMessageStyle)lbox->Items->Objects[Index];
switch (style)
{
default:
case smtDefaultB:
case smtDefB:
canvas->Font->Style = canvas->Font->Style << fsBold;
case smtDefault:
case smtDef:
canvas->Font->Color = clWindowText;
break;
case smtNotificationB:
case smtNotifB:
canvas->Font->Color = clNavy;
canvas->Font->Style = canvas->Font->Style << fsBold;
canvas->Brush->Color = (TColor)0xFFF0F0;
break;
case smtNotification:
case smtNotif:
canvas->Font->Color = clBlue;
break;
case smtWarning:
//canvas->Font->Color = clFuchsia;
canvas->Font->Color = (TColor)0x9900cc;
break;
case smtError:
canvas->Font->Color = clRed;
canvas->Brush->Color = clCream;
break;
case smtAppError:
canvas->Font->Color = clYellow;
canvas->Brush->Color = clRed;
break;
}
// Clear the rectangle: (NECESSARY!)
canvas->FillRect(Rect);
// Display text:
canvas->TextOut(Rect.Left + 2, Rect.Top, lbox->Items->Strings[Index]);
}
示例9: clear
void DoubleBufferedCanvas::clear()
{
if (doubleBuffered)
{
TCanvas *canvas = bitmap->Canvas;
canvas->Brush->Color = clBlack;
canvas->FillRect(TRect(0, 0, width, height));
}
};
示例10: PaintBoxIPPaint
//---------------------------------------------------------------------------
void __fastcall TDialogZeroConf::PaintBoxIPPaint(TObject *Sender)
{
String S = IP.ToString();
TCanvas *C = PaintBoxIP->Canvas;
C->Brush->Color = RGB(51, 51, 51);
C->FillRect(Bounds(0, 0, 32767, 32767));
C->Font->Color = clLime;
C->Font->Size = 40;
C->TextOut(PaintBoxIP->Width / 2 - C->TextWidth(S) / 2, 5, S);
}
示例11: PaintScope
void __fastcall TTScope::PaintScope(CScope *sp, int n)
{
TRect rc;
int YW = (pBitmap->Height - GAGEWIDTH) / 2;
rc.Top = (YW * n) + GAGEWIDTH;
rc.Bottom = rc.Top + YW;
rc.Left = 0;
rc.Right = pBitmap->Width;
TCanvas *pCanvas = pBitmap->Canvas;
pCanvas->Brush->Color = clBlack;
pCanvas->FillRect(rc);
if( !sp->GetFlag() ) return;
if( n < 2 ){
pCanvas->Pen->Color = clWhite;
pBitmap->Canvas->Pen->Style = psDot;
pCanvas->MoveTo(rc.Left, rc.Top + YW/2);
pCanvas->LineTo(rc.Right, rc.Top + YW/2);
}
pCanvas->Pen->Color = clWhite;
pBitmap->Canvas->Pen->Style = psSolid;
double d;
int x, y, xx, xe;
for( x = 0; x < rc.Right; x++ ){
xx = (x * m_XW / rc.Right) + m_XOFF;
xe = xx + (m_XW / rc.Right);
if( xe >= sp->m_ScopeSize ) xe = sp->m_ScopeSize - 1;
double *dp = &sp->pScopeData[xx];
for( ; xx <= xe; xx++, dp++ ){
d = *dp;
if( n < 1 ){
y = rc.Bottom - int(d * YW * m_Gain/16384.0) - 1;
}
else {
y = rc.Bottom - int(d * YW * m_Gain/32768.0) - YW/2;
}
if( y < rc.Top ) y = rc.Top;
if( y > rc.Bottom ) y = rc.Bottom;
if( x ){
pCanvas->LineTo(x, y);
}
else {
pCanvas->MoveTo(x, y);
}
}
}
}
示例12: PaintBoxPaint
void __fastcall TFwCalcMainDlg::PaintBoxPaint(TObject *Sender)
{
TRect r = TRect(0,0,PaintBox->Width, PaintBox->Height);
TCanvas *cv = PaintBox->Canvas;
// Paint background
cv->FillRect(r);
cv->TextFlags = 0;
cv->Font->Style = TFontStyles() << fsBold;
cv->Font->Name = "Courier New";
SetBkMode(cv->Handle, TRANSPARENT);
int lh = cv->TextHeight("X");
int y_off = r.Height() - lh;
int index = 0;
while(y_off + lh >= 0)
{
// Determine number to write
AnsiString txt = m_engine->RegisterValue[index].UpperCase();
if(txt != "")
{
if(txt == "ERR")
{
AnsiString err_text = AnsiString("ERROR - ") + m_engine->LastError;
cv->Font->Size = m_font_size;
cv->Font->Color = clRed;
cv->TextOut(r.Right - 10 - cv->TextWidth(err_text), y_off, err_text);
}
else
{
if(m_engine->BaseMode == eBaseDec)
{
int tw = CalcWidthOfDecNumber(cv, txt);
PaintDecNumber(cv, r.Right - 10 - tw, y_off, txt);
}
else
{
cv->Font->Size = m_font_size;
cv->TextOut(r.Right-cv->TextWidth(txt)-10, y_off, txt);
}
}
}
y_off -= lh;
index++;
}
}
示例13: PCFFTResize
//---------------------------------------------------------------------------
void __fastcall TClockAdjDlg::PCFFTResize(TObject *Sender)
{
m_pBitmapFFT->Width = PBoxFFT->Width;
m_pBitmapFFT->Height = PBoxFFT->Height;
TCanvas *pCanvas = m_pBitmapFFT->Canvas;
pCanvas->Brush->Color = MainVARI->m_tFFTColset[0].c;
TRect rc;
rc.Left = 0; rc.Top = 0;
rc.Right = m_pBitmapFFT->Width;
rc.Bottom = m_pBitmapFFT->Height;
pCanvas->FillRect(rc);
m_fftXW = m_pBitmapFFT->Width;
m_fftYW = m_pBitmapFFT->Height;
DrawFFT(TRUE);
}
示例14: sgJobsDrawCell
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]);
}
}
示例15: OnAttenuationDraw
void TfrmSoundLib::OnAttenuationDraw(CanvasValue* sender, void* _canvas, const Irect& _rect)
{
TCanvas* canvas = (TCanvas*)_canvas;
const TRect& rect = *((TRect*)&_rect);
// canvas
int w = rect.Width();
int h = rect.Height();
int x0= rect.left;
int y0= rect.top;
canvas->Brush->Color = clBlack;
canvas->FillRect(rect);
canvas->Pen->Color = TColor(0x00006600);
canvas->MoveTo(x0,y0);
for (int i=0; i<X_GRID+1; i++){
canvas->LineTo(x0+i*w/X_GRID,y0+h);
canvas->MoveTo(x0+(i+1)*w/X_GRID,y0+0);
}
canvas->MoveTo(x0+0,y0+0);
for (int j=0; j<Y_GRID+1; j++){
canvas->LineTo(x0+w,y0+j*h/Y_GRID);
canvas->MoveTo(x0+0,y0+(j+1)*h/Y_GRID);
}
canvas->Pen->Color = clYellow;
canvas->MoveTo(x0+0,y0+iFloor(float(h)-float(h)*0.01f)); // snd cull = 0.01f
canvas->LineTo(x0+w,y0+iFloor(float(h)-float(h)*0.01f));
ESoundThumbnail* thm = m_THM_Current.back();
float d_cost = thm->MaxDist()/w;
AnsiString temp;
// float v = m_D3D.range;
// temp.sprintf("Range = %.2f",v); lbRange->Caption = temp;
canvas->Pen->Color = clLime;
for (int d=1; d<w; d++){
float R = d*d_cost;
float b = thm->MinDist()/(psSoundRolloff*R);
// float b = m_Brightness/(m_Attenuation0+m_Attenuation1*R+m_Attenuation2*R*R);
float bb = h-(h*b);
int y = iFloor(y0+bb); clamp(y,int(rect.Top),int(rect.Bottom));
if (1==d) canvas->MoveTo(x0+d,y);
else canvas->LineTo(x0+d,y);
}
}