Ver Mensaje Individual
  #8  
Antiguo 20-10-2015
Avatar de aguml
aguml aguml is offline
Miembro
 
Registrado: may 2013
Posts: 885
Reputación: 14
aguml Va por buen camino
He intentado editar el mensaje anterior pero he llegado tarde por muy poquito y ya no me dejaba asi que lo pongo aqui. Ya he conseguido hacerlo. Al final coji papel y lapiz y lo plantee sobre el papel y me di cuenta de los fallos y asi quedó:
En el .h:
Código PHP:
private:    // User declarations
   //Necesarias para arrastrar la imagen por el ScrollBox
   
void __fastcall CatchDrag(TMessage &Msg);
protected:
  
BEGIN_MESSAGE_MAP
  VCL_MESSAGE_HANDLER
(WM_MOVINGTMessageCatchDrag);
  
END_MESSAGE_MAP(TForm
En el .cpp:
Código PHP:
void __fastcall TFormHijo::CatchDrag(TMessage &Msg)
{
   
TForm::Dispatch(&Msg);
   if(
Msg.Msg == WM_MOVING){
      
PRECT pCurrentRec PRECT(Msg.LParam);

      
//El 5 creo que es por los bordes de la ventana padre
      
if(pCurrentRec->left FormPadre->Left 5){
         
pCurrentRec->left FormPadre->Left 5;
         
pCurrentRec->right FormPadre->Left Width 5;
      }else if(
pCurrentRec->right FormPadre->Left FormPadre->Width 5){
         
pCurrentRec->left FormPadre->Left FormPadre->Width Width 5;
         
pCurrentRec->right FormPadre->Left FormPadre->Width 5;
      }
      
//Tengo un Panel alineado arriba y el 32 creo que es porque es lo que mide
      //barra de titulo de la ventana padre
      
if(pCurrentRec->top FormPadre->Top FormPadre->Panel->Height 32){
         
pCurrentRec->top FormPadre->Top FormPadre->Panel->Height 32;
         
pCurrentRec->bottom FormPadre->Top FormPadre->Panel->Height Height 32;
      }else if(
pCurrentRec->bottom FormPadre->Top FormPadre->Height 5){
         
pCurrentRec->top FormPadre->Top FormPadre->Height Height 5;
         
pCurrentRec->bottom FormPadre->Top FormPadre->Height 5;
      }
      
Caption "LeftBeforeMove: " IntToStr(pCurrentRec->left) +
                
"  TopBeforeMove: " IntToStr(pCurrentRec->top);
   }

La verdad es que ahora me gustaria meterme con el codigo que hiciste en delphi que con el uso de las MDI lo veo poco util pero muy interesante y me ha picado el gusanillo y quiero pasarlo a C++Builder para entender su funcionamiento. Muchas gracias por todo.
Responder Con Cita