Mega Code Archive

 
Categories / Delphi / Graphic
 

Bmp resminin panoya yapıştırılmsı ve panodan kopyalaması

Codec By GeNiUS ! genius@turkiye.com Pano kullanımının bir başka örneğinin uygulandığı, kod örneğinde, BMP formatındaki bir resmin, panoya kopyalanması ve panodan alınması gösterilmektedir. Unit1.pas unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, clipbrd; type TForm1 = class(TForm) BaseKeyPanel: TPanel; Image2: TImage; Button1: TButton; Image1: TImage; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); Var BitMap : TBitmap; begin BitMap:=TBitMap.Create; BitMap.Height:=BaseKeyPanel.Height; BitMap.Width:=BaseKeyPanel.Width; BitBlt(BitMap.Canvas.Handle, 0 {Left}, 0{Top}, BaseKeyPanel.Width, image1.Height, GetDC(BaseKeyPanel.Handle), 0, 0, SRCCOPY); Clipboard.Assign(BitMap); bitmap.free; End; procedure TForm1.Button2Click(Sender: TObject); Var BitMap : TBitmap; begin BitMap:=TBitMap.Create; bitmap.assign(clipboard); Image2.Canvas.Draw(0, 0, Bitmap); bitmap.free; end; end. Form1.dfm object Form1: TForm1 Left = 200 Top = 111 Width = 554 Height = 316 Caption = 'Form1' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'MS Sans Serif' Font.Style = [] PixelsPerInch = 120 TextHeight = 16 object Image2: TImage Left = 184 Top = 64 Width = 105 Height = 105 end object BaseKeyPanel: TPanel Left = 48 Top = 80 Width = 105 Height = 81 Caption = 'BaseKeyPanel' TabOrder = 0 object Image1: TImage Left = 1 Top = 1 Width = 103 Height = 79 Align = alClient end end object Button1: TButton Left = 48 Top = 32 Width = 75 Height = 25 Caption = 'Button1' TabOrder = 1 OnClick = Button1Click end object Button2: TButton Left = 192 Top = 32 Width = 75 Height = 25 Caption = 'Button2' TabOrder = 2 OnClick = Button2Click end end