Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Gráficos
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #12  
Antiguo 07-10-2008
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Poder: 22
cHackAll Va por buen camino
Código Delphi [-]
unit Unit1; // Ejemplo de buffer doble programada, no interesa el valor de la propiedad...
 
interface
 
uses Windows, Classes, Graphics, Controls, Forms, ExtCtrls;
 
type
 TForm1 = class(TForm)
  Timer: TTimer;
  procedure FormCreate(Sender: TObject);
  procedure FormPaint(Sender: TObject);
  procedure TimerTimer(Sender: TObject);
  procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  procedure FormDestroy(Sender: TObject);
 end;
 
var Form1: TForm1;
 
implementation
 
{$r *.dfm}
 
var
 Bitmap: TBitmap;
 Value: Integer;
 Flag: Boolean;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
 Bitmap := TBitmap.Create;
 Bitmap.Width := ClientWidth;
 Bitmap.Height := ClientHeight;
 Bitmap.Canvas.Pen.Color := clRed;
 Timer.Interval := 20;
end;
 
procedure TForm1.FormPaint(Sender: TObject);
begin
 BitBlt(Canvas.Handle, 0, 0, ClientWidth, ClientHeight, Bitmap.Canvas.Handle, 0, 0, SRCCOPY); // Double buffered !
end;
 
procedure TForm1.TimerTimer(Sender: TObject);
begin
 if not Flag then
  if Value = 120 then
   Flag := not Flag
  else
   Inc(Value, 6)
 else
  if Value = 0 then
   Flag := not Flag
  else
   Dec(Value, 6);
 FormMouseMove(nil, [], 0, 0);
end;
 
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
 Point: TPoint;
 Size: Integer;
begin
 with Bitmap.Canvas do
  begin
   Lock;
 
   Size := Value - 100;
   GetCursorPos(Point);
   if Size < 0 then Size := 0;
   Y := Point.Y - Top - (66 * 2) + (Value - Size);
   X := Point.X - Left;
 
   Brush.Color := clBlack;
   FillRect(ClientRect);
   Pen.Color := clRed;
   Brush.Color := Pen.Color;
   Ellipse(X - 66, Y - (66 * 2) + Size, X + 66, Y);
   Y := Point.Y - ClientOrigin.Y;
   Pen.Color := 150 + Size * 5;
   Rectangle(X - 66, Y, X + 66, Y + 2);

   FormPaint(nil);
   Unlock;
  end;
end;
 
procedure TForm1.FormDestroy(Sender: TObject);
begin
 Bitmap.Destroy;
end;
 
end.
__________________
RTFM > STFW > Foro > Truco > Post > cHackAll > KeBugCheckEx
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Dibujando líneas en Canvas JAV Gráficos 1 27-09-2007 15:56:05
Dibujando en un TListView pepon386 Gráficos 1 20-01-2006 09:36:28
Dibujando en capas blueicaro Gráficos 1 26-04-2005 09:46:02
Canvas does not allow drawing MADV01 Impresión 1 02-04-2004 15:08:43
Canvas???? craven Gráficos 2 17-05-2003 13:26:02


La franja horaria es GMT +2. Ahora son las 14:25:42.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi