Ver Mensaje Individual
  #6  
Antiguo 17-02-2014
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola NEG1414.

Quien dice 30 dice 31... , yo me refería a implementar algo parecido a esto:
Código:
...
class PACKAGE MiControl : public TCustomControl
{
private:
  Graphics::TBitmap *FArea;
  TControlCanvas *FCtrlCanvas;
  //...
public:
   __fastcall MiControl(TComponent *Owner) : TCustomControl(Owner)
   {
      FArea = new Graphics::TBitmap;
      FCtrlCanvas = new TControlCanvas;
      FCtrlCanvas->Control = this;
   };
   __fastcall ~MiControl()
   {
      delete FArea;
      delete FCtrlCanvas;
   }
   void __fastcall LoadArea(void)
   {
      FArea->Width  = Left + Width;
      FArea->Height = Top + Height;
      TRect R = Rect(0, 0, FArea->Width, FArea->Height);
      FArea->Canvas->CopyRect(R, Canvas, R);
    };
   __property TControlCanvas *Canvas = { read = FCtrlCanvas, write = FCtrlCanvas};
   __property Graphics::TBitmap *Area = { read = FArea, write = FArea };
};

MiControl *mc;

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  mc = new MiControl(this);
}

// Crear y mostrar
void __fastcall TForm1::btnCreateClick(TObject *Sender)
{
  mc->Left   = 0;
  mc->Top    = 0;
  mc->Width  = 250;
  mc->Height = 300;
  mc->Parent = this;
  // Dibujar algo
  mc->Canvas->Ellipse(0,0,mc->Width-10,mc->Height-40);
  // Guardar área
  mc->LoadArea();
}
// borrar área
void __fastcall TForm1::btnClearClick(TObject *Sender)
{
  mc->Canvas->Brush->Color = Color;
  mc->Canvas->FillRect(Rect(0,0,mc->Width,mc->Height));
}

// Restaurar área
void __fastcall TForm1::btnRestoreClick(TObject *Sender)
{
  mc->Canvas->Draw(0,0,mc->Area);
}

void __fastcall TForm1::FormDestroy(TObject *Sender)
{
  delete mc;
}
Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita