📄 ieview.cs
字号:
namespace Codematic
{
using Crownwood.Magic.Controls;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class IEView : Form
{
private ToolStripLabel addressFileToolStripLabel;
private ToolStripButton backFileToolStripButton;
private ToolStripButton btn_Go;
private IContainer components;
private ToolStrip fileBrowserToolStrip;
private ToolStripSeparator fileToolStripSeparator;
private ToolStripButton forwardFileToolStripButton;
private MainForm mainfrm;
private ToolStripTextBox txtUrl;
private ToolStripButton upFileToolStripButton;
private WebBrowser webBrowser1;
public IEView(Form mdiParentForm, string url)
{
this.InitializeComponent();
this.mainfrm = (MainForm) mdiParentForm;
this.txtUrl.Text = url;
this.mainfrm.StatusLabel1.Text = url;
this.webBrowser1.Navigate(url);
}
private void btn_Go_Click(object sender, EventArgs e)
{
try
{
this.webBrowser1.Navigate(this.txtUrl.Text);
}
catch
{
MessageBox.Show("连接失败!请检查网络是否连接或网址是否正确!");
}
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
protected string FormatString(string str)
{
if (str.Length > 30)
{
str = str.Substring(0, 0x1d) + "...";
}
return str;
}
private void InitializeComponent()
{
ComponentResourceManager manager = new ComponentResourceManager(typeof(IEView));
this.webBrowser1 = new WebBrowser();
this.fileBrowserToolStrip = new ToolStrip();
this.backFileToolStripButton = new ToolStripButton();
this.forwardFileToolStripButton = new ToolStripButton();
this.upFileToolStripButton = new ToolStripButton();
this.fileToolStripSeparator = new ToolStripSeparator();
this.addressFileToolStripLabel = new ToolStripLabel();
this.txtUrl = new ToolStripTextBox();
this.btn_Go = new ToolStripButton();
this.fileBrowserToolStrip.SuspendLayout();
base.SuspendLayout();
this.webBrowser1.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
this.webBrowser1.Location = new Point(4, 0x1c);
this.webBrowser1.MinimumSize = new Size(20, 20);
this.webBrowser1.Name = "webBrowser1";
this.webBrowser1.Size = new Size(0x24d, 0x19c);
this.webBrowser1.TabIndex = 3;
this.webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
this.fileBrowserToolStrip.Items.AddRange(new ToolStripItem[] { this.backFileToolStripButton, this.forwardFileToolStripButton, this.upFileToolStripButton, this.fileToolStripSeparator, this.addressFileToolStripLabel, this.txtUrl, this.btn_Go });
this.fileBrowserToolStrip.Location = new Point(0, 0);
this.fileBrowserToolStrip.Name = "fileBrowserToolStrip";
this.fileBrowserToolStrip.Size = new Size(0x255, 0x1b);
this.fileBrowserToolStrip.Stretch = true;
this.fileBrowserToolStrip.TabIndex = 9;
this.fileBrowserToolStrip.Text = "toolStrip2";
this.backFileToolStripButton.Image = (Image) manager.GetObject("backFileToolStripButton.Image");
this.backFileToolStripButton.ImageScaling = ToolStripItemImageScaling.None;
this.backFileToolStripButton.ImageTransparentColor = Color.Magenta;
this.backFileToolStripButton.Name = "backFileToolStripButton";
this.backFileToolStripButton.Size = new Size(0x30, 0x18);
this.backFileToolStripButton.Text = "Back";
this.forwardFileToolStripButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
this.forwardFileToolStripButton.Image = (Image) manager.GetObject("forwardFileToolStripButton.Image");
this.forwardFileToolStripButton.ImageScaling = ToolStripItemImageScaling.None;
this.forwardFileToolStripButton.ImageTransparentColor = Color.Magenta;
this.forwardFileToolStripButton.Name = "forwardFileToolStripButton";
this.forwardFileToolStripButton.Size = new Size(0x17, 0x18);
this.forwardFileToolStripButton.Text = "Forward";
this.upFileToolStripButton.DisplayStyle = ToolStripItemDisplayStyle.Image;
this.upFileToolStripButton.Image = (Image) manager.GetObject("upFileToolStripButton.Image");
this.upFileToolStripButton.ImageScaling = ToolStripItemImageScaling.None;
this.upFileToolStripButton.ImageTransparentColor = Color.Magenta;
this.upFileToolStripButton.Name = "upFileToolStripButton";
this.upFileToolStripButton.Size = new Size(0x17, 0x18);
this.upFileToolStripButton.Text = "toolStripButton4";
this.fileToolStripSeparator.Name = "fileToolStripSeparator";
this.fileToolStripSeparator.Size = new Size(6, 0x1b);
this.addressFileToolStripLabel.Name = "addressFileToolStripLabel";
this.addressFileToolStripLabel.Size = new Size(0x23, 0x18);
this.addressFileToolStripLabel.Text = "URL:";
this.txtUrl.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
this.txtUrl.AutoCompleteSource = AutoCompleteSource.FileSystem;
this.txtUrl.AutoSize = false;
this.txtUrl.BorderStyle = BorderStyle.FixedSingle;
this.txtUrl.Margin = new Padding(1);
this.txtUrl.Name = "txtUrl";
this.txtUrl.Size = new Size(370, 0x15);
this.btn_Go.Image = (Image) manager.GetObject("btn_Go.Image");
this.btn_Go.ImageScaling = ToolStripItemImageScaling.None;
this.btn_Go.ImageTransparentColor = Color.Magenta;
this.btn_Go.Name = "btn_Go";
this.btn_Go.Size = new Size(0x29, 0x18);
this.btn_Go.Text = "Go";
base.AutoScaleDimensions = new SizeF(6f, 12f);
base.AutoScaleMode = AutoScaleMode.Font;
base.ClientSize = new Size(0x255, 440);
base.Controls.Add(this.fileBrowserToolStrip);
base.Controls.Add(this.webBrowser1);
base.Name = "IEView";
this.Text = "IEView";
this.fileBrowserToolStrip.ResumeLayout(false);
this.fileBrowserToolStrip.PerformLayout();
base.ResumeLayout(false);
base.PerformLayout();
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
this.mainfrm.StatusLabel1.Text = "完成";
Crownwood.Magic.Controls.TabPage parent = (Crownwood.Magic.Controls.TabPage) base.Parent.Parent;
string documentTitle = this.webBrowser1.DocumentTitle;
parent.Title = documentTitle;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -