PDA

View Full Version : دستور PaintTo چیکار میکنه؟



iman-63
جمعه 16 مرداد 1388, 17:45 عصر
سلام.
کسی میدونه این دستور چیکار میکنه؟
PaintTo(GetDc(a.Handle),0,0);q

حمیدرضاصادقیان
جمعه 16 مرداد 1388, 20:11 عصر
Draws the windowed control to a device context.


Pascal
procedure PaintTo(DC: HDC; X: Integer; Y: Integer); overload;procedure PaintTo(Canvas: TCanvas; X: Integer; Y: Integer); overload;

C++
__fastcall PaintTo(HDC DC, int X, int Y);__fastcall PaintTo(TCanvas Canvas, int X, int Y);

http://www.barnamenevis.org/forum/ms-help://embarcadero.rs2009/delphivclwin32/btn_collapse_large.gifDescription
Call PaintTo to draw the control on a device context. Specify the device context as the value of the DC parameter and specify the X and Y coordinates on the device context where the top-left corner of the windowed control is to be drawn. PaintTo first erases the background of the device context and then paints the control.

PaintTo is useful for drawing an image of the control into a bitmap DC. Warning: When using PaintTo to draw on a canvas, you must lock the canvas first (and unlock it after the call to PaintTo. If you do not lock the canvas, Windows calls that occur while the control is painting can cause the canvas to lose its handle.
Delphi Examples:
{This example uses a button, a Page Control, and a Print dialog box on a form. When the user clicks the button, theprint dialog is displayed. The user can select any subset of the pages in the page control for printing. The selectedpages are then printed. To run this example successfully, you must add the Printers unit to the uses clause of your unit. Right click on the PageControl to add at least one page to the PageControl.}procedure TForm1.Button1Click(Sender:TObject);var I, Start, Stop: Integer;beginPrintDialog1.Options := [poPageNums, poSelection];PrintDialog1.FromPage := 1;PrintDialog1.MinPage := 1;PrintDialog1.ToPage := PageControl1.PageCount;PrintDialog1.MaxPage := PageControl1.PageCount;if PrintDialog1.Execute() then begin { determine the range the user wants to print } with PrintDialog1 do begin if PrintRange = prAllPages then begin Start := MinPage - 1; Stop := MaxPage - 1; end else if PrintRange = prSelection then begin Start := PageControl1.ActivePage.PageIndex; Stop := Start; end else { PrintRange = prPageNums } begin Start := FromPage - 1; Stop := ToPage - 1; end; end; { now, print the pages } with Printer do begin BeginDoc; for I := Start to Stop do begin PageControl1.Pages[I].PaintTo(Handle (http://www.barnamenevis.org/forum/ms-help://embarcadero.rs2009/delphivclwin32/Controls_TWinControl_Handle.html), 10, 10); if I <> Stop then NewPage; end; EndDoc; end; end;end;

iman-63
جمعه 16 مرداد 1388, 21:10 عصر
این که help دلفی هست!!!
من به زبون خودمون می خوام

حمیدرضاصادقیان
جمعه 16 مرداد 1388, 21:37 عصر
دوست عزیز من مثالش هم فرستادم.شما اجرا کن ببین چه اتفاقی میافته.