📄 webbrowser.cs
字号:
this.bn_use.Location = new System.Drawing.Point(220, 70);
this.bn_use.Name = "bn_use";
this.bn_use.TabIndex = 19;
this.bn_use.Text = "确定";
this.bn_use.Click += new System.EventHandler(this.bn_use_Click);
//
// WebAddress
//
this.WebAddress.Location = new System.Drawing.Point(110, 38);
this.WebAddress.Name = "WebAddress";
this.WebAddress.Size = new System.Drawing.Size(274, 21);
this.WebAddress.TabIndex = 2;
this.WebAddress.Text = "";
//
// label7
//
this.label7.Location = new System.Drawing.Point(70, 16);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(100, 18);
this.label7.TabIndex = 1;
this.label7.Text = "缺省主页:";
//
// label8
//
this.label8.Location = new System.Drawing.Point(70, 42);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(100, 18);
this.label8.TabIndex = 3;
this.label8.Text = "地址:";
//
// pictureBox4
//
this.pictureBox4.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox4.Image")));
this.pictureBox4.Location = new System.Drawing.Point(4, 22);
this.pictureBox4.Name = "pictureBox4";
this.pictureBox4.Size = new System.Drawing.Size(70, 58);
this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox4.TabIndex = 0;
this.pictureBox4.TabStop = false;
//
// WebBrowser
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(474, 346);
this.Controls.Add(this.tabControl);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.HelpButton = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "WebBrowser";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "浏览器";
this.TopMost = true;
this.Closing += new System.ComponentModel.CancelEventHandler(this.WebBrower_Closing);
this.Load += new System.EventHandler(this.WebBrower_Load);
this.tabControl.ResumeLayout(false);
this.tp_1.ResumeLayout(false);
this.tp_3.ResumeLayout(false);
this.tp_2.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.tp_4.ResumeLayout(false);
this.groupBox5.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.mainpage.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void WebBrower_Load(object sender, System.EventArgs e)
{
this.TopMost =action.isTopMost ;
//得到当前主页
string address=action.getHomePage ();
this.WebAddress .Text =address;
//得到IE右键菜单的列表
string rightMenu=action.getIERightMenu();
int n=0;
string rm;
while(rightMenu.Length>n)
{
rm=rightMenu.Substring (0,rightMenu.IndexOf("|and|"));
rightMenulist.Items.Add ((object)rm);
n=5+rm.Length;
rightMenu=rightMenu.Substring(n);
}
//得到IE浏览器标题的文字
string cc=action.ReadIECaption ();
this.tb_IEcaption.Text =cc;
//得到IE浏览器动画图标
string bb=action.ReadIEBrandBitmap();
if(bb !=null && bb.Length >0)
{
this.BrandBitmap .Image =Image.FromFile (bb);
}
//得到安装的浏览器工具栏背景列表
string [] f=Directory.GetFiles(Application.StartupPath +"\\IEBackG\\");
foreach(string f2 in f)
{
this.imgList.Items.Add ((object)f2.Substring (f2.LastIndexOf("\\")+1));
}
//得到选项
this.tabControl.SelectedIndex=tab;
//在点击工具栏背景时是否显示预览窗
if (tab==0)
{
bf.Show ();
}
}
private void tabControl_SelectedIndexChanged(object sender, System.EventArgs e)
{
//选择工具栏背景的标签时是否显示预览窗
if(this.tabControl.SelectedIndex ==0 && this.bn_showbrowForm .Text =="隐藏预览窗")
{
bf.Show ();
}
else
{
bf.Hide ();
}
}
private void WebBrower_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
//关闭预览窗
bf.Close ();
}
private void imgList_SelectedIndexChanged(object sender, System.EventArgs e)
{
bf.ChangeBackG (Application.StartupPath+"\\IEBackG\\"+imgList.SelectedItem.ToString ());
}
private void bn_save_Click(object sender, System.EventArgs e)
{
int Browser=3;
if(this.cb_2 .Checked )
{
Browser=1;
}
if(this.cb_1 .Checked )
{
Browser=2;
}
if(this.cb_2 .Checked && this.cb_1 .Checked )
{
Browser=3;
}
if(MessageBox.Show ("是否设置这张图片为背景",action.Caption,System.Windows.Forms.MessageBoxButtons.YesNo)==DialogResult.Yes )
{
action.setIEBackBitmap (Application.StartupPath+"\\IEBackG\\"+imgList.SelectedItem.ToString (),Browser);
MessageBox.Show ("己经成功设置背景。",action.Caption);
}
}
private void bn_ini_Click(object sender, System.EventArgs e)
{
action.cancelIEBackBitmap ();
MessageBox.Show ("己经成功取消背景。",action.Caption);
}
private void bn_add_Click(object sender, System.EventArgs e)
{
//安装工具栏背景
try
{
OpenFileDialog ofd=new OpenFileDialog ();
ofd.Filter ="*.bmp | *.bmp";
if(ofd.ShowDialog ()==DialogResult.OK )
{
string filename=ofd.FileName.Substring (ofd.FileName.LastIndexOf("\\")+1);
if(File.Exists (Application.StartupPath+"\\IEBackG\\"+filename))
{
DialogResult dr=MessageBox.Show ("文件己存在,是否替换该文件",action.Caption,System.Windows.Forms.MessageBoxButtons.YesNoCancel);
if(dr==DialogResult.Yes)
{
File.Copy (ofd.FileName ,Application.StartupPath+"\\IEBackG\\"+filename,true);
}
else if (dr==DialogResult.No )
{
SaveFileDialog sfd=new SaveFileDialog ();
sfd.Filter ="*.bmp | *.bmp";
sfd.InitialDirectory=Application.StartupPath+"\\IEBackG\\";
if(sfd.ShowDialog ()==DialogResult.OK )
{
File.Copy (ofd.FileName ,sfd.FileName);
}
}
}
else
{
File.Copy (ofd.FileName ,Application.StartupPath+"\\IEBackG\\"+filename,true);
}
WebBrower_Load(sender,e);
}
}
catch
{
}
}
private void bn_showbrowForm_Click(object sender, System.EventArgs e)
{
if(bn_showbrowForm.Text=="显示预览窗")
{
bf.Show ();
bn_showbrowForm.Text="隐藏预览窗";
}
else
{
bf.Hide ();
bn_showbrowForm.Text="显示预览窗";
}
}
private void bn_saveb_Click(object sender, System.EventArgs e)
{
if(File.Exists (this.tb_path.Text ) )
{
action.setIEBrandBitmap (this.tb_path.Text );
MessageBox.Show ("己经成功设置IE动画图标。",action.Caption);
}
}
private void bn_inib_Click(object sender, System.EventArgs e)
{
action.cancelIEBrandBitmap( );
MessageBox.Show ("己经成功取消IE动画图标。",action.Caption);
}
private void bn_selecBitmap_Click(object sender, System.EventArgs e)
{
OpenFileDialog ofd=new OpenFileDialog ();
ofd.InitialDirectory =Application.StartupPath+"\\IELogo";
ofd.Filter ="*.bmp | *.bmp";
if(ofd.ShowDialog ()==DialogResult.OK )
{
this.tb_path .Text =ofd.FileName ;
this.BrandBitmap.Image =Image.FromFile (ofd.FileName );
}
}
private void tb_IEcaption_TextChanged(object sender, System.EventArgs e)
{
if(this.tb_IEcaption.Text .Length <21)
{
this.lb_epIecaption.Text =this.tb_IEcaption.Text ;
}
else if(this.tb_IEcaption.Text .Length ==21)
{
this.lb_epIecaption.Text +="...";
}
}
private void bn_savec_Click(object sender, System.EventArgs e)
{
action.setIECaption(this.tb_IEcaption.Text );
MessageBox.Show ("己经成功设置IE标题文字。",action.Caption);
}
private void bn_delIERMenu_Click(object sender, System.EventArgs e)
{
action.DeleteIERightMenu (this.rightMenulist.SelectedItem.ToString ());
MessageBox.Show ("己经成功删除选中的IE右键菜单行。",action.Caption);
}
private void bn_use_Click(object sender, System.EventArgs e)
{
action.setHomePage (this.WebAddress .Text );
MessageBox.Show ("己经成功设置缺省主页。",action.Caption);
}
private void bn_useab_Click(object sender, System.EventArgs e)
{
action.setHomePage ("about:blank" );
this.WebAddress .Text ="about:blank";
MessageBox.Show ("己经成功设置空白主页。",action.Caption);
}
private void bn_usefs_Click(object sender, System.EventArgs e)
{
action.setIEBrowserFullScreen ();
MessageBox.Show ("己经成功设置IE浏览器全屏。",action.Caption);
}
private void bn_cancelfs_Click(object sender, System.EventArgs e)
{
action.cancelIEBrowserFullScreen ();
MessageBox.Show ("己经成功取消IE浏览器全屏。",action.Caption);
}
private void ClsHistory_Click(object sender, System.EventArgs e)
{
action.ClsIEhistory ();
MessageBox.Show ("己经成功清除IE浏览器的历史记录。",action.Caption);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -