プロパティエディタを作っています。
TRichEditをエディタとして使いますが、このフォントとサイズをIDEと同じにしたいのです。
レジストリ位置で言えば以下のような場所にあります。
Delphi 7
HKEY_CURRENT_USER\Software\Borland\Delphi\7.0\Editor\Options\
RAD Studio 10.2 Tokyo
HKEY_CURRENT_USER\Software\Embarcadero\BDS\19.0\Editor\Options\
できれば各種バージョンのDelphiで対応したいのですが、上記のレジストリ位置を、
取得する方法はあるのでしょうか?
環境変数で、インストール先を知ることはできそうなのですが。
http://mrxray.on.coocan.jp/Delphi/plSamples/827_IDEorEXE.htm#03
なお、コンパイラオプションで逃げることもできますが、代替レジストリキーを
使われると、正確ではなくなってしまうかなと。
http://docwiki.embarcadero.com/RADStudio/Berlin/ja/IDE_%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89_%E3%83%A9%E3%82%A4%E3%83%B3_%E3%82%B9%E3%82%A4%E3%83%83%E3%83%81%E3%81%A8%E3%82%AA%E3%83%97%E3%82%B7%E3%83%A7%E3%83%B3
たぶん、探し方が悪いのだと思いますが、よろしくお願いします。
OTAは詳しくないのですが、BorlandIDEServicesがIOTAEditorServices60であればEditOptionsというプロパティがあり、こいつがIOTAEditOptions60であればFontName/FontSizeというプロパティでご所望の情報が取得できるのではないかと。
通りすがりさん、レスありがとうございました。
いや〜、大変お恥ずかしい、自分は、何を作っていたつもりなんでしょうか。
"OTA"という単語を見て、それだけですっきりしました。
(OTA = Open Tools API の略)
多くは語りませんが、以下のように使うようです。
uses
SysUtils, ToolsApi;
// "\Software\Borland\Delphi\7.0" 等のレジストリキーを得る場合
function GetBaseRegistryKey: String;
var
otaServices: IOTAServices;
begin
if Supports(BorlandIDEServices, IOTAServices, otaServices) then begin
Result := otaServices.GetBaseRegistryKey;
otaServices := nil;
end
end;
//Memoコンポーネントにフォント名・サイズの反映
procedure SetFont;
var
otaEditorServices: IOTAEditorServices;
begin
if Supports(BorlandIDEServices, IOTAEditorServices, otaEditorServices) then begin
Memo.Font.Name := otaEditorServices.EditOptions.FontName;
Memo.Font.Size := otaEditorServices.EditOptions.FontSize;
otaEditorServices := nil;
end;
end;
ツイート | ![]() |