unit ufrmEscolheAcordo; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type TfrmEscolheAcordo = class(TForm) Label1: TLabel; ComboBox1: TComboBox; Button1: TButton; Button2: TButton; procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Button1Click(Sender: TObject); private procedure WMMoving(var Msg: TWMMoving); message WM_MOVING; { Private declarations } public { Public declarations } end; var frmEscolheAcordo: TfrmEscolheAcordo; implementation {$R *.dfm} uses ufrmAtendimento; { TfrmEscolheAcordo } procedure TfrmEscolheAcordo.Button1Click(Sender: TObject); begin case ComboBox1.ItemIndex of 0: begin frmAtendimento.tipo_parcelamento := 'P'; end; 1: begin frmAtendimento.tipo_parcelamento := 'F'; end; end; end; procedure TfrmEscolheAcordo.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = VK_ESCAPE then begin Key := 0; Close; end; end; procedure TfrmEscolheAcordo.WMMoving(var Msg: TWMMoving); var workArea: TRect; begin workArea := Screen.WorkareaRect; with Msg.DragRect^ do begin if left < workArea.left then OffsetRect(Msg.DragRect^, workArea.left - left, 0); if top < workArea.top then OffsetRect(Msg.DragRect^, 0, workArea.top - top); if Right > workArea.Right then OffsetRect(Msg.DragRect^, workArea.Right - Right, 0); if Bottom > workArea.Bottom then OffsetRect(Msg.DragRect^, 0, workArea.Bottom - Bottom); end; end; end.