惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
Recent Announcements
Recent Announcements
A
About on SuperTechFans
U
Unit 42
MyScale Blog
MyScale Blog
J
Java Code Geeks
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
D
Docker
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 司徒正美
量子位
月光博客
月光博客
G
Google Developers Blog
V
V2EX
博客园 - 聂微东
宝玉的分享
宝玉的分享
IT之家
IT之家
Vercel News
Vercel News

博客园 - Enli

IOS 命令行安装备忘 IOS开发备忘 MAC 编制计划任务 弹出式窗口管理单元备忘 Wininet请求包装类简稿 自备工具库 界面方面的备忘 rc资源文件的中英文应用备忘 Wininet下载类初稿 Dephi调用C#编写的WebService的一些问题与解决 (转) 关于Window的快捷方式,图标缓存的清理 Delphi 备忘五 http断点续传的单元 Delphi 代码优化(转) [转载]Delphi的四舍五入函数 同名派生的应用(转) 关于delphi的程序在英文操作系统下乱码问题 - Enli - 博客园 TWebBrowser备忘 组件开发中的技巧(转)
多屏开发的备忘
Enli · 2012-01-31 · via 博客园 - Enli

1. dll里面的form显示位置问题

   需要显示在主程序窗口的屏幕上,可以用下面的方法放到 TForm里面的FormActivate事件里面

var
  HM: HMonitor;
  I: Integer;
  LRect: TRect;
Begin
{$IFDEF STATIC_ADDIN}
  HM := MonitorFromWindow(FContext.MasterPageHandle, MONITOR_DEFAULTTONEAREST);
  if HM > 0 then
  begin
    for I := 0 to Screen.MonitorCount - 1 do
    if Screen.Monitors[I].Handle = HM then
    begin
      LRect := Screen.Monitors[I].WorkareaRect;
      SetBounds(LRect.Left + ((RectWidth(LRect) - Width) div 2),
        LRect.Top + ((RectHeight(LRect) - Height) div 2), Width, Height);
      Break;
    end;
  end;
{$ENDIF}
end;

 也可以直接跟着主程序的窗体走,直接在Formshow里面加

  Left := FContext.MainForm.Left;
  Top := FContext.MainForm.Top;