Fix safe work
This commit is contained in:
@@ -50,17 +50,29 @@ end;
|
||||
|
||||
procedure TFormHelper.SetWindowColorMode(IsDark: Boolean);
|
||||
begin
|
||||
try
|
||||
SetWindowColorModeFor(handle, IsDark);
|
||||
except
|
||||
//
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFormHelper.SetWindowColorModeAsSystem;
|
||||
begin
|
||||
try
|
||||
SetWindowColorModeAsSystemFor(Handle);
|
||||
except
|
||||
//
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TFormHelper.SystemIsDarkMode: Boolean;
|
||||
begin
|
||||
try
|
||||
Result := IsDarkMode;
|
||||
except
|
||||
Result := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$ELSE}
|
||||
|
||||
@@ -123,6 +123,7 @@ var
|
||||
LRegistry: TRegistry;
|
||||
begin
|
||||
Result := False;
|
||||
try
|
||||
LRegistry := TRegistry.Create;
|
||||
try
|
||||
LRegistry.RootKey := HKEY_CURRENT_USER;
|
||||
@@ -131,6 +132,9 @@ begin
|
||||
finally
|
||||
LRegistry.Free;
|
||||
end;
|
||||
except
|
||||
Result := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
function ShouldSystemUseDarkMode: BOOL;
|
||||
|
||||
Reference in New Issue
Block a user