Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions MarkDownSharpEditor/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ public class AppSettings
private int _ListViewColumnHeader1Width;
private int _ListViewColumnHeader2Width;

private int _FeatureBrowserEmulation; //UserAgentのレジストリ設定
private int _FeatureDocumentCompatibuleMode; //IEレンダリングモードのレジストリ設定


#endregion

//-----------------------------------
Expand Down Expand Up @@ -514,6 +518,22 @@ public int ListViewColumnHeader2Width
set { _ListViewColumnHeader2Width = value; }
}

//UserAgentのレジストリ設定
public int FeatureBrowserEmulation
{
get { return _FeatureBrowserEmulation; }
set { _FeatureBrowserEmulation = value; }
}

//IEレンダリングモードのレジストリ設定
public int FeatureDocumentCompatibuleMode
{
get { return _FeatureDocumentCompatibuleMode; }
set { _FeatureDocumentCompatibuleMode = value; }
}



#endregion
//-----------------------------------

Expand Down Expand Up @@ -654,6 +674,9 @@ public AppSettings()
_ListViewColumnHeader1Width = 128;
_ListViewColumnHeader2Width = 512;

_FeatureBrowserEmulation = 7000;
_FeatureDocumentCompatibuleMode = 70000;

}

//----------------------------------------------------
Expand Down Expand Up @@ -908,6 +931,31 @@ public static string GetAppDataLocalPath()
//return (Path.GetDirectoryName(Application.ExecutablePath));
}


// BrowserControlのUserAgentとレンダリングモードを指定する
public static void SetBrowserRenderingMode(int featureBrowserEmulation, int featureDocumentCompatibleMode)
{
// ユーザーエージェントのレジストリキー
string FEATURE_BROWSER_EMULATION = @"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION";
// レンダリングモードのレジストリキー
string FEATURE_DOCUMENT_COMPATIBLE_MODE = @"Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_DOCUMENT_COMPATIBLE_MODE";

#if DEBUG
string exename = "MarkDownSharpEditor.vshost.exe";
#else
string exename = "MarkDownSharpEditor.exe";
#endif
using (var regkey1 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(FEATURE_BROWSER_EMULATION))
using (var regkey2 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(FEATURE_DOCUMENT_COMPATIBLE_MODE))
{
regkey1.SetValue(exename, featureBrowserEmulation, Microsoft.Win32.RegistryValueKind.DWord);
regkey2.SetValue(exename, featureDocumentCompatibleMode, Microsoft.Win32.RegistryValueKind.DWord);
regkey1.Close();
regkey2.Close();
}

}

}

}
Loading