本文整理汇总了C#中System.Windows.Forms.WebBrowser.CreateControl方法的典型用法代码示例。如果您正苦于以下问题:C# WebBrowser.CreateControl方法的具体用法?C# WebBrowser.CreateControl怎么用?C# WebBrowser.CreateControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.WebBrowser
的用法示例。
在下文中一共展示了WebBrowser.CreateControl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowPrintPreview
public void ShowPrintPreview()
{
WebBrowser x = new WebBrowser();
x.CreateControl();
x.Visible = false;
try
{
x.Navigate(Url);
x.ShowPrintPreviewDialog();
}
catch (System.Net.WebException y)
{
MessageBox.Show(y.Message);
}
}
示例2: BuildFile
static void BuildFile(string fileName, string classFileName)
{
WebBrowser wBrowser = new WebBrowser();
wBrowser.CreateControl();
wBrowser.Navigate(new Uri(WebUI.ResultsWebServer.Uri, "ServicesList.aspx"));
WebBrowserHelper.Wait(wBrowser);
HtmlDocument doc = WebBrowserHelper.GetDocument(wBrowser);
string template = wBrowser.DocumentText;
GenerateDocument(wBrowser);
int bodyidx = template.IndexOf("<body>");
template = template.Substring(0, bodyidx);
StringBuilder body = new StringBuilder(doc.Body.OuterHtml);
body.Replace("FONT-SIZE: 8.25pt;", "");
body.Replace("FONT-FAMILY: Tahoma;", "");
body.Replace("MARGIN: -7px;", "");
body.Replace("</BODY>", "<br><span style='color: gray;'>Generated by : " + FreeCL.RTL.ApplicationInfo.ProductName + ", version :"+ FreeCL.RTL.ApplicationInfo.ProductVersion + "</span></body>" );
string result = template + body.ToString() + "\r\n</html>";
FileStream fs = new FileStream(fileName, FileMode.Create);
StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
sw.Write(result);
sw.Flush();
sw.Dispose();
wBrowser.Dispose();
fs = new FileStream(classFileName, FileMode.Create);
string className = Path.GetFileNameWithoutExtension(classFileName);
sw = new StreamWriter(fs, Encoding.BigEndianUnicode);
sw.Write("import java.applet.*;\r\n\r\n");
sw.Write("public class ");
sw.Write(className);
sw.Write(" extends Applet{\r\npublic String d(){\r\n");
int i = 0;
int cnt;
StringBuilder substr;
int var_num = 0;
while(i < result.Length)
{
cnt = 16384;
if(i + cnt > result.Length)
cnt = result.Length - i;
substr = new StringBuilder(result.Substring(i, cnt));
substr.Replace("\"", "\\\"");
substr.Replace("\r", "\\r");
substr.Replace("\n", "\\n");
sw.Write("String s");
sw.Write(var_num.ToString());
var_num++;
sw.Write(" = ");
sw.Write("\"" + substr.ToString() + "\";\r\n");
i += 16384;
}
sw.Write("return ");
for(i = 0; i < var_num; i++)
{
sw.Write("s");
sw.Write(i.ToString());
if(i + 1 < var_num)
sw.Write("+");
}
sw.Write(";\r\n}\r\n}");
sw.Flush();
sw.Dispose();
wBrowser.Dispose();
}