我程序编释后的EXE文件,即用户使用的程序如何来移动、缩放控件与图片?使用户得到开发者相同的界面设计权限?

解决方案 »

  1.   

    //拖动
    procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    const SC_DragMove=$f012;
    begin
    ReleaseCapture;
    button1.perform(WM_SysCommand, SC_DragMove, 0); // this is the key !
    end;
      

  2.   

    下面是一个网友贴的:
    procedure TForm1.ManipulateControl(WinControl: TWinControl;
      Shift: TShiftState; X, Y, Precision: integer);
    var  SC_MANIPULATE: Word;
    begin
      //光标在控件的最左侧
      if (X <= Precision) and (Y > Precision) and (Y < WinControl.Height - Precision)then
      begin
        SC_MANIPULATE := $F001;
        WinControl.Cursor := crSizeWE;
      end
       //光标在控件的最右侧
      else if (X >= WinControl.Width - Precision) and (Y > Precision) and (Y < WinControl.Height - Precision) then
      begin
        SC_MANIPULATE := $F002;
        WinControl.Cursor := crSizeWE;
      end
       //光标在控件的最上侧
      else if (X > Precision) and (X < WinControl.Width - Precision) and (Y <= Precision) then
      begin
        SC_MANIPULATE := $F003;
        WinControl.Cursor := crSizeNS;
      end
      //光标在控件的左上角
      else if (X <= Precision) and (Y <= Precision) then
      begin
        SC_MANIPULATE := $F004;
        WinControl.Cursor := crSizeNWSE;
      end
      //光标在控件的右上角
      else if (X >= WinControl.Width-Precision) and (Y <= Precision) then
      begin
        SC_MANIPULATE := $F005;
        WinControl.Cursor := crSizeNESW  ;
      end
      //光标在控件的最下侧
      else if (X > Precision) and (X < WinControl.Width - Precision) and (Y >= WinControl.Height - Precision) then
      begin
        SC_MANIPULATE := $F006;
        WinControl.Cursor := crSizeNS;
      end
      //光标在控件的左下角
      else if (X <= Precision) and (Y >= WinControl.Height - Precision) then
      begin
        SC_MANIPULATE := $F007;
        WinControl.Cursor := crSizeNESW;
      end
      //光标在控件的右下角
      else if (X >= WinControl.Width - Precision)  and  (Y >= WinControl.Height - Precision) then
      begin
        SC_MANIPULATE := $F008;
        WinControl.Cursor := crSizeNWSE;
      end
      //光标在控件的客户区(移动整个控件)
      else if (X > 5) and (Y > 5) and (X < WinControl.Width - 5) and (Y < WinControl.Height - 5)then
      begin
        SC_MANIPULATE := $F009;
        WinControl.Cursor := crSizeAll;
      end
      else
      begin
        SC_MANIPULATE := $F000;
        WinControl.Cursor := crDefault;
      end;  if Shift = [ssLeft] then
      begin
        ReleaseCapture;
        WinControl.Perform(WM_SYSCOMMAND, SC_MANIPULATE, 0);
      end;
    end;procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
      Caption := IntToStr(X) + '/' + IntToStr(Y);
      ManipulateControl((Sender as TWinControl), Shift, X, Y, 10);
    end;
      

  3.   

    好像对于有的控件不行,TImage和TLabel控件不行,怎么解决?
      

  4.   

    因那个上面的代码只对TWinControl继承下来的控件有用,TImage是从TGraphicControl继承下来的
    所以没有什么用。
      

  5.   

    TControl有Parent属性,获得其Parent的HDC,作画,再判断鼠标移动的情况
    等等,也许可实现一个类,让我想想怎么做
      

  6.   

    能完成请E-mail给我,[email protected]
      

  7.   

    做完就给我E_mail.
    过几天我再开题请您来拿分。