Outlook中的Office Addin在关闭DialogApi时引发以下错误。
procedure TCustomComponent.MouseClick(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X: integer; Y: integer);
begin
self.Repaint;
self.PMenuForm.Left := self.Left; // p.x;
self.PMenuForm.Top := self.Top + self.Height + 5; // p.Y+self.Height+5;
PMenuForm.ShowModal;
end;
procedure TCustomComponent.CreateMenu(title: string);
begin
if PMenuForm = nil then
begin
PMenuForm := TForm.Create(self.Parent);
PMenuForm.Parent := self.Parent;
PMenuForm.ParentWindow := self.Parent.Handle;
PMenuForm.FormStyle := fsStayOnTop;
PMenuForm.Enabled := true;
PMenuForm.Visible := false;
PMenuForm.BorderWidth := 2;
PMenuForm.BorderStyle := bsNone;
PMenuForm.BorderIcons := [];
PMenuForm.caption := title;
PMenuFormTitle := TLabel.Create(PMenuForm);
PMenuFormTitle.Left := 0;
PMenuFormTitle.Top := 0;
PMenuFormTitle.Margins.Left := 5;
PMenuFormTitle.AutoSize := true;
PMenuFormTitle.Visible := true;
PMenuFormTitle.Parent := PMenuForm;
PMenuFormTitle.Font.Color := MakeColor($FFFFFF);
PMenuFormTitle.Font.Size := 10;
PMenuFormTitle.Font.Style := [fsBold];
PMenuFormTitle.Color := MakeColor($0000CC);
PMenuFormTitle.Transparent := false;
PMenuFormTitle.caption := title;
PMenuFormTitle.Layout := tlCenter;
PMenuFormTitle.Alignment := taLeftJustify;
PMenuFormTitle.AutoSize := false;
if PMenuFormTitle.Width < 55 then
PMenuFormTitle.Width := 65;
if PMenuFormTitle.Height < 10 then
PMenuFormTitle.Width := 10;
PMenuFormItems[0] := TBitBtn.Create(PMenuForm);
PMenuFormItems[0].Parent := PMenuForm;
PMenuFormItems[0].ParentWindow := PMenuForm.ClientHandle;
PMenuFormItems[0].tag := 0;
PMenuFormItems[0].Enabled := true;
PMenuFormItems[0].Visible := true;
PMenuFormItems[0].Top := 0;
PMenuFormItems[0].Left := PMenuFormTitle.Width - 22;
PMenuFormItems[0].caption := 'X';
PMenuFormItems[0].Font.Style := [fsBold];
PMenuFormItems[0].Width := 20;
PMenuFormItems[0].Height := PMenuFormTitle.Height;
PMenuFormItems[0].OnClick := self.MenuItemClick;
PMenuForm.AutoSize := true;
self.PMenuFormItemsCount := 0;
self.OnMouseDown := self.MouseClick;
self.Cursor := crHandPoint;
end;
end;