void __fastcall TForm4::PaintBox4Paint(TObject *Sender) { TCanvas *FormCanvas = ((TPaintBox*)Sender)->Canvas; int CenterX, CenterY; double deg; TSize stSize; stSize.cx = 0; if (ListBox1->ItemIndex < 0) ListBox1->ItemIndex = 0; //Пишет FormCanvas->Font->Name = "GOST type A"; FormCanvas->Font->Size = 50; FormCanvas->Font->Style = TFontStyles() << fsItalic; FormCanvas->TextOut(70, 30, ListBox1->Items->operator [](ListBox1->ItemIndex)); //Рисует //deg = 60*M_PI/180; FormCanvas->Pen->Width = 3; FormCanvas->MoveTo(20, 50); FormCanvas->LineTo(45, 96); FormCanvas->LineTo(80, 23); //Дополнительная верхняя линия которая зависит от размера текста stSize = FormCanvas->TextExtent(ListBox1->Items->operator [](ListBox1->ItemIndex)); if ( ListBox1->Items->operator [](ListBox1->ItemIndex).Length()) { FormCanvas->LineTo(90 + stSize.cx, 23); } //Дополнительные значки зависящие от панелей if (Panel2->BevelOuter == bvLowered) { FormCanvas->MoveTo(20, 50); FormCanvas->LineTo(67, 50); } if (Panel3->BevelOuter == bvLowered) { FormCanvas->Ellipse(30, 48, 60, 78); } //Полка if ((Panel5->BevelOuter == bvLowered) || (Panel6->BevelOuter == bvLowered)) { FormCanvas->MoveTo(80 + stSize.cx, 96); FormCanvas->LineTo(30, 96); FormCanvas->LineTo(5, 130); } if (Panel6->BevelOuter == bvLowered) { FormCanvas->MoveTo(5, 130); FormCanvas->LineTo(13, 110); FormCanvas->MoveTo(5, 130); FormCanvas->LineTo(22, 116); } //По контуру if (Panel7->BevelOuter == bvLowered) { FormCanvas->MoveTo(80, 23); FormCanvas->Brush->Style = bsClear; FormCanvas->Ellipse(80-15, 23 - 15, 80+15, 23+15); } }
//=========================================================================== void TSigCorection::DrawElementFace() { TCanvas *dbCanvas = VisualElementParam->Bitmap->Canvas; int aw = VisualElementParam->Width ; int ah = VisualElementParam->Height; AnsiString as = "A B"; dbCanvas->Brush->Color = clWhite; dbCanvas->Pen ->Color = clBlack; dbCanvas->Rectangle(0, 0, aw, ah); // --------- Отрисовка прямоугольника --- (прямокгольник процесса разработки) ----- if (DesignPhase != dpAllreadyTesting) { if (DesignPhase == dpNotTesting ) { dbCanvas->Pen ->Color = clRed; } if (DesignPhase == dpNeedModified) { dbCanvas->Pen ->Color = clRed; dbCanvas->Pen ->Style = psDot; } dbCanvas->Rectangle(2, 2, VisualElementParam->Width - 2, VisualElementParam->Height - 2); dbCanvas->Pen->Color = clBlack; dbCanvas->Pen->Style = psSolid; } dbCanvas->TextOut((aw - dbCanvas->TextWidth(as))/2, (ah - dbCanvas->TextHeight(as))/2, as); dbCanvas->Ellipse(aw / 2 - 1, ah / 2 - 1, aw / 2 + 1, ah / 2 + 1); }
void __fastcall TForm4::PaintBox8Paint(TObject *Sender) { TCanvas *FormCanvas = ((TPaintBox*)Sender)->Canvas; int CenterX, CenterY; if (((TPanel *)((TPaintBox *)Sender)->Parent)->BevelOuter == bvLowered) FormCanvas->Pen->Width = 2; else FormCanvas->Pen->Width = 1; CenterX = 15; CenterY = 16; FormCanvas->Ellipse(CenterX + 6, CenterY - 15, CenterX + 16, CenterY - 5); FormCanvas->MoveTo(CenterX - 8, CenterY - 3); FormCanvas->LineTo(CenterX, CenterY + 11); FormCanvas->LineTo(CenterX + 11, CenterY - 12); }
//=========================================================================== void Tasd::DrawElementFace() { TCanvas *dbCanvas = VisualElementParam->Bitmap->Canvas; int aw = VisualElementParam->Width; int ah = VisualElementParam->Height; // -------- int w = 0.35 * aw; int h = 0.35 * ah; int cx = VisualElementParam->sLeft + aw / 2; int cy = VisualElementParam->sTop + ah / 2; // -------- dbCanvas->Brush->Color = clWhite; dbCanvas->Pen ->Color = clBlack; // -------- dbCanvas->Rectangle(0, 0, aw, ah); // -------- dbCanvas->Ellipse(cx - w/2, cy - h/2, cx + w/2, cy + h/2); }
void EllipticShape::OnPaint( const GUI::DrawContext& inDC ) { #ifdef __BORLANDC__ TCanvas* pCanvas = new TCanvas; try { pCanvas->Handle = inDC.handle; TRect winRect( inDC.rect.left, inDC.rect.top, inDC.rect.right, inDC.rect.bottom ); if( this->FillColor() == RGBColor::NullColor ) { pCanvas->Brush->Style = bsClear; } else { pCanvas->Brush->Style = bsSolid; pCanvas->Brush->Color = TColor( this->FillColor().ToWinColor() ); } if( this->Color() == RGBColor::NullColor ) { pCanvas->Pen->Style = psClear; } else { pCanvas->Pen->Style = psSolid; pCanvas->Pen->Color = TColor( this->Color().ToWinColor() ); pCanvas->Pen->Width = this->LineWidth(); } pCanvas->Ellipse( winRect ); } __finally { delete pCanvas; } #endif // __BORLANDC__ }