/// <summary> /// Sets the color of the text within the preview handler. /// </summary> /// <param name="color">A value of type COLORREF to use for the preview handler text color.</param> /// <returns> /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error cod /// </returns> int IPreviewHandlerVisuals.SetTextColor(COLORREF color) { // DebugLog key events. Log("IPreviewHandlerVisuals.SetTextColor called."); // Call the virtual function. try { OnPreviewHostThread( () => { // Call the abstract function. if (previewHandlerControl != null) previewHandlerControl.SetVisualsTextColor(color.Color); }); } catch (Exception exception) { // DebugLog the error. LogError("An exception occured when setting the text color.", exception); throw; } // Return success. return WinError.S_OK; }
/// <summary> /// Sets the background color of the preview handler. /// </summary> /// <param name="color">A value of type COLORREF to use for the preview handler background.</param> /// <returns> /// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. /// </returns> int IPreviewHandlerVisuals.SetBackgroundColor(COLORREF color) { // Log key events. Log("IPreviewHandlerVisuals.SetBackgroundColor called."); // Call the virtual function. try { OnPreviewHostThread( () => { // Set the background color of the host. previewHandlerHost.BackColor = color.Color; // Call the abstract function. if(previewHandlerControl != null) previewHandlerControl.SetVisualsBackgroundColor(color.Color); }); } catch (Exception exception) { // Log the error. LogError("An exception occured when setting the background color.", exception); throw; } // Return success. return WinError.S_OK; }