Club Builder - Foros de discusión Club Builder
Foro de C++Builder en español
 
 FAQFAQ   BuscarBuscar   MiembrosMiembros   Grupos de UsuariosGrupos de Usuarios   RegistrarseRegistrarse 
 PerfilPerfil   Entra para ver tus mensajes privadosEntra para ver tus mensajes privados   EntrarEntrar 

como actualizar el Canvas de la impresora

 
Publicar nuevo tema   Responder al tema    Foros de discusión -> Consultas
Ver tema anterior :: Ver tema siguiente  
Autor Mensaje
Mensaje    Asunto: como actualizar el Canvas de la impresora Responder citando

Cuando quiero saber el ancho del texto inicialmente no tengo problemas
EJEMPLO: Printer()->Canvas->TextWidth("abcdefg");
hasta aqui todo bien.
Pero cuando cambio de impresora no se actualiza y el ejemplo de arriba falla y da una medida equivocada.
La forma en que si sale bien es con:
Printer()->BeginDoc;
Printer()->EndDoc;
pero este procedimiento hace que la impresora funcione y tome una hoja.
Yo deseo actualizar la impresora sin que esta tome la hoja ni se encienda.
Volver arriba
Ver perfil de usuario Enviar mensaje privado
Mensaje    Asunto: Responder citando

Haber lo que te entendi es limpiar el canvas de la impresora para una nueva impresion ???, eso ??

Si es asi esto deberia funcionar:

Código:

 Printer()->Refresh();


Espero que sea eso. Saludos!
_________________
"Ser inteligente no es ser mas, solo equivocarse menos y no usar Visual Basic"
Atte.
Victor Yañez

Apoyen el Proyecto OpenSource del Club Builder. Ya tenemos componentes Listos!!!
Volver arriba
Ver perfil de usuario Enviar mensaje privado Enviar email Yahoo Messenger MSN Messenger
Mensaje    Asunto: Responder citando

Gracias por tu interes pero ya lo probe y no funciona. Y no me refiero a limpiar sino a cambiar de impresora. Para entender mejor supongamos que estoy correctamente conectado a dos impresoras una Epson y una Hp. Cuando el software se inicia con la Empson, esta funciona correctamente, pero al cambiar a la HP Printer()->Canvas->TextWidth("abcdefg") da un resultado equivocado. Ahora cuando el software se inicia con la HP esta funciona y la Epson falla. En sintesis cambio segundo falla y Refresh() no funciona.
Volver arriba
Mensaje    Asunto: Responder citando

Aparte del Métod Refresh() mencionado arriba, intenta establecer la impresora con la que vas a trabajar, esto esta en la ayuda de builder
Código:

Specifies the current printer.

void __fastcall SetPrinter(char * ADevice, char * ADriver, char * APort, int ADeviceMode);

Description

Call SetPrinter to change the current printer.

ADevice specifies the device name of the new printer. This is the name that appears in the Print Manager (for example, "Epson FX-80"). It is not the printer model name.

ADriver specifies the driver name for the new printer (usually ‘WINSPOOL’).

APort is included for backward compatibility. It should be set to an empty string.

DeviceMode is the handle to a memory buffer containing a DEVMODE structure, which contains device-specific initialization data for the device driver. This handle can be obtained by calling the GlobalAlloc function to allocate the structure.

que puede servite cuando cambies la impresora, de una a otra. es decir , cada vez que cambies tu impresora con SetPrinter, Activa el Refres(), para activar las fuentes y tamaños de la nueva impresora... pruebalo
ejemplo

Código:



And the C++Builder code..

//---------------------------------------------------------------------------

void __fastcall TfrmTPrint::btnSwitchPrinterClick(TObject *Sender)

{

TPrinter* newPrinter;

TPrinter* oldPrinter;

Graphics::TBitmap* bmInput;

// Assign new printer object separate from default Printer() function

newPrinter = new TPrinter;

newPrinter->Copies = 1;

newPrinter->Orientation = poLandscape;

// Load some graphics for our output

bmInput = new Graphics::TBitmap;

bmInput->LoadFromFile("C:\\INPRISE.BMP");

// Output the first report

Printer()->Copies = 2;

Printer()->Orientation = poLandscape;

Printer()->BeginDoc();

Printer()->Canvas->Draw(200, 0, bmInput);

Printer()->Canvas->TextOut(0, 500, "This report brought to you by C++Builder 4!");

Printer()->EndDoc();

// Switch to fax printer object, saving original printer object to oldPrinter

oldPrinter = SetPrinter(newPrinter);

Printer()->PrinterIndex = Printer()->Printers->IndexOf("Print to Fax on PRINTFAX:");

Printer()->BeginDoc();

Printer()->Canvas->TextOut(0, 150, "REPORT GIVEN TO CUSTOMER "+DateTimeToStr(Now()));

Printer()->EndDoc();

// Ficticious code here to call fax program to fax the file

// ...

// if (FaxWasSentSuccessfully) then

{

// Switch back to original printer object

SetPrinter(oldPrinter);

Printer()->BeginDoc();

Printer()->Canvas->TextOut(0, 150, "FAX CONFIRMATION REPORT");

// More code here to print results of our fictitious fax

// ....

// original configuration is still set to print two confirmations.

Printer()->EndDoc();

} // ~if (FaxWasSentSucessfully)

// Here we free the newPrinter object

// If we had not used SetPrinter to switch back to oldPrinter, we

// would free the oldPrinter object

newPrinter->Free();

bmInput->Free();

MessageBox(NULL,"Printed two reports, faxed report, and printed fax confirmation.",

"Printing Completed", MB_OK);

este ejemplo lo encontre en la siguiente direccion
http://www.interface.ru/fset.asp?Url=/borland/deicborl.htm


saludos y espero haberte ayudado...
_________________
Cool
Volver arriba
Ver perfil de usuario Enviar mensaje privado Enviar email MSN Messenger
Mensaje    Asunto: Responder citando

¿Has probado con: Printer()->PrinterIndex?
Volver arriba
Ver perfil de usuario Enviar mensaje privado
Mensaje    Asunto: Responder citando

lo provaré. gracias por su interes
Volver arriba
Mostrar mensajes de anteriores:   
Cambiar a:  
No puedes publicar temas nuevos en este foro
No puedes responder a temas en este foro
No puedes editar tus mensajes en este foro
No puedes borrar tus mensajes en este foro
No puedes votar en las encuestas de este foro


Hosting WordPress Indedmedia desde 3,99 €
© 2002–2026 Club Builder · Funciona con phpBB.