void __fastcall TFormMain::listWorksCustomDrawItem(TCustomListView *Sender, TListItem *Item, TCustomDrawState State, bool &DefaultDraw) { if (NColor->Checked) { int numKHR = (int)(Item->Data) >> 16; int numWork = (int)(Item->Data) % (256*256); TColor color = clWindowText; listWorks->Canvas->Font->Style = TFontStyles(); switch (Controller->getWorkDateState(numKHR, numWork)) { case E_WDS_CLOSE: case E_WDS_DELETE: color = clSilver; break; case E_WDS_FUTURE: color = 0x00f1be90; break; case E_WDS_CURRENT: if (Controller->diffDate(numKHR, numWork) < 7) color = 0x000093ff; break; case E_WDS_EXPIRE: color = clRed; listWorks->Canvas->Font->Style = TFontStyles() << fsBold; break; default: break; } listWorks->Canvas->Font->Color = color; }
//=========================================================================== void __fastcall CChartManager::on_Draw_CheckListBox(Controls::TWinControl* Control, int Index, const Types::TRect &aRect, TOwnerDrawState State) { if ( pStorage == NULL ) return; if ( Index >= pStorage->ItemsCount) return; TCheckListBox *lb = dynamic_cast<TCheckListBox*>(Control); if ( lb == NULL ) return; lb->Canvas->Brush->Color = lb->Color; lb->Canvas->Font ->Color = clBlack; lb->Canvas->FillRect(Rect(aRect.Left, aRect.Top, aRect.Right, aRect.Bottom)); // ----- Вывод названия графика ---- lb->Canvas->Font->Style = TFontStyles() << fsBold; lb->Canvas->TextOut(aRect.Left + 3, aRect.Top + 1, lb->Items->Strings[Index]); // ----- Вывод значений---- CCollection<float> *si = (CCollection<float> *)lb->Items->Objects[Index]; // ------ if ( si != NULL ) if ( si->ValuesCount != 0 ) { if ( Chart->CurrentMousePos.PosInGraphArray == -1 || Chart->CurrentMousePos.IndexInGlobalArray == -1 ) sprintf(LabelText, "CV : ---------\0"); else sprintf(LabelText, "CV : %1.9f\0", si->Values[Chart->CurrentMousePos.IndexInGlobalArray]); } lb->Canvas->Font->Style = TFontStyles(); lb->Canvas->TextOut( aRect.Left + 3, aRect.Top + 18, LabelText ); }
void __fastcall TTMTimeLineMainForm::lbObjFontStyleClickCheck( TObject *Sender) { TFontStyles F; F = TFontStyles() >> fsBold >> fsItalic >> fsUnderline >> fsStrikeOut; if( lbObjFontStyle->Checked[0]) { F = F + TFontStyles() << fsBold; } if( lbObjFontStyle->Checked[1] ) { F = F + TFontStyles() << fsItalic ; } if( lbObjFontStyle->Checked[2] ) { F = F + TFontStyles() << fsUnderline; } if( lbObjFontStyle->Checked[3] ) { F = F + TFontStyles() << fsStrikeOut; } JvTimeLine1->ObjectsFontStyle = F; }
void __fastcall TfrmHelp::tvHelpExplorerCustomDrawItem(TCustomTreeView *Sender, TTreeNode *Node, TCustomDrawState State, bool &DefaultDraw) { TCanvas *oCanvas; TRect oNodeRect; //--------------------------------------------------------------------------- // Initialize resources oCanvas = Sender->Canvas; oNodeRect = Node->DisplayRect(false); //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Set the node font settings oCanvas->Font->Color = (TColor)DEFAULT_NODE_FONT_COLOR; if (Node->HasChildren == false) oCanvas->Font->Style = TFontStyles(); else oCanvas->Font->Style = TFontStyles() << Graphics::fsItalic; //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Set the node background if (State.Contains(Comctrls::cdsSelected) == false) oCanvas->Brush->Color = this->tvHelpExplorer->Color; else oCanvas->Brush->Color = (TColor)DEFAULT_SELECTED_NODE_BACK_COLOR; //--------------------------------------------------------------------------- DefaultDraw = true; return; }
//--------------------------------------------------------------------------- void TPlottingRoutine::Plot(int generations){ Form2->Show(); int width = Form2->PaintBox1->Width; int height = Form2->PaintBox1->Height; Form2 -> PaintBox1 -> Canvas -> Brush -> Color = clWhite; Form2 -> PaintBox1 -> Canvas -> Rectangle(0, 0, width, height); float peak = -1e6; for(int i = 0; i < generations; i ++) if(Form1->max[ i] > peak) peak = Form1->max[ i]; Form2->PaintBox1->Canvas->MoveTo(0, height-40); Form2->PaintBox1->Canvas->LineTo(width, height-40); Form2->PaintBox1->Canvas->MoveTo(40, height); Form2->PaintBox1->Canvas->LineTo(40, 0); Form2->PaintBox1->Canvas->Pen->Style = psDot; Form2->PaintBox1->Canvas->Pen->Color = cl3DDkShadow; Form2->PaintBox1->Canvas->MoveTo(40+(width-30)*Form1->generation/generations, height-40); Form2->PaintBox1->Canvas->LineTo(40+(width-30)*Form1->generation/generations, (height-40)-Form1->max[ generations - 1]*(height-40)/(1.1*peak)); Form2->PaintBox1->Canvas->MoveTo(40, (height-40)-Form1->max[ generations - 1]*(height-40)/(1.1*peak)); Form2->PaintBox1->Canvas->LineTo(width, (height-40)-Form1->max[ generations - 1]*(height-40)/(1.1*peak)); Form2->PaintBox1->Canvas->Pen->Style = psSolid; Form2->PaintBox1->Canvas->MoveTo(40, (height-40)-Form1->max[ 0]*(height-40)/(1.1*peak)); Form2->PaintBox1->Canvas -> Pen -> Color = clBlue; for(int i = 1; i < generations; i ++) Form2->PaintBox1->Canvas->LineTo(40+i*(width-40)/(generations-1), (height-40)-Form1->max[ i]*(height-40)/(1.1*peak)); Form2->PaintBox1->Canvas->MoveTo(40, (height-40)-Form1->average[ 0]*(height-40)/(1.1*peak)); Form2->PaintBox1->Canvas -> Pen -> Color = clLime; for(int i = 1; i < generations; i ++) Form2->PaintBox1->Canvas->LineTo(40+i*(width-40)/(generations-1), (height-40)-Form1->average[ i]*(height-40)/(1.1*peak)); Form2->PaintBox1->Canvas->MoveTo(40, (height-40)-Form1->st_dew[ 0]*(height-40)/(1.1*peak)); Form2->PaintBox1->Canvas -> Pen -> Color = clRed; for(int i = 1; i < generations; i ++) Form2->PaintBox1->Canvas->LineTo(40+i*(width-40)/(generations-1), (height-40)-Form1->st_dew[i]*(height-40)/(1.1*peak)); Form2->PaintBox1->Canvas -> Pen -> Color = clBlack; Form2->PaintBox1->Canvas->Font->Name = "Arial"; Form2->PaintBox1->Canvas->Font->Size = 10; Form2->PaintBox1->Canvas->TextOut(40+(width-30)*Form1->generation/generations, height - 60, AnsiString(Form1->generation)); Form2->PaintBox1->Canvas->TextOut( 45, 5, "Fitnes"); Form2->PaintBox1->Canvas->TextOut( 20, 24, AnsiString(Form1->max[generations - 1])); Form2->PaintBox1->Canvas->TextOut( width / 2, height - 30, "Generation"); Form2->PaintBox1->Canvas->TextOut( 45, height - 35, 0); Form2->PaintBox1->Canvas->TextOut( 30, height - 60, 0); Form2->PaintBox1->Canvas->TextOut( 0.95*width, height - 35, generations); Form2->PaintBox1->Canvas->Rectangle(0.86*width, height - 303, 0.99*width, height - 240); Form2->PaintBox1->Canvas -> Pen -> Color = clBlue; Form2->PaintBox1->Canvas->MoveTo(0.88*width, height - 290); Form2->PaintBox1->Canvas->LineTo(0.92*width, height - 290); Form2->PaintBox1->Canvas -> Pen -> Color = clLime; Form2->PaintBox1->Canvas->MoveTo(0.88*width, height - 270); Form2->PaintBox1->Canvas->LineTo(0.92*width, height - 270); Form2->PaintBox1->Canvas -> Pen -> Color = clRed; Form2->PaintBox1->Canvas->MoveTo(0.88*width, height - 250); Form2->PaintBox1->Canvas->LineTo(0.92*width, height - 250); Form2->PaintBox1->Canvas->TextOut( 0.93*width, height - 300, "Max"); Form2->PaintBox1->Canvas->TextOut( 0.93*width, height - 280, "Avg"); Form2->PaintBox1->Canvas->TextOut( 0.93*width, height - 260, "StDev"); Form2->PaintBox1->Canvas->Font->Style = TFontStyles()<< fsBold; Form2->PaintBox1->Canvas->TextOut( 0.44 * width, 5, "Fitness Progression"); Form2->PaintBox1->Canvas -> Pen -> Color = clBlack; Form2->PaintBox1->Canvas->Font->Style = TFontStyles()>> fsBold; }
//******************************************************************************** //******************************************************************************** //******************************************************************************** // Enables/Disable UI components based on the state of the allocator void TfrmObjAllocMain::UpdateUI(void) { if (FStudentObjectMgr) // enable { int freeObjects = FStudentObjectMgr->GetStats().FreeObjects_; lblFreeObjects->Caption = IntToStr(freeObjects); lblFreeList->Caption = IntToStr(freeObjects); int pages = FStudentObjectMgr->GetStats().PagesInUse_; lblPagesAllocated->Caption = IntToStr(pages); int objectsUsed = FStudentObjectMgr->GetStats().ObjectsInUse_; lblObjectsInUse->Caption = IntToStr(objectsUsed); int pagesize = FStudentObjectMgr->GetStats().PageSize_; lblPageSize->Caption = IntToStr(pagesize); lblObjectsPerPage->Caption = IntToStr(FObjectsPerPage); lblObjectsAllocated->Caption = IntToStr(pages * FObjectsPerPage); lblManagerActive->Caption = "Object Manager is ACTIVE"; lblManagerActive->Font->Style = TFontStyles()<< fsBold; btnCreate->Enabled = false; btnDestroy->Enabled = true; btnCreateOneStudent->Enabled = true; btnCreateThreeStudents->Enabled = true; btnCreate100Students->Enabled = true; btnFreeStudents->Enabled = true; btnDeleteFirst->Enabled = true; btnError->Enabled = true; btnCreateXStudents->Enabled = true; btnDumpMemoryInUse->Enabled = true; btnFreeEmptyPages->Enabled = true; } else // disable or set to 0 { for (int i = 0; i < sboxButtons->ControlCount; i++) { TControl *control = sboxButtons->Controls[i]; if (control->InheritsFrom(__classid(TButton))) control->Enabled = false; if (dynamic_cast<TButton *>(control) != 0) control->Enabled = false; } btnCreate->Enabled = true; lblAllocated->Caption = "0"; lblPagesAllocated->Caption = "0"; lblObjectsPerPage->Caption = "0"; lblObjectsAllocated->Caption = "0"; lblFreeObjects->Caption = "0"; lblFreeList->Caption = "0"; lblObjectsInUse->Caption = "0"; lblPageSize->Caption = "0"; lblManagerActive->Caption = "Object Manager is INACTIVE"; lblManagerActive->Font->Style = TFontStyles(); } }
//--------------------------------------------------------------------------- __fastcall TCFin1003B::TCFin1003B(TComponent* Owner, String sMsg) : TForm(Owner,1) { this->BorderStyle = bsDialog; this->BorderIcons = TBorderIcons() << biSystemMenu; this->Caption = "Cliente em Atraso"; this->Position = poDesktopCenter; Image = new TImage(this); Image->Name = "Image"; Image->Parent = this; Image->Picture->Icon->Handle = LoadIcon(0, IDI_EXCLAMATION); Image->SetBounds(6, 6, 32, 32); ClienteMsg = new TLabel(this); ClienteMsg->Name = "ClienteMsg"; ClienteMsg->Parent = this; ClienteMsg->WordWrap = false; ClienteMsg->AutoSize = true; ClienteMsg->SetBounds(44, 6, 100, 16); ClienteMsg->Font->Color = clRed; ClienteMsg->Font->Style = TFontStyles() << fsBold; ClienteMsg->Caption = sMsg; LiberaMsg = new TLabel(this); LiberaMsg->Name = "LiberaMsg"; LiberaMsg->Parent = this; LiberaMsg->WordWrap = false; LiberaMsg->AutoSize = true; LiberaMsg->SetBounds(44, ClienteMsg->Top + ClienteMsg->Height + 6, 100, 16); LiberaMsg->Font->Color = clBlue; LiberaMsg->Font->Style = TFontStyles() << fsBold; LiberaMsg->Caption = "Novas vendas para o mesmo estão sujeitas a aprovação."; pBtLibera = new TButton(this); pBtLibera->Parent = this; pBtLibera->Caption = "&Liberar"; pBtLibera->Default = true; pBtLibera->ModalResult = mrOk; pBtCancel = new TButton(this); pBtCancel->Parent = this; pBtCancel->Caption = "&Cancelar"; pBtCancel->Cancel = true; pBtCancel->ModalResult = mrCancel; pBtCancel->SetBounds(44+((ClienteMsg->Width > LiberaMsg->Width)? ClienteMsg->Width - 96: LiberaMsg->Width - 96),45,100,23); pBtLibera->SetBounds(pBtCancel->Left-104,45,100,23); this->ClientWidth = pBtCancel->Left + pBtCancel->Width + 6; this->ClientHeight = pBtCancel->Top + pBtCancel->Height + 6; MessageBeep(MB_ICONSTOP); }
void __fastcall TForm4::PaintBox5Paint(TObject *Sender) { TCanvas *FormCanvas = ((TPaintBox*)Sender)->Canvas; int CenterX, CenterY; if (((TPanel *)((TPaintBox *)Sender)->Parent)->BevelOuter == bvLowered) { FormCanvas->Pen->Width = 2; FormCanvas->Font->Style = TFontStyles() << fsBold << fsItalic; } else FormCanvas->Pen->Width = 1; CenterX = 16; CenterY = 16; /*FormCanvas->MoveTo(CenterX + 8, CenterY + 5); FormCanvas->LineTo(CenterX - 8, CenterY + 5);*/ FormCanvas->Font->Name = "Arial"; FormCanvas->Font->Size = 6; //FormCanvas->Font->Style = TFontStyles() << fsBold << fsItalic; FormCanvas->TextOut(CenterX - 9, CenterY + 5, "АВТО"); //Рисование значка щероховатости над полкой FormCanvas->Pen->Width = 1; FormCanvas->MoveTo(CenterX - 5, CenterY - 5); FormCanvas->LineTo(CenterX, CenterY + 4); FormCanvas->LineTo(CenterX + 8, CenterY - 10); }
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); } }
TFontStyles IntegerToFontStyles(int Value) { TFontStyles Result = TFontStyles(); for (int AFontStyle = fsBold; AFontStyle <= fsStrikeOut; AFontStyle++) if (Value & (1 << AFontStyle)) Result << (TFontStyle)AFontStyle; return Result; }
//--------------------------------------------------------------------------- __fastcall TCFin1003C::TCFin1003C(TComponent* Owner, String sMsg) : TForm(Owner,1) { this->BorderStyle = bsDialog; this->BorderIcons = TBorderIcons() << biSystemMenu; this->Caption = "Cliente Bloqueado"; this->Position = poDesktopCenter; Image = new TImage(this); Image->Name = "Image"; Image->Parent = this; Image->Picture->Icon->Handle = LoadIcon(0, IDI_ERROR); Image->SetBounds(6, 6, 32, 32); ClienteMsg = new TLabel(this); ClienteMsg->Name = "ClienteMsg"; ClienteMsg->Parent = this; ClienteMsg->WordWrap = false; ClienteMsg->AutoSize = true; ClienteMsg->SetBounds(44, 6, 100, 16); ClienteMsg->Font->Color = clRed; ClienteMsg->Font->Style = TFontStyles() << fsBold; ClienteMsg->Caption = sMsg; LiberaMsg = new TLabel(this); LiberaMsg->Name = "LiberaMsg"; LiberaMsg->Parent = this; LiberaMsg->WordWrap = false; LiberaMsg->AutoSize = true; LiberaMsg->SetBounds(44, ClienteMsg->Top + ClienteMsg->Height + 6, 100, 16); LiberaMsg->Font->Color = clBlue; LiberaMsg->Font->Style = TFontStyles() << fsBold; LiberaMsg->Caption = "Novas vendas para o mesmo somente com aprovação da gerência."; pBtOK = new TButton(this); pBtOK->Parent = this; pBtOK->Caption = "&OK"; pBtOK->Default = true; pBtOK->ModalResult = mrOk; pBtOK->SetBounds(44+((ClienteMsg->Width > LiberaMsg->Width)? ClienteMsg->Width - 70: LiberaMsg->Width - 70),45,75,23); this->ClientWidth = pBtOK->Left + pBtOK->Width + 6; this->ClientHeight = pBtOK->Top + pBtOK->Height + 6; MessageBeep(MB_ICONSTOP); }
//=========================================================================== void TKalmanBajas::DrawElementFace() { AnsiString as = "ОФК (Б)"; TCanvas *dbCanvas = VisualElementParam->Bitmap->Canvas; int aw = VisualElementParam->Width; int ah = VisualElementParam->Height; int FontSize = dbCanvas->Font->Size; AnsiString FontName = dbCanvas->Font->Name; TFontStyles FontStyles = dbCanvas->Font->Style; TColor FontColor = dbCanvas->Font->Color; dbCanvas->Font->Style = TFontStyles(); dbCanvas->Font->Style = TFontStyles() << fsBold; dbCanvas->Font->Color = clMaroon; if (dbCanvas->TextWidth(as) > aw - 4) dbCanvas->Font->Name = "Times New Roman"; while (dbCanvas->TextWidth(as) > aw - 4) dbCanvas->Font->Size--; 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->Font->Size = FontSize; dbCanvas->Font->Name = FontName; dbCanvas->Font->Style = FontStyles; dbCanvas->Font->Color = FontColor; }
void TRfd::CommonConstructor(TComponent * owner) { // Network stuff Node_Type = NT_END_DEVICE; Cluster_Level = CLUSTER_LEVEL_UNKNOWN; Tx_Range = 80; MAC_Address = 0; Parent_Node = NULL; Node_State = NS_NODE_IDLE; Retry_Counter = 0; // Visual stuff Node_Body = new TShape(owner); Node_Body->Shape = stCircle; Node_Body->Width = DEFAULT_NODE_SIZE; Node_Body->Height = DEFAULT_NODE_SIZE; Node_Body->Pen->Color = RFD_COLOUR; Node_Body->Brush->Color = RFD_COLOUR; Node_Body->OnMouseDown = formMain->shNodeMouseDown; Node_Body->OnMouseMove = formMain->shNodeMouseMove; Node_Body->OnMouseUp = formMain->shNodeMouseUp; Node_Range = new TShape(owner); Node_Range->Shape = stCircle; Node_Range->Brush->Style = bsClear; Node_Range->Pen->Color = RFD_COLOUR; Node_Range->Width = Tx_Range * 2; Node_Range->Height = Tx_Range * 2; Node_Range->Visible = false; Node_Label = new TLabel(owner); Node_Label->Color = RFD_COLOUR; Node_Label->Caption = "00"; Node_Label->Font->Name = "Arial"; Node_Label->Font->Size = 8; Node_Label->Font->Color = clBlack; Node_Label->Font->Style = TFontStyles() << fsBold; Node_Label->OnMouseDown = formMain->shNodeMouseDown; Node_Label->OnMouseMove = formMain->shNodeMouseMove; Node_Label->OnMouseUp = formMain->shNodeMouseUp; Node_Label->PopupMenu = formMain->menuContextNode; Msg_Timer = new TTimer(owner); Msg_Timer->Enabled = false; Msg_Timer->OnTimer = Msg_TimerTimer; Msg_Timeout_Timer = new TTimer(owner); Msg_Timeout_Timer->Enabled = false; Msg_Timeout_Timer->OnTimer = Msg_Timeout_TimerTimer; Msg_Buffer = new TList; } // End of CommonConstructor
//--------------------------------------------------------------------------- void __fastcall TSettingsFormClass::DefaultCardFontPanelClick(TObject *Sender) { CardFont->Name = "Arial"; CardFont->Size = 10; CardFont->Color = clBlack; CardFontLabel->Font->Name = "Arial"; CardFontLabel->Caption = "Arial"; CardFontLabel->Font->Size = 10; CardSizeLabel->Caption = "10"; CardFontLabel->Font->Color = clBlack; CardFontLabel->Font->Style = TFontStyles(); ApplyButton->Enabled = true; }
void __fastcall TClipMaker::BPOnPaint(TObject *Sender) { TMxPanel* bp = dynamic_cast<TMxPanel*>(Sender); VERIFY(bp); CEditableObject* O = m_CurrentObject; VERIFY(O); TCanvas* canvas = bp->Canvas; canvas->Font->Name = "MS Sans Serif"; canvas->Font->Style = TFontStyles(); canvas->Font->Color = clBlack; canvas->Pen->Color = clBlack; canvas->Pen->Style = psSolid; canvas->Brush->Style= bsSolid; if (-2==bp->Tag){ for (UIClipIt it=clips.begin(); it!=clips.end(); it++){ canvas->Brush->Color= (*it==sel_clip)?(drag_obj==bp->Tag?BP_ACTIVE_DRAG_COLOR:BP_ACTIVE_COLOR):BP_INACTIVE_COLOR; TRect R = TRect((*it)->PLeft(), 1, (*it)->PRight()-1, 15); AnsiString fx_name = (*it)->FXName(); if (!fx_name.IsEmpty()){ canvas->Rectangle (R); R.Top += 1; R.Bottom -= 1; R.Left += 1; R.Right -= 1; canvas->TextRect (R,R.Left,R.Top,fx_name); } } }else if ((bp->Tag>=0)&&(bp->Tag<(int)O->BoneParts().size())){ AnsiString mn_prev = ""; for (UIClipIt it=clips.begin(); it!=clips.end(); it++){ AnsiString mn = (*it)->CycleName(u16(bp->Tag)); TRect R = TRect((*it)->PLeft(), 1, (*it)->PRight()-1, 15); if (!mn.IsEmpty()){ canvas->Brush->Color= (*it==sel_clip)?(drag_obj==bp->Tag?BP_ACTIVE_DRAG_COLOR:BP_ACTIVE_COLOR):BP_INACTIVE_COLOR; canvas->Rectangle (R); R.Top += 1; R.Bottom -= 1; R.Left += 1; R.Right -= 1; canvas->TextRect (R,R.Left,R.Top,mn); mn_prev = mn; }else if (!mn_prev.IsEmpty()){ canvas->MoveTo ((*it)->PLeft()+1,13); canvas->LineTo (R.Right,13); canvas->LineTo (R.Width()>5?R.Right-5:R.Right-R.Width(),8); R.Top += 1; R.Bottom -= 1; R.Left += 1; R.Right -= 1; } } } }
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++; } }
//--------------------------------------------------------------------------- void __fastcall TSettingsFormClass::DefaultEditFontPanelClick(TObject *Sender) { EditFont->Name = "Tahoma"; EditFont->Size = 9; EditFont->Color = clBlack; EditFontLabel->Font->Name = "Tahoma"; EditFontLabel->Caption = "Tahoma"; EditFontLabel->Font->Size = 9; EditSizeLabel->Caption = "9"; EditFontLabel->Font->Color = clBlack; EditColorPanel->Color = clBlack; EditFontLabel->Font->Style = TFontStyles(); ApplyButton->Enabled = true; }
void __fastcall TIntMinerField::DrawOpenedCell(TCanvas* ACanvas, TRect ARect, TCellStateRec ACellState) { ACanvas->Brush->Color = FOpenCellBkColor; ACanvas->FillRect(ARect); ACanvas->Pen->Style = psSolid; ACanvas->Pen->Color = FRectangleColor; ARect.Left--; ARect.Top--; ACanvas->Rectangle(ARect.Left, ARect.Top, ARect.Right, ARect.Bottom); ARect.Right--; ARect.Bottom--; ACanvas->Font->Style = TFontStyles() << fsBold; if(ACellState.SurroundNumber >= 1) ACanvas->Font->Color = FSurroundColors[ACellState.SurroundNumber-1]; FGrid->Brush->Style = bsClear; if(ACellState.SurroundNumber != 0) AlignTextInCell(ACanvas, ARect, IntToStr(ACellState.SurroundNumber)); }
void TfraLeftBar::RefreshBar() { miRecentFiles->Clear(); u32 idx = 0; for (AStringIt it=EPrefs->scene_recent_list.begin(); it!=EPrefs->scene_recent_list.end(); it++){ TMenuItem *MI = xr_new<TMenuItem>((TComponent*)0); MI->Caption = *it; MI->OnClick = miRecentFilesClick; MI->Tag = 0x1001; miRecentFiles->Insert(idx++,MI); } miRecentFiles->Enabled = miRecentFiles->Count; // refresh target for (ObjClassID k=OBJCLASS_FIRST_CLASS; k<OBJCLASS_COUNT; k++){ m_TargetButtons[k]->Enabled = Scene->GetMTools(k)->IsEnabled(); m_TargetButtons[k]->NormalColor = Scene->GetMTools(k)->IsEditable()?clBlack:clGray; m_TargetButtons[k]->Font->Style = Scene->GetMTools(k)->IsForceReadonly()?TFontStyles()<<fsStrikeOut:TFontStyles(); } }
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]); } }
void __fastcall TPrintList::PrintF121Click(TObject *Sender) { if(Memo1->Lines->Strings[0].Length()>=153) { int lenleft=Memo1->Lines->Strings[0].Length()-152; AnsiString mess; mess="Line width exceeds printer width by "+IntToStr(lenleft)+" charactors.\n"; mess=mess+"Do you still want to print it ??\n"; int messbox=Application->MessageBox(mess.c_str(),"Possible problem with print job...",MB_YESNO); if(messbox==IDNO) return; } if (PrintDialog1->Execute()) { int ln=0; TPrinter *Prn=Printer(); Prn->Canvas->Font->Name="Lucida Console"; Prn->Canvas->Font->Style=TFontStyles()<<fsBold; Prn->Canvas->Font->Size=8;// read up on this one // int chrsize=Prn->Canvas->Font->PixelsPerInch; int maxlines=91; if(Memo1->Lines->Strings[0].Length()>=114) { Prn->Orientation=poLandscape; maxlines=70; } Prn->BeginDoc(); for( int i=0;i<Memo1->Lines->Count;i++) { Prn->Canvas->TextOut(200,200+(ln*Prn->Canvas->TextHeight(Memo1->Lines->Strings[i])), Memo1->Lines->Strings[i]); ln++; if(ln>=maxlines) { Prn->NewPage(); ln=0; } } Prn->EndDoc(); } }
void __fastcall TClipMaker::ClipPaint(TObject *Sender) { TMxPanel* P = dynamic_cast<TMxPanel*>(Sender); VERIFY(P); TCanvas* canvas = P->Canvas; canvas->Font->Name = "MS Sans Serif"; canvas->Font->Style = TFontStyles(); canvas->Font->Color = clBlack; canvas->Pen->Color = clBlack; canvas->Pen->Style = psSolid; canvas->Brush->Style= bsSolid; for (UIClipIt it=clips.begin(); it!=clips.end(); it++){ TRect R = TRect((*it)->PLeft(), 1, (*it)->PRight()-1, paClips->Height); canvas->Pen->Width = 1; canvas->Brush->Color= (*it==sel_clip)?(drag_obj==P->Tag?CLIP_ACTIVE_DRAG_COLOR:CLIP_ACTIVE_COLOR):CLIP_INACTIVE_COLOR; canvas->Rectangle (R); R.Top += 1; R.Bottom -= 1; R.Left += 1; R.Right -= 1; canvas->TextRect (R,R.Left,R.Top,*(*it)->name); } }
void __fastcall TClipMaker::gtClipPaint(TObject *Sender) { TCanvas* canvas = gtClip->Canvas; canvas->Font->Name = "MS Sans Serif"; canvas->Font->Style = TFontStyles(); canvas->Pen->Color = clBlack; canvas->Pen->Width = 1; canvas->Pen->Style = psSolid; for (UIClipIt it=clips.begin(); it!=clips.end(); it++){ canvas->MoveTo ((*it)->PLeft(), 0); canvas->LineTo ((*it)->PLeft(), 6); AnsiString s = AnsiString().sprintf("%2.1f",(*it)->RunTime()); float dx = 2.f; float dy = canvas->TextHeight(s); TRect R = TRect((*it)->PLeft()+1-dx, 20-dy, (*it)->PRight()-dx, 20); canvas->TextRect(R,R.Left,R.Top,s); } if (!clips.empty()){ CUIClip* C = clips.back(); canvas->MoveTo (C->PRight()-1, 0); canvas->LineTo (C->PRight()-1, 6); AnsiString s = AnsiString().sprintf("%2.1f",m_TotalLength); float dx = canvas->TextWidth(s); float dy = canvas->TextHeight(s); TRect R = TRect(C->PRight()-dx, 20-dy, C->PRight(), 20); canvas->TextRect(R,R.Left,R.Top,s); } /* if (g_resizing){ canvas->Pen->Color = clGreen; canvas->MoveTo (g_X_cur, 0); canvas->LineTo (g_X_cur, gtClip->Width); } */ if (m_RTFlags.is(flRT_Playing)){ canvas->Pen->Color = clRed; canvas->MoveTo (m_CurrentPlayTime*m_Zoom, 0); canvas->LineTo (m_CurrentPlayTime*m_Zoom, gtClip->Width); } }
void ShowAbout(int iFontSize, Byte bLineBreak, Byte bVersionPos, String sDate, TPicture *pPicture, String sAddComp, String sVersion, String sAppName, String sCopyright, String sText, HICON hIcon) { TForm *Form; int I; String sCaption; TVSFixedFileInfo FileVersionInfo; String CompanyName, FileDescription, FileVersion, InternalName, LegalCopyright, OriginalFilename, ProductName, ProductVersion; TAboutObject *AboutObject; ShowWaitCursor(); // Randomize; if (IsShift() & IsCtrl()) { sAppName = "Дураев"; sAppName += sLineBreak; sAppName += "Константин Петрович"; sCopyright = ""; sCaption = "Автор"; sDate = "29.03.1981"; sVersion = ""; iFontSize = 16; sAddComp = NULL; pPicture = NULL; sText = ""; for (int i = 1; i < 280; i++) if (i % 40 == 0) sText = sText + sLineBreak; else // TODO: sText = sText + String(AnsiChar(Chr(Ord('А') + // Random(Ord('Я') - Ord('А'))))); sText = sText + L"Я"; } else { GetFileVerInfo(Application->ExeName, FileVersionInfo, CompanyName, FileDescription, FileVersion, InternalName, LegalCopyright, OriginalFilename, ProductName, ProductVersion); sCaption = LoadStr(IDS_ABOUT_CAPTION); if (sDate == NULL) sDate = FormatDateTime("yyyy.mm.dd", UnixToDateTime(((PIMAGE_NT_HEADERS)((DWORD)((PIMAGE_DOS_HEADER) HInstance) + (((PIMAGE_DOS_HEADER) HInstance)->e_lfanew))) ->FileHeader.TimeDateStamp)); if (sVersion == NULL) { sVersion = FileVersion; if (IsValueInWord(FileVersionInfo.dwFileFlags, VS_FF_DEBUG)) sVersion = sVersion + LoadStr(IDS_ABOUT_DEBUG); else if (IsValueInWord(FileVersionInfo.dwFileFlags, VS_FF_PRERELEASE)) sVersion = sVersion + LoadStr(IDS_ABOUT_RC); } if (sAppName == NULL) sAppName = ProductName; if (sCopyright == NULL) sCopyright = LegalCopyright + "|@[email protected]"; if (sText == NULL) { sText = LoadStr(IDS_ABOUT_EULA1) + sLineBreak + LoadStr(IDS_ABOUT_EULA2) + sLineBreak + LoadStr(IDS_ABOUT_EULA3) + sLineBreak + LoadStr(IDS_ABOUT_EULA4); } if (bLineBreak != MAXBYTE) { I = PosPlace(SPACE, sAppName, bLineBreak); sAppName = sAppName.SubString(1, I - 1) + sLineBreak + sAppName.SubString(I + 1, MAXINT); } } // IsShift and IsCtrl if (hIcon == NULL) hIcon = LoadIcon(HInstance, L"MAINICON"); AboutObject = new TAboutObject(); Form = new TForm(Application); // Owner; Form->ShowHint = true; Form->Font->Name = "Arial"; Form->Font->Size = 10; Form->BorderStyle = bsDialog; Form->Caption = sCaption; Form->ClientHeight = 165; Form->ClientWidth = 420; TBevel *bvlIconFrame = new TBevel(Form); bvlIconFrame->Parent = Form; bvlIconFrame->SetBounds(8, 14, 52, 52); bvlIconFrame->Shape = bsFrame; TPanel *pnlIcon = new TPanel(Form); pnlIcon->Parent = Form; pnlIcon->SetBounds(16, 22, 36, 36); pnlIcon->Caption = ""; pnlIcon->BevelOuter = bvNone; pnlIcon->BorderStyle = bsSingle; pnlIcon->ParentBackground = false; pnlIcon->Color = (TColor) Random(0xFFFFFF); TImage *imgIcon = new TImage(Form); // Icon imgIcon->Parent = pnlIcon; imgIcon->Align = alClient; imgIcon->Transparent = true; imgIcon->Picture->Icon->Handle = hIcon; TLabel *lblCopyright = new TLabel(Form); // Copyright lblCopyright->Tag = 1; lblCopyright->Parent = Form; lblCopyright->Font->Style = TFontStyles() << fsBold; lblCopyright->SetBounds(8, 80, 0, 0); int PosHint = Pos('|', sCopyright); if (PosHint == 0) lblCopyright->Caption = sCopyright; else { lblCopyright->Caption = sCopyright.SubString(1, PosHint - 1); lblCopyright->Hint = sCopyright.SubString(PosHint + 1, MAXINT); lblCopyright->Cursor = crHandPoint; lblCopyright->OnMouseEnter = AboutObject->MouseEnter; lblCopyright->OnMouseLeave = AboutObject->MouseLeave; if (lblCopyright->Hint[1] == '@') { lblCopyright->Hint = lblCopyright->Hint.SubString(2, MAXINT); AboutObject->MailAddress = lblCopyright->Hint; AboutObject->MailSubject = OriginalFilename + " " + FileVersion; } lblCopyright->OnClick = AboutObject->Click; } TLabel *lblText = new TLabel(Form); // Text lblText->Parent = Form; lblText->WordWrap = true; lblText->SetBounds(8, 100, Form->ClientWidth - 16, 0); lblText->Caption = sText; // I = lblText->Top + lblText->Height; Form->ClientHeight = Form->ClientHeight + lblText->Height; if (sAddComp != NULL) { /* with TBevel.Create(Form) do { Parent = Form; SetBounds(7, I + 5, Form.ClientWidth - 15, 5); Shape = bsTopLine; I = Top + Height; }; with TLabel.Create(Form) do // Add Components { Parent = Form; SetBounds(8, I, 0, 0); Caption = 'Программное обеспечение использует следующие компоненты:'; I = Top + Height; }; with TLabel.Create(Form) do // Components { Tag = 2; Parent = Form; Font.Style = [fsBold]; SetBounds(8, I, 0, 0); Caption = sAddComp; Form.ClientHeight = Form.ClientHeight + Height + 12; if FileExists(FileInAppDir(rsLicenses)) then { Cursor = crHandPoint; OnClick = ClickObject.Click; OnMouseEnter = ClickObject.MouseEnter; OnMouseLeave = ClickObject.MouseLeave; }; } */ } else // sAddComp != NULL Form->ClientHeight = Form->ClientHeight - 12; TBevel *bvlBottom = new TBevel(Form); bvlBottom->Parent = Form; bvlBottom->SetBounds(7, Form->ClientHeight - 43, Form->ClientWidth - 15, 5); bvlBottom->Shape = bsTopLine; lblMemory = new TLabel(Form); // Физическая ... lblMemory->Parent = Form; lblMemory->SetBounds(8, Form->ClientHeight - 38, 0, 0); lblMemory->Caption = LoadStr(IDS_ABOUT_MEMORY); lblMemoryValue = new TLabel(Form); // TotalPhys lblMemoryValue->Parent = Form; lblMemoryValue->Font->Style = TFontStyles() << fsBold; lblMemoryValue->SetBounds(lblMemory->Width + 13, Form->ClientHeight - 38, 0, 0); lblProc = new TLabel(Form); // Процессор: lblProc->Parent = Form; lblProc->SetBounds(8, Form->ClientHeight - 22, 0, 0); lblProc->Caption = LoadStr(IDS_ABOUT_PROCESSOR); lblProcValue = new TLabel(Form); // CPUSpeed lblProcValue->Parent = Form; lblProcValue->Font->Style = TFontStyles() << fsBold; lblProcValue->SetBounds(lblMemory->Width + 13, Form->ClientHeight - 22, 0, 0); TGradientPanel *pnlName = new TGradientPanel(Form); pnlName->Parent = Form; pnlName->StartUpdate(); pnlName->SetBounds(68, 8, Form->ClientWidth - 76, 64); pnlName->BorderStyle = bsSingle; pnlName->BevelOuter = bvNone; pnlName->ParentBackground = false; if (pPicture == NULL) pnlName->ColorStart = pnlIcon->Color; else pnlName->ColorStart = clBlack; pnlName->ColorEnd = clBlack; pnlName->EndUpdate(); if (pPicture == NULL) { TLabel *lblAppName = new TLabel(Form); // Application Name (1) lblAppName->Parent = pnlName; lblAppName->SetBounds(2, 2, Form->ClientWidth - 83, 58); lblAppName->Alignment = taCenter; lblAppName->AutoSize = false; lblAppName->Caption = sAppName; lblAppName->ParentColor = false; lblAppName->Color = clBlack; lblAppName->ParentFont = false; lblAppName->Font->Charset = DEFAULT_CHARSET; lblAppName->Font->Color = clBlack; lblAppName->Font->Height = -51; lblAppName->Font->Name = "Courier New"; lblAppName->Font->Style = TFontStyles() << fsBold << fsItalic; lblAppName->Font->Size = iFontSize; lblAppName->Transparent = true; lblAppName->Layout = tlCenter; lblAppName->WordWrap = true; TLabel *lblAppName2 = new TLabel(Form); // Application Name (2) lblAppName2->Parent = pnlName; lblAppName2->SetBounds(0, 0, Form->ClientWidth - 83, 58); lblAppName2->Alignment = taCenter; lblAppName2->AutoSize = false; lblAppName2->Caption = sAppName; lblAppName2->ParentColor = false; lblAppName2->Color = clBlack; lblAppName2->ParentFont = false; lblAppName2->Font->Charset = DEFAULT_CHARSET; lblAppName2->Font->Color = clWhite; lblAppName2->Font->Height = -51; lblAppName2->Font->Name = "Courier New"; lblAppName2->Font->Style = TFontStyles() << fsBold << fsItalic; lblAppName2->Font->Size = iFontSize; lblAppName2->Transparent = true; lblAppName2->Layout = tlCenter; lblAppName2->WordWrap = true; } // pPicture == NULL else { TImage *imgPicture = new TImage(Form); imgPicture->Parent = pnlName; imgPicture->Align = alClient; imgPicture->Picture->Assign(pPicture); } TLabel *lblDate = new TLabel(Form); // Date lblDate->Parent = pnlName; lblDate->Caption = sDate; lblDate->Font->Assign(Form->Font); lblDate->Font->Style = TFontStyles() << fsBold; lblDate->Font->Color = clWhite; lblDate->Font->Size = 8; lblDate->Alignment = taRightJustify; switch (3) { case 0: lblDate->SetBounds(2, 2, lblDate->Width, lblDate->Height); break; case 1: lblDate->SetBounds(2, pnlName->ClientHeight - lblDate->Height - 2, lblDate->Width, lblDate->Height); break; case 2: lblDate->SetBounds(pnlName->ClientWidth - lblDate->Width - 2, 2, lblDate->Width, lblDate->Height); break; default: lblDate->SetBounds(pnlName->ClientWidth - lblDate->Width - 2, pnlName->ClientHeight - lblDate->Height - 2, lblDate->Width, lblDate->Height); } lblDate->Transparent = true; TLabel *lblVerion = new TLabel(Form); // Version lblVerion->Parent = pnlName; lblVerion->Caption = sVersion; lblVerion->Font->Assign(Form->Font); lblVerion->Font->Style = TFontStyles() << fsBold; lblVerion->Font->Color = clWhite; lblVerion->Font->Size = 8; switch (2) { case 0: lblVerion->SetBounds(2, 2, lblVerion->Width, lblVerion->Height); break; case 1: lblVerion->SetBounds(2, pnlName->ClientHeight - lblVerion->Height - 2, lblVerion->Width, lblVerion->Height); break; case 2: lblVerion->SetBounds(pnlName->ClientWidth - lblVerion->Width - 2, 2, lblVerion->Width, lblVerion->Height); break; default: lblVerion->SetBounds(pnlName->ClientWidth - lblVerion->Width - 2, pnlName->ClientHeight - lblVerion->Height - 2, lblVerion->Width, lblVerion->Height); } lblVerion->Transparent = true; TButton *btnClose = new TButton(Form); btnClose->Parent = Form; btnClose->Caption = "OK"; btnClose->ModalResult = mrCancel; btnClose->Cancel = true; btnClose->SetBounds(Form->ClientWidth - 83, Form->ClientHeight - 34, 75, 26); btnClose->TabOrder = 0; TTimer *timer = new TTimer(Form); timer->OnTimer = AboutObject->TimerTimer; timer->Interval = 1; timer->Enabled = true; RestoreCursor(); Form->Left = (Screen->Width - Form->Width) / 2; Form->Top = (Screen->Height - Form->Height) / 2; SetCurPosToCenter(btnClose); Form->ShowModal(); Form->Free(); AboutObject->Free(); lblMemory = NULL; lblProc = NULL; lblMemoryValue = NULL; lblProcValue = NULL; }
//=========================================================================== void __fastcall CChart::DrawNet(TCanvas *aCanvas) { aCanvas->Font->Size = 8; aCanvas->Font->Style = TFontStyles(); aCanvas->Pen->Color = NetColor; aCanvas->Font->Color = clWhite; float yStep = (DrawRect.Bottom - DrawRect.Top) / 10.0; float xStep = (DrawRect.Right - DrawRect.Left) / 10.0; if ( yStep == 0 || xStep == 0) return; // --------------- // CCollection<double> TimeScales; ; //TimeScalesIndex = 10; // VoltScalesIndex = 10; int th = aCanvas->TextWidth("0"); double BeginVal = VoltScales.Values[VoltScalesIndex] * 5; int iCounter = 0; double val; for ( float i = DrawRect.Top; i < DrawRect.Bottom; i = i + yStep, iCounter++) { aCanvas->MoveTo (DrawRect.Left , i); aCanvas->LineTo (DrawRect.Right, i); val = BeginVal - iCounter*VoltScales.Values[VoltScalesIndex]; if ( fabs(val) < 1e-5 ) val = 0; //AnsiString as = FloatToStrF(val, ffFixed, 20, 5); AnsiString as = FloatToStr(round(val * 100000) / 100000.0); int tw = aCanvas->TextWidth(as); aCanvas->TextOut(DrawRect.Left - tw - 8, i - th*0.64, as); } BeginVal = 0; iCounter = 0; for ( float i = DrawRect.Left; i <= DrawRect.Right; i = i + xStep, iCounter++ ) { aCanvas->MoveTo(i, DrawRect.Top); aCanvas->LineTo(i, DrawRect.Bottom); //AnsiString as = FloatToStrF(iCounter*TimeScales.Values[TimeScalesIndex], ffFixed, 20, 5); AnsiString as = FloatToStr(round(iCounter*TimeScales.Values[TimeScalesIndex] * 100000) / 100000.0); int tw = aCanvas->TextWidth(as); aCanvas->TextOut(i - tw * 0.5, DrawRect.Bottom + 8, as); } // ---- Отрисовка дополнительных отметок ------------ float CountTicks = 4.0; float xStep1 = xStep / CountTicks; float yStep1 = yStep / CountTicks; short int x1 = DrawRect.Left - 3; short int x2 = DrawRect.Left + 3; //short int x1 = DrawRect.Left + DrawRect.Width() / 2 - 3; //short int x2 = DrawRect.Left + DrawRect.Width() / 2 + 3; short int y1 = DrawRect.Top + DrawRect.Height() / 2 - 3; short int y2 = DrawRect.Top + DrawRect.Height() / 2 + 3; // ------ Горизонтальная ось --------- for ( float i = DrawRect.Left + xStep1; i < DrawRect.Right - 2; i = i + xStep1 ) { aCanvas->MoveTo(i, y1); aCanvas->LineTo(i, y2); } // ------ Вертикальная осъ --------- for ( float i = DrawRect.Top + yStep1; i < DrawRect.Bottom - 2; i = i + yStep1) { aCanvas->MoveTo(x1, i); aCanvas->LineTo(x2, i); } }
//=========================================================================== void __fastcall CChart::DrawSeriesValues() { Graphics::TCanvas *aCanvas = aaBitmap->Canvas; // ----- Отрисовую Сетку ГРафиков ------ DrawNet(aCanvas); // ----- if ( fCanals != NULL ) { // ----- Если работа в реальном времени, тогда рисуем кривые ---- for ( int i = 0; i < fCanals->ItemsCount; i++ ) { if ( Canals->Items[i]->gr_Checked == false ) continue; aCanvas->Pen->Color = (TColor)0x003300; aCanvas->Polyline(fCanals->Items[i]->gr_Values, fCanals->Items[i]->gr_ValuesCount - 1); if ( isRealTimeWork == true ) LastDrawPoint = fCanals->Items[i]->Count; fCanals->Items[i]->Calculate_gr_Values(false, LastDrawPoint ); aCanvas->Pen->Color = fCanals->Items[i]->gr_Color; aCanvas->Polyline(fCanals->Items[i]->gr_Values, fCanals->Items[i]->gr_ValuesCount - 1); } // --------- Отрисовка курсора ---- if ( isRealTimeWork == false ) { if ( XMousePosition >= DrawRect.Left && XMousePosition <= DrawRect.Right && YMousePosition >= DrawRect.Top && YMousePosition <= DrawRect.Bottom ) { aCanvas->Pen->Color = clWhite; aCanvas->MoveTo(XMousePosition, DrawRect.Top+2); aCanvas->LineTo(XMousePosition, DrawRect.Bottom - 2); AnsiString as1, as2, as_t; bool isTimeValueDrawed = false; int CursorIndex = XMousePosition - DrawRect.Left; double val; SetBkMode(aCanvas->Handle, TRANSPARENT); //aCanvas->Font->Size = 10; aCanvas->Font->Style = TFontStyles() << fsBold; for ( int i = 0; i < Canals->ItemsCount; i++) { if (Canals->Items[i]->Count == 0) continue; if ( CursorIndex >= (int)Canals->Items[i]->Count ) CursorIndex = Canals->Items[i]->Count - 1; if ( CursorIndex < 0 ) CursorIndex = 0; if ( Canals->Items[i]->gr_ValuesCount > 0 ) { if ( CursorIndex >= Canals->Items[i]->gr_ValuesCount ) CursorIndex = Canals->Items[i]->gr_ValuesCount - 1; if ( CursorIndex < 0 ) CursorIndex = 0; val = Canals->Items[i]->Values[Canals->Items[i]->gr_ArrayIndex[CursorIndex]] * Canals->Items[i]->gr_YVoltTransformCoef; as1 = "[V] = " + FloatToStrF(val , ffFixed, 20, 6); as2 = "[G] = " + FloatToStrF(val*9.81, ffFixed, 20, 5); aCanvas->Font->Color = Canals->Items[i]->gr_Color; aCanvas->TextOut(150 + i*100, 10, as1); aCanvas->TextOut(150 + i*100, 27, as2); if ( isTimeValueDrawed == false ) { isTimeValueDrawed = true; // ---- Время курсора ----- as_t = FloatToStrF(Canals->Items[i]->gr_ArrayIndex[CursorIndex] / (double)BaseADC->AcpCanalFreq, ffFixed, 20, 5) + " (c)"; aCanvas->Font->Color = clWhite; aCanvas->TextOut(10, 10, "Время курсора :"); aCanvas->TextOut(10, 27, as_t); } } } } } } // ----- Раскрываем канву --------- pbMain->Canvas->Draw(0, 0, aaBitmap); }
//=========================================================================== CChartManager::CChartManager(Extctrls::TPanel *aParentPanel) { // ---------- Panel_Parent = NULL; Panel_Menu = NULL; Panel_MainBGChart = NULL; Panel_Chart = NULL; Panel_StringGrid = NULL; Panel_SeriesNames = NULL; Panel_CursorTimeValue = NULL; ScrollBar_StringGrid = NULL; StringGrid_Data = NULL; CheckListBox_SeriesNames = NULL; TabControl_SeriesTable = NULL; Button_SelectAllSeries = NULL; Button_DeSelectAllSeries = NULL; Label_PointOnChart = NULL; Edit_PointOnChart = NULL; SpeedButton_PointOnChart = NULL; CheckBox_FullTimeScale = NULL; CheckBox_Decimation = NULL; CheckBox_AutoTracking = NULL; CheckBox_EditMode = NULL; Panel_SelectInterval = NULL; Button_ShowIntervalResults = NULL; pStorage = NULL; // ---------- Panel_Parent = aParentPanel; Panel_Parent->DoubleBuffered = true; Panel_Parent->Color = clBtnFace; Panel_Parent->Parent->Constraints->MinWidth = 720; Panel_Parent->Parent->Constraints->MinHeight = 400; Panel_Parent->OnResize = on_Resize_Panel_Parent; // -------- TabControl - Init ------- TabControl_SeriesTable = new TTabControl(Panel_Parent); TabControl_SeriesTable->Parent = Panel_Parent; TabControl_SeriesTable->Tabs->Add(" Table "); TabControl_SeriesTable->Tabs->Add(" Charts "); TabControl_SeriesTable->Align = alClient; TabControl_SeriesTable->OnChange = TabControl_SeriesTable_onClick; ((TForm*)Panel_Parent->Parent)->ActiveControl = TabControl_SeriesTable; // -------- Panel_Chart - Init ------- Panel_MainBGChart = new TPanel(Panel_Parent); Panel_MainBGChart->Parent = TabControl_SeriesTable; Panel_MainBGChart->Align = alClient; Panel_MainBGChart->BevelInner = bvNone; Panel_MainBGChart->BevelOuter = bvNone; //Panel_MainBGChart->BevelInner = bvLowered; //Panel_MainBGChart->BevelOuter = bvRaised; Panel_MainBGChart->BevelWidth = 1; Panel_MainBGChart->Color = clSilver; Panel_MainBGChart->DoubleBuffered = true; // --------- String Grid ------ Panel_StringGrid = new TPanel(Panel_Parent); Panel_StringGrid->Parent = TabControl_SeriesTable; Panel_StringGrid->Align = alClient; Panel_StringGrid->BevelInner = bvNone; Panel_StringGrid->BevelOuter = bvNone; Panel_StringGrid->BevelWidth = 1; Panel_StringGrid->Color = clWhite; Panel_StringGrid->DoubleBuffered = true; // -------- StringGrid_Data = new TStringGrid(Panel_StringGrid); StringGrid_Data->Parent = Panel_StringGrid; StringGrid_Data->Align = alClient; StringGrid_Data->ScrollBars = ssHorizontal; StringGrid_Data->RowCount = 38; StringGrid_Data->DefaultRowHeight = 30; StringGrid_Data->DefaultColWidth = 85; StringGrid_Data->ColCount = 30; StringGrid_Data->BevelWidth = 1; // -------- ScrollBar_StringGrid = new TScrollBar(Panel_StringGrid); ScrollBar_StringGrid->Parent = Panel_StringGrid; ScrollBar_StringGrid->Align = alRight; ScrollBar_StringGrid->Kind = sbVertical; // -------- Panel_Chart - Init ------- Panel_Chart = new TPanel(Panel_Parent); Panel_Chart->Parent = Panel_MainBGChart; Panel_Chart->Align = alClient; Panel_Chart->BevelInner = bvLowered; Panel_Chart->BevelOuter = bvRaised; Panel_Chart->BevelWidth = 1; Panel_Chart->Color = clSilver; Panel_Chart->DoubleBuffered = true; // -------- Panel_SeriesNames - Init ------- Panel_SeriesNames = new TPanel(Panel_Parent); Panel_SeriesNames->Parent = Panel_MainBGChart; //Panel_Parent; Panel_SeriesNames->Align = alLeft; Panel_SeriesNames->Width = 183; Panel_SeriesNames->BevelInner = bvNone; Panel_SeriesNames->BevelOuter = bvNone; Panel_SeriesNames->BevelWidth = 0; // -------- CheckListBox - Init ------- CheckListBox_SeriesNames = new TCheckListBox(aParentPanel); CheckListBox_SeriesNames->Parent = Panel_SeriesNames; CheckListBox_SeriesNames->Align = alClient; CheckListBox_SeriesNames->Flat = false; CheckListBox_SeriesNames->Ctl3D = false; CheckListBox_SeriesNames->DoubleBuffered = true; CheckListBox_SeriesNames->ItemHeight = 32; CheckListBox_SeriesNames->Color = clWhite; CheckListBox_SeriesNames->OnDrawItem = on_Draw_CheckListBox; CheckListBox_SeriesNames->Style = lbOwnerDrawFixed; CheckListBox_SeriesNames->OnClickCheck = on_ClickCheck_CheckListBox; // -------- Panel_CursorTimeValue - Init ------- Panel_CursorTimeValue = new TPanel(Panel_Parent); Panel_CursorTimeValue->Parent = Panel_SeriesNames; Panel_CursorTimeValue->DoubleBuffered = true; Panel_CursorTimeValue->Align = alBottom; Panel_CursorTimeValue->Font->Size = 12; Panel_CursorTimeValue->Font->Style = TFontStyles()<<fsBold; Panel_CursorTimeValue->BevelInner = bvLowered; Panel_CursorTimeValue->BevelOuter = bvRaised; Panel_CursorTimeValue->BevelWidth = 1; // -------- Panel_Menu - Init ------- Panel_Menu = new TPanel(Panel_Parent); Panel_Menu->Parent = Panel_MainBGChart; //Panel_Parent; Panel_Menu->Align = alTop; Panel_Menu->BevelInner = bvLowered; Panel_Menu->BevelOuter = bvRaised; Panel_Menu->Height = 50; Panel_Menu->BevelWidth = 1; Panel_Menu->DoubleBuffered = true; // -------- Button_SelectAllSeries - Init ------- Button_SelectAllSeries = new TButton(Panel_Parent); Button_SelectAllSeries->Parent = Panel_Menu; Button_SelectAllSeries->Top = 14; Button_SelectAllSeries->Left = 8; Button_SelectAllSeries->Width = 80; Button_SelectAllSeries->Caption = "Select all"; Button_SelectAllSeries->OnClick = on_Click_Button_SelectAllSeries; // -------- Button_DeSelectAllSeries - Init ------- Button_DeSelectAllSeries = new TButton(Panel_Parent); Button_DeSelectAllSeries->Parent = Panel_Menu; Button_DeSelectAllSeries->Top = 14; Button_DeSelectAllSeries->Left = 95; Button_DeSelectAllSeries->Width = 80; Button_DeSelectAllSeries->Caption = "Deselect all"; Button_DeSelectAllSeries->OnClick = on_Click_Button_DeSelectAllSeries; // -------- Label_PointOnChart - Init ------- Label_PointOnChart = new TLabel(Panel_Parent); Label_PointOnChart->Parent = Panel_Menu; Label_PointOnChart->Top = 7; Label_PointOnChart->Left = 198; Label_PointOnChart->Caption = "Point on chart"; // -------- Edit_PointOnChart - Init ------- Edit_PointOnChart = new TEdit(Panel_Parent); Edit_PointOnChart->Parent = Panel_Menu; Edit_PointOnChart->Top = 24; Edit_PointOnChart->Left = 200; Edit_PointOnChart->Width = 52; Edit_PointOnChart->Text = "1000000"; // -------- SpeedButton_PointOnChart - Init ------- SpeedButton_PointOnChart = new TSpeedButton(Panel_Parent); SpeedButton_PointOnChart->Parent = Panel_Menu; SpeedButton_PointOnChart->Top = 24; SpeedButton_PointOnChart->Left = 252; SpeedButton_PointOnChart->Width = 24; SpeedButton_PointOnChart->Height = 21; SpeedButton_PointOnChart->Flat = true; SpeedButton_PointOnChart->Caption = "V"; SpeedButton_PointOnChart->OnClick = on_Click_Button_PointOnChart; // -------- CheckBox_FullTimeScale - Init ------- CheckBox_FullTimeScale = new TCheckBox(Panel_Parent); CheckBox_FullTimeScale->Parent = Panel_Menu; CheckBox_FullTimeScale->Top = 8; CheckBox_FullTimeScale->Left = 290; CheckBox_FullTimeScale->Caption = "Full time scale"; CheckBox_FullTimeScale->OnClick = isFullTimeScaleChecked; // -------- CheckBox_Deciamtion - Init ------- CheckBox_Decimation = new TCheckBox(Panel_Parent); CheckBox_Decimation->Parent = Panel_Menu; CheckBox_Decimation->Top = 28; CheckBox_Decimation->Left = 290; CheckBox_Decimation->Caption = "Decimation"; CheckBox_Decimation->OnClick = isDecimationChecked; // -------- CheckBox_AutoTracking - Init ------- CheckBox_AutoTracking = new TCheckBox(Panel_Parent); CheckBox_AutoTracking->Parent = Panel_Menu; CheckBox_AutoTracking->Top = 8; CheckBox_AutoTracking->Left = 390; CheckBox_AutoTracking->Caption = "Auto tracking"; CheckBox_AutoTracking->OnClick = on_Checked_isAutoTracking; // -------- CheckBox_AutoTracking - Init ------- CheckBox_EditMode = new TCheckBox(Panel_Parent); CheckBox_EditMode->Parent = Panel_Menu; CheckBox_EditMode->Top = 28; CheckBox_EditMode->Left = 390; CheckBox_EditMode->Caption = "Edit mode"; CheckBox_EditMode->OnClick = on_Checked_isEditMode; // -------- CheckBox_AutoTracking - Init ------- CheckBox_XCursor = new TCheckBox(Panel_Parent); CheckBox_XCursor->Parent = Panel_Menu; CheckBox_XCursor->Top = 8; CheckBox_XCursor->Left = 490; CheckBox_XCursor->Caption = "X Cursor"; CheckBox_XCursor->OnClick = on_Checked_isEditMode; // -------- CheckBox_AutoTracking - Init ------- CheckBox_YCursor = new TCheckBox(Panel_Parent); CheckBox_YCursor->Parent = Panel_Menu; CheckBox_YCursor->Top = 28; CheckBox_YCursor->Left = 490; CheckBox_YCursor->Caption = "Y Cursor"; CheckBox_YCursor->OnClick = on_Checked_isEditMode; // -------- Panel_SelectInterval - Init ------- Panel_SelectInterval = new TPanel(Panel_Parent); Panel_SelectInterval->Parent = Panel_Menu; Panel_SelectInterval->Top = 8; Panel_SelectInterval->Left = 565; Panel_SelectInterval->Width = 100; Panel_SelectInterval->Height = Panel_SelectInterval->Parent->Height - 2*8; Panel_SelectInterval->Caption = "Select interval"; Panel_SelectInterval->BevelInner = bvLowered; Panel_SelectInterval->BevelOuter = bvRaised; Panel_SelectInterval->Visible = isDebugMode; Panel_SelectInterval->OnClick = on_Click_Panel_SelectInterval; // -------- Button_ShowIntervalResults - Init ------- Button_ShowIntervalResults = new TButton(Panel_Parent); Button_ShowIntervalResults->Parent = Panel_Menu; Button_ShowIntervalResults->Top = 8; Button_ShowIntervalResults->Left = 675; Button_ShowIntervalResults->Width = 100; Button_ShowIntervalResults->Height = Button_ShowIntervalResults->Parent->Height - 2*8; Button_ShowIntervalResults->Caption = "Show intervals"; Button_ShowIntervalResults->Visible = isDebugMode; Button_ShowIntervalResults->OnClick = on_Click_Button_ShowIntervalResults; // ------- Variables ------- Chart = new CChart( Panel_Chart, CheckListBox_SeriesNames, Panel_CursorTimeValue, &isInterfaceInited); Chart->void_Parent_PanelDown = Panel_SelectInterval_SetDown; memset(CheckListBoxIndexesChecked, 0, sizeof(CheckListBoxIndexesChecked)); isPanel_SelectIntervalDown = false; isTableShow = true; isInterfaceInited = false; StorageValuesCount_Previous = 0; CheckBox_FullTimeScale->Enabled = true; ScrollBar_StringGrid->Enabled = false; //Button_ShowIntervalResults->Enabled = false; //SpeedButton_PointOnChart->Enabled = false; //Edit_PointOnChart->Enabled = false; //CheckBox_Decimation->Enabled = false; //CheckBox_AutoTracking->Enabled = false; //Panel_SelectInterval->Enabled = false; CheckBox_XCursor->Enabled = false; CheckBox_YCursor->Enabled = false; // ------ Update( ); }
//--------------------------------------------------------------------------- void __fastcall TMainForm::LeaveLink(TObject *Sender) { static_cast<TLabel*>(Sender)->Font->Style = TFontStyles(); }
//--------------------------------------------------------------------------- void __fastcall TMainForm::EnterLink(TObject *Sender) { static_cast<TLabel*>(Sender)->Font->Style = TFontStyles() << fsUnderline; }
void __fastcall TSpreadSheetRLForm::actApplyFormattingExecute(TObject *Sender) { TcxSSHeader *CHeader, *RHeader; TCursor CurCursor = Screen->Cursor; // preserve the current cursor Screen->Cursor = crHourGlass; // wait cursor FIsSaveSpreadSheet = false; cxSpreadBook->BeginUpdate(); try { cxSpreadBook->ActivePage = 0; // ensure we are looking at the first page // Firstly by setting the column widths CHeader = cxSpreadBook->ActiveSheet->Cols; CHeader->Size[0] = 140; for(int i = 1; i <= 8; i++) CHeader->Size[i] = 80; // and then the Row heights for the title and column descriptors RHeader = cxSpreadBook->ActiveSheet->Rows; RHeader->Size[0] = 30; RHeader->Size[2] = 30; // and how about some cell formatting // setting the title and column header fonts SetCellFont(0, 0, 0, 0, TFontStyles() << fsBold << fsUnderline, 12); // and now adding some cell shading // for the sheet title SetCellPattern(0, 0, 8, 1, 16, 1, fsSolid); // for the column headers SetCellPattern(0, 2, 8, 2, 23, 1, fsSolid); // and the company names SetCellPattern(0, 2, 0, FCurRow - 2, 23, 1, fsSolid); // and now some number formatting SetCellFormat(1,3,1,FCurRow-1, 3); // Holding Column #,##0 SetCellFormat(2,3,2,FCurRow-1,15); // Date Purchased d-mmm-yy SetCellFormat(3,3,6,FCurRow-1, 4); // Price/Cost/Value & Worth Column #,##0.00 SetCellFormat(7,3,7,FCurRow-1, 8); // Gain/(Loss) value (#,##0.00_);[Red](#,##0.00) SetCellFormat(8,3,8,FCurRow-1,10); // Gain/(Loss) percentage 0.00% // and now for the totals SetCellFormat(4,FCurRow,4,FCurRow, 8); // Total Purchase Cost ($#,##0.00_);[Red]($#,##0.00) SetCellFormat(6,FCurRow,7,FCurRow, 8); // Total Current Valuation ($#,##0.00_);[Red]($#,##0.00) SetCellFormat(8,FCurRow,8,FCurRow,10); // Total Gain/(Loss) percentage 0.00% // now lets align all the data SetCellAlignment(1,3,8,FCurRow, haRIGHT, vaCENTER); // Right Align all the numeric fields // and how about some borders for the totals SetCellBorders(4, FCurRow, 4, FCurRow, 1, lsThin); // thin single line at the top of the cell SetCellBorders(6, FCurRow, 6, FCurRow, 1, lsThin); SetCellBorders(7, FCurRow, 7, FCurRow, 1, lsThin); SetCellBorders(4, FCurRow, 4, FCurRow, 3, lsDouble); // double line at the bottom of the cell SetCellBorders(6, FCurRow, 6, FCurRow, 3, lsDouble); // double line at the bottom of the cell SetCellBorders(7, FCurRow, 7, FCurRow, 3, lsDouble); // double line at the bottom of the cell // and now a similar process for the Hi/Lo valuations page cxSpreadBook->ActivePage = 1; // ensure we are looking at the second page // Firstly by setting the column widths CHeader = cxSpreadBook->ActiveSheet->Cols; CHeader->Size[0] = 140; for(int i = 1; i<=4; i++) CHeader->Size[i] = 80; // and then the Row heights for the title and column descriptors RHeader = cxSpreadBook->ActiveSheet->Rows; RHeader->Size[0] = 30; RHeader->Size[2] = 30; // and how about some cell formatting // setting the title and column header fonts SetCellFont(0, 0, 0, 0, TFontStyles() << fsBold << fsUnderline, 12); // and now adding some cell shading // for the sheet title SetCellPattern(0, 0, 4, 1, 16, 1, fsSolid); // for the column headers SetCellPattern(0, 2, 4, 2, 23, 1, fsSolid); // and the company names SetCellPattern(0, 2, 0, FCurRow - 2, 23, 1, fsSolid); // and now some number formatting SetCellFormat(1, 3, 4, FCurRow - 1, 4); // Current, Hi, Lo and Average #,##0.00 // now lets align all the data SetCellAlignment(1, 3, 4, FCurRow, haRIGHT, vaCENTER); // Right Align all the numeric fields FIsSaveSpreadSheet = true; // enable the save spreadsheet button } __finally { cxSpreadBook->ActivePage = 0; // and back to the first page cxSpreadBook->EndUpdate(); Screen->Cursor = CurCursor; // and reset cursor } }