![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Buscar | Temas de Hoy | Marcar Foros Como Leídos |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
#20
|
|||
|
|||
|
Hola, si, te has explicado muy bien, pero sigue sin salirme, llego a dibujar el rectángulo, pero no consigo moverlo ni cambiarlo de tamaño, ni hacer nada con él. Te pongo el código de lo que llevo, a ver si le vemos algo, le puse la variable bool seleccionar como me indicaste:
//defino la variable como global bool seleccionar; void __fastcall TForm1::ToolButton5Click(TObject *Sender) //seleccionar //un trozo d imagen { seleccionar=true; TRect SelectRect(100,100,200,200); Imagen->Canvas->Brush->Style=bsClear; Imagen->Canvas->Pen->Style=psDot; Imagen->Canvas->Rectangle(SelectRect); } void InvalidateFrameRect(TControl *Control, TCanvas *Canvas, TRect Rect) { if(seleccionar){ InvalidateRect(Canvas->Handle, &Rect, true); Control->Perform(WM_PAINT, (int)Canvas->Handle, 0); } } //---------------------------------------------------------------------------- void __fastcall TForm1::FormMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if(seleccionar){ AccionPoint = TPoint(X+Imagen->Left,Y+Imagen->Top); } } //--------------------------------------------------------------------------- void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if(seleccionar){ if(AccionPoint.x!=-1 && AccionPoint.y!= -1 && Imagen->Picture->Graphic) { InvalidateFrameRect(this, Canvas, SelectRect); if(X<0) X=0; if(X>Imagen->Width) X = Imagen->Width; if(Y<0) Y=0; if(Y>Imagen->Height) Y = Imagen->Height; X += Imagen->Left; Y += Imagen->Top; SelectRect = TRect(AccionPoint.x, AccionPoint.y, X, Y); SelectRect = TRect(min(SelectRect.Left, SelectRect.Right), min(SelectRect.Top, SelectRect.Bottom), max(SelectRect.Left, SelectRect.Right), max(SelectRect.Top, SelectRect.Bottom)); Canvas->Rectangle(SelectRect); } } } //------------------------------------------------------------------------------------------------ void __fastcall TForm1::FormMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if(seleccionar){ AccionPoint = TPoint(-1,-1); } } He probado escribiendo algún que otro ShowMessage... y no se mete en ninguno de los métodos del ratón.... ¿qué es lo q me falta? saludos. |
| Herramientas | Buscar en Tema |
| Desplegado | |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| Selección en Excel | Jordy | Servers | 1 | 06-12-2005 08:55:00 |
| Selección de figuras | Luli | Gráficos | 8 | 01-12-2004 11:08:49 |
| seleccion dbgrid | davidgaldo | Conexión con bases de datos | 3 | 26-02-2004 09:45:33 |
| Seleccion en DBLookUpComboBox | NuncaMas | Varios | 1 | 22-12-2003 18:41:21 |
| una seleccion | YolandaM | Impresión | 2 | 04-10-2003 20:11:59 |
|