示例#1
0
/*
 =======================================================================================================================
 =======================================================================================================================
 */
void __fastcall TFormR::ImprimirVClick(TObject *Sender)
{
	/*~~~~~~~~~~~~~~~~~~~~~~~*/
	TPrinter	*I = Printer();
	/*~~~~~~~~~~~~~~~~~~~~~~~*/

	Graphics::TBitmap * bmp = new Graphics::TBitmap();
	bmp = FormR->Image1->Picture->Bitmap;

	// Impresion en vertical.
	I->Orientation = poPortrait;
	bmp->Width = tamanioCircuito.x;
	bmp->Height = tamanioCircuito.y;

	/*~~~~~~~*/
	TRect	rc;
	/*~~~~~~~*/

	rc.Left = 0;
	rc.Top = 0;

	/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
	double	proporcionI = (double) ((double) I->PageHeight / (double) I->PageWidth);
	double	factor = 2.3;
	/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

	rc.Right = (int) ((double) bmp->Width * (double) proporcionI * factor);
	rc.Bottom = (int) ((double) bmp->Height * (double) proporcionI * factor);

	/*~~~~~~~~~~~~~~~~~~~~*/
	bool	imprimir = true;
	/*~~~~~~~~~~~~~~~~~~~~*/

	if(rc.Right >= I->PageWidth || rc.Bottom >= I->PageHeight)
	{
		/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
		AnsiString	m = ANSIMENSAJE(msgVisuCircuitoErrorImprimir);
		/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

		if(MessageDlg(m, mtError, TMsgDlgButtons() << mbYes << mbNo, 0) == mrYes)
		{
			while(rc.Right >= I->PageWidth || rc.Bottom >= I->PageHeight)
			{
				factor -= 0.1;
				rc.Right = (int) ((double) bmp->Width * (double) proporcionI * factor);
				rc.Bottom = (int) ((double) bmp->Height * (double) proporcionI * factor);
			}	// end-while
			imprimir = true;
		}
		else
			imprimir = false;
	}			// end-if

	if(imprimir == true)
	{
		I->BeginDoc();
		I->Canvas->StretchDraw(rc, bmp);
		I->EndDoc();
	}			// end-if
}
示例#2
0
文件: Unit6.cpp 项目: droupou/Test
                lbl->Top = hgh;
                lft = lft + lbl->Width;

                count += 9;
                hgh += 15;
                i++;
            }

        }
        else{
            clabel = clabel->next;
        }
    }
    this->Frame71->Label212->Width = 225;
    lft = CB->Width + 10;
    lft = lft + this->Frame71->Label212->Width;
    this->Frame71->Label213->Width = 125;
    this->Frame71->Label213->Left = lft;
    lft = lft + this->Frame71->Label212->Width;
    lft = lft + this->Frame71->Label213->Width;

    if (this->clabel == NULL){
        this->Next_btn->Enabled = false;
    }
    update = true;
    /*  */
}

//---------------------------------------------------------------------------
void __fastcall TOutputFrm::Print_btnClick(TObject *Sender){
    if(Sender == NULL)
        return;
    
    TPrinter *prntr = Printer();
    TRect rect = Rect(10, 10, prntr->PageWidth - 10, prntr->PageHeight - 10);
    int CPH, RPH, C, R;
    label *lblptr;

    lblptr = HEAD;
    C = 615;
    R = 145;

    Application->CreateForm(__classid(TPrintview_frm), &Printview_frm);
    Printview_frm->Show();
    Printview_frm->Width = 315;
    Printview_frm->Height = 157;

    Printview_frm->Frame131->Height = 157;
    Printview_frm->Frame131->Width = 315;

    prntr->BeginDoc();
    prntr->Canvas->FillRect(rect);
    prntr->Canvas->Brush->Color = clBlack;
    RPH = 130;

    while(RPH <= (200 * 20)){
        CPH = 60;

        while((lblptr != NULL) && (!lblptr->Is_select))
            lblptr = lblptr->next;

        if(lblptr != NULL){
            // Row
            Printview_frm->Frame131->Label1->Caption = lblptr->header;
            Printview_frm->Frame131->Label2->Caption = lblptr->Artist;
            Printview_frm->Frame131->Label3->Caption = lblptr->title;
            Printview_frm->Frame131->Label4->Caption = lblptr->PDate;
            Printview_frm->PaintTo(prntr->Handle, CPH, RPH);
            CPH += C;
示例#3
0
/*
 =======================================================================================================================
 =======================================================================================================================
 */
void __fastcall TFormI::AceptarClick(TObject *Sender)
{
	FormI->Aceptar->Enabled = false;

	Graphics::TBitmap * bmp = new Graphics::TBitmap();
	bmp = FormR->Image1->Picture->Bitmap;
	bmp->Width = FormR->tamanioCircuito.x;
	bmp->Height = FormR->tamanioCircuito.y;

	/*~~~~~~~*/
	TRect	rc;
	/*~~~~~~~*/

	rc.Left = 0;
	rc.Top = 0;

	if(FormI->Orientacion->ItemIndex == 0)
	{
		/*~~~~~~~~~~~~~~~~~~~~~~~*/
		TPrinter	*I = Printer();
		/*~~~~~~~~~~~~~~~~~~~~~~~*/

		Graphics::TBitmap * bmp = new Graphics::TBitmap();
		bmp = FormR->Image1->Picture->Bitmap;

		// Impresion en vertical.
		I->Orientation = poPortrait;
		bmp->Width = FormR->tamanioCircuito.x;
		bmp->Height = FormR->tamanioCircuito.y;

		/*~~~~~~~*/
		TRect	rc;
		/*~~~~~~~*/

		rc.Left = 0;
		rc.Top = 0;

		/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
		double	proporcionI = (double) ((double) I->PageHeight / (double) I->PageWidth);
		double	factor = 2.3;
		/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

		if(FormI->Tamanio->ItemIndex == 0)
		{
			rc.Right = (int) ((double) bmp->Width * (double) proporcionI * factor);
			rc.Bottom = (int) ((double) bmp->Height * (double) proporcionI * factor);
		}
		else
		{			// maximizado
			factor = 1.0;
			rc.Right = (int) ((double) bmp->Width * (double) proporcionI * factor);
			rc.Bottom = (int) ((double) bmp->Height * (double) proporcionI * factor);
			while(rc.Right < I->PageWidth - 100 && rc.Bottom < I->PageHeight - 100)
			{
				factor += 0.05;
				rc.Right = (int) ((double) bmp->Width * (double) proporcionI * factor);
				rc.Bottom = (int) ((double) bmp->Height * (double) proporcionI * factor);
			}		// end-while
		}

		/*~~~~~~~~~~~~~~~~~~~~*/
		bool	imprimir = true;
		/*~~~~~~~~~~~~~~~~~~~~*/

		if(rc.Right >= I->PageWidth || rc.Bottom >= I->PageHeight)
		{
			/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
			AnsiString	m = "Ha habido un problema con la impresora, posiblemente se deba a que:\n\n     1. el tamaño del circuito es mayor que el papel.\n     2. existen trabajos en la cola de impresora.\n\nSolución:\n\n     1. reiniciar el ordenador para eliminar los trabajos de la cola. \n     2. intentar imprimirlo con otras opciones.\n     3. copiar el circuito al portapapeles y editarlo desde otra aplicación.\n     4. imprimir un circuito más pequeño que el de la pantalla. \n\n ¿Imprimir un circuito más pequeño?";
			/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

			if(MessageDlg(m, mtError, TMsgDlgButtons() << mbYes << mbNo, 0) == mrYes)
			{
				while(rc.Right >= I->PageWidth || rc.Bottom >= I->PageHeight)
				{
					factor -= 0.1;
					rc.Right = (int) ((double) bmp->Width * (double) proporcionI * factor);
					rc.Bottom = (int) ((double) bmp->Height * (double) proporcionI * factor);
				}	// end-while
				imprimir = true;
			}
			else
				imprimir = false;
		}			// end-if

		if(imprimir == true)
		{
			FormI->Caption = "Imprimiendo...";
			I->BeginDoc();
			I->Canvas->StretchDraw(rc, bmp);

			// int pos=I->PageHeight;
			if(FormR->tipoCircuito == false)
				// Form9->Solucion->Items->Strings[i]
				I->Canvas->TextOut(100, 30, FormR->ecuacion->Text);
			else
			{
				/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
				int solucionNum = FormR->solucionNum;
				int nLineas = FormR->Lista->Items->Count + 1;
				int altura = I->Canvas->TextHeight("XXX");
				int pos = I->PageHeight - altura * nLineas;
				/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

				I->Canvas->TextOut(100, pos, FormR->ListaSol->Items->Strings[solucionNum]);
				for(int i = 0; i < nLineas - 1; i++)
				{
					pos = pos + altura;
					I->Canvas->TextOut(100, pos, FormR->Lista->Items->Strings[i]);
				}
			}

			I->EndDoc();
			ProgressBar1->Min = 0;
			ProgressBar1->Max = 200;
			for(int i = ProgressBar1->Min; i <= ProgressBar1->Max; i++) ProgressBar1->Position = i;
			if(Impresora->Printing == false) FormI->Close();
		}			// end-if
	}				// end-if Orientacion.
	else
	{
		/*~~~~~~~~~~~~~~~~~~~~~~~*/
		// SE IMPRIME EN HORIZONTAL.
		TPrinter	*I = Printer();
		/*~~~~~~~~~~~~~~~~~~~~~~~*/

		Graphics::TBitmap * bmp = new Graphics::TBitmap();
		bmp = FormR->Image1->Picture->Bitmap;

		// Impresion en vertical.
		I->Orientation = poLandscape;
		bmp->Width = FormR->tamanioCircuito.x;
		bmp->Height = FormR->tamanioCircuito.y;

		/*~~~~~~~*/
		TRect	rc;
		/*~~~~~~~*/

		rc.Left = 0;
		rc.Top = 0;

		/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
		double	proporcionI = (double) ((double) I->PageWidth / (double) I->PageHeight);
		double	factor = 2.3;
		/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

		if(FormI->Tamanio->ItemIndex == 0)
		{
			rc.Right = (int) ((double) bmp->Width * (double) proporcionI * factor);
			rc.Bottom = (int) ((double) bmp->Height * (double) proporcionI * factor);
		}
		else
		{			// maximizado
			factor = 1.0;
			rc.Right = (int) ((double) bmp->Width * (double) proporcionI * factor);
			rc.Bottom = (int) ((double) bmp->Height * (double) proporcionI * factor);
			while(rc.Right < I->PageWidth - 40 && rc.Bottom < I->PageHeight - 40)
			{
				factor += 0.05;
				rc.Right = (int) ((double) bmp->Width * (double) proporcionI * factor);
				rc.Bottom = (int) ((double) bmp->Height * (double) proporcionI * factor);
			}		// end-while
		}

		/*~~~~~~~~~~~~~~~~~~~~*/
		bool	imprimir = true;
		/*~~~~~~~~~~~~~~~~~~~~*/

		if(rc.Right >= I->PageWidth || rc.Bottom >= I->PageHeight)
		{
			/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
			AnsiString	m = "Ha habido un problema con la impresora, posiblemente se deba a que:\n\n     1. el tamaño del circuito es mayor que el papel.\n     2. existen trabajos en la cola de impresora.\n\nSolución:\n\n     1. reiniciar el ordenador para eliminar los trabajos de la cola. \n     2. intentar imprimirlo con otras opciones.\n     3. copiar el circuito al portapapeles y editarlo desde otra aplicación.\n     4. imprimir un circuito más pequeño que el de la pantalla. \n\n ¿Imprimir un circuito más pequeño?";
			/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

			if(MessageDlg(m, mtError, TMsgDlgButtons() << mbYes << mbNo, 0) == mrYes)
			{
				while(rc.Right >= I->PageWidth || rc.Bottom >= I->PageHeight)
				{
					factor -= 0.1;
					rc.Right = (int) ((double) bmp->Width * (double) proporcionI * factor);
					rc.Bottom = (int) ((double) bmp->Height * (double) proporcionI * factor);
				}	// en-while
				imprimir = true;
			}
			else
				imprimir = false;
		}			// end-if

		if(imprimir == true)
		{
			FormI->Caption = "Imprimiendo...";
			I->BeginDoc();
			I->Canvas->StretchDraw(rc, bmp);
			I->EndDoc();
			ProgressBar1->Min = 0;
			ProgressBar1->Max = 100;

			for(int i = ProgressBar1->Min; i <= ProgressBar1->Max; i++)
			{
				if(i >= 20) FormI->Cancelar->Enabled == false;
				ProgressBar1->Position = i;
			}

			if(Impresora->Printing == false) FormI->Close();
		}			// end-if
	}				// end-else.

	FormI->Cancelar->Enabled == true;
	FormI->Aceptar->Enabled = true;
}