2008-09-07 33 views
3

私はwinformsでwebbrowserコントロールを使用していて、CSSで適用する背景イメージが印刷物に含まれていないことを発見しました。WebBrowserコントロールでCSSの適用された背景イメージを印刷する方法

ウェブブラウザに表示されたドキュメントの背景も印刷させる方法はありますか?

編集:

using Microsoft.Win32; 

... 

RegistryKey regKey = Registry.CurrentUser 
        .OpenSubKey("Software") 
        .OpenSubKey("Microsoft") 
        .OpenSubKey("Internet Explorer") 
        .OpenSubKey("Main"); 

//Get the current setting so that we can revert it after printjob 
var defaultValue = regKey.GetValue("Print_Background"); 
regKey.SetValue("Print_Background", "yes"); 

//Do the printing 

//Revert the registry key to the original value 
regKey.SetValue("Print_Background", defaultValue); 

値だけを読んで、そして前に自分自身をこれを調整するためにユーザに通知するかもしれないこれを処理する別の方法を:私はプログラム的にこれをやってみたかったので は、私はこのソリューションを選択しました印刷。私はこのようなレジストリを調整するのは良い方法ではないということに同意しなければならないので、私はどんな提案もしています。

ご意見ありがとうございました

答えて

1

あなたが行くと、重要なシステム設定を変更するつもりなら、まず読んでください現在の設定を保存し、完了したら復元します。

私はこれを考えています非常に悪い最初は練習がありますが、それをしなければならない場合は親切にしてください。

Registry.LocalMachine 

また、代わりにLocalMachineの​​を変更してみてください - あなたのアプリケーションがクラッシュした場合、そのように(そして、それは意志)、その後、あなただけのユーザーではなく、マシンを使用するすべての人を混乱させます。

0

デフォルトでは、ブラウザは背景画像をまったく印刷しません。 Firefoxので

IEで
* File > Page Setup > Check Off "Print Background" 
* File > Print Preview 

* Tools > Internet Options > Advanced > Printing 
* Check Off "Print Background Images and Colors" 

オペラで

* File > Print Options > Check Off "Print Page Background" 
* File > Print Preview (You may have to scroll down/up to see it refresh) 
1

この設定に対応するHKCUキーは次のとおりです。 ます。HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorerの\メイン\ Print_Background

2

別のレジストリキーは次のようになります。 ます。HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorerの\のPageSetup \ Print_Background HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Internet Explorer \ PageSetup \ Print_Background

0
var sh = new ActiveXObject("WScript.Shell"); 
key = "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\Print_Background"; 
var defaultValue = sh.RegRead(key); 
sh.RegWrite(key,"yes","REG_SZ"); 
document.frames['detailFrame'].focus(); 
document.frames['detailFrame'].print(); 
sh.RegWrite(key,defaultValue,"REG_SZ"); 
return false; 
関連する問題