📄 customicon.cs
字号:
this.groupBox2.TabStop = false;
this.groupBox2.Text = "快捷方式图标";
//
// checkBox1
//
this.checkBox1.Location = new System.Drawing.Point(10, 22);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(150, 24);
this.checkBox1.TabIndex = 0;
this.checkBox1.Text = "隐藏快捷方式的小箭头";
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// bn_refresh
//
this.bn_refresh.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.bn_refresh.Location = new System.Drawing.Point(10, 388);
this.bn_refresh.Name = "bn_refresh";
this.bn_refresh.Size = new System.Drawing.Size(108, 28);
this.bn_refresh.TabIndex = 4;
this.bn_refresh.Text = "重建图标缓存";
this.bn_refresh.Click += new System.EventHandler(this.bn_refresh_Click);
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(132, 396);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(215, 17);
this.label7.TabIndex = 5;
this.label7.Text = "更改图标后,请使用此功能来更新图标";
//
// CustomIcon
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(508, 422);
this.Controls.Add(this.label7);
this.Controls.Add(this.bn_refresh);
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 = "CustomIcon";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "自定义图标";
this.TopMost = true;
this.Load += new System.EventHandler(this.CustomIcon_Load);
this.tabControl.ResumeLayout(false);
this.tp_1.ResumeLayout(false);
this.tp_2.ResumeLayout(false);
this.tp_3.ResumeLayout(false);
this.groupBox5.ResumeLayout(false);
this.tp_4.ResumeLayout(false);
this.groupBox7.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void CustomIcon_Load(object sender, System.EventArgs e)
{
this.TopMost =action.isTopMost ;
this.textBox1.Text =action.GetRecyclingName ();
MessageBox.Show("该功能尚未完成.",action.Caption);
cb=action.getFileTypeList ();
// this.tabControl.TabPages.RemoveAt(0);
// this.tabControl.TabPages.RemoveAt(1);
// this.tabControl.TabPages.RemoveAt(2);
loadDeskTopImage();
loadSystemImage();
//// loadFileImage();
}
private void loadDeskTopImage()
{
for(int i=0;i<this.DeskTopIconList.Items.Count ;i++)
{
string path=action.getDeskTopIcon (this.DeskTopIconList.Items [i].Text);
int Iconindex=0;
if(path.LastIndexOf(",")>0)
{
Iconindex=int.Parse (path.Substring (path.IndexOf (",")+1));
path=path.Substring (0,path.IndexOf (","));
}
if(path.Length >0)
{
Icon ico =Extract.GetIcon (path,Iconindex);
this.DesktopIcon .Images .Add (ico);
this.DeskTopIconList.Items[i].ImageIndex=i;
}
}
}
private void loadSystemImage()
{
for(int i=0;i<this.SystemIconList.Items.Count ;i++)
{
string path=action.getSystemIcon(this.SystemIconList.Items [i].Text);
int Iconindex=0;
if( path !=null && path.LastIndexOf(",")>0)
{
Iconindex=int.Parse (path.Substring (path.IndexOf (",")+1));
path=path.Substring (0,path.IndexOf (","));
}
if(path !=null && path.Length >0)
{
Icon ico =Extract.GetIcon (path,Iconindex);
this.SystemIcon .Images .Add (ico);
this.SystemIconList.Items[i].ImageIndex=i;
}
}
}
private void loadFileImage()
{
for(int i=0;i<this.FileIconList.Items.Count ;i++)
{
string path=action.getFileIcon(this.FileIconList.Items [i].Text);
int Iconindex=0;
if(path.LastIndexOf(",")>0)
{
Iconindex=int.Parse (path.Substring (path.IndexOf (",")+1));
path=path.Substring (0,path.IndexOf (","));
}
if(path.Length >0)
{
Icon ico =Extract.GetIcon (path,Iconindex);
this.FileIcon .Images .Add (ico);
this.FileIconList.Items[i].ImageIndex=i;
}
}
}
private void tb_FileName_TextChanged(object sender, System.EventArgs e)
{
try
{
for(int i =0 ; i<cb.Items.Count;i++)
{
if("."+this.tb_FileName.Text==cb.Items [i].ToString ())
{
string path=action.getFileIcon (this.tb_FileName .Text );
int Iconindex=0;
if(path!=null && path.LastIndexOf(",")>0)
{
Iconindex=int.Parse (path.Substring (path.IndexOf (",")+1));
path=path.Substring (0,path.IndexOf (","));
}
if(path!=null && path.Length >0)
{
Icon ico =Extract.GetIcon (path,Iconindex);
this.pb_show.Image =(Image)ico.ToBitmap ();
}
}
}
}
catch
{
}
}
private void bn_refresh_Click(object sender, System.EventArgs e)
{
}
private void button2_Click(object sender, System.EventArgs e)
{
action.ChangeRecyclingName (this.textBox1.Text);
MessageBox.Show ("回收站名更改成功.",action.Caption);
}
private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{
if(this.checkBox1 .Checked )
{
action.HideORShowIconHand (true);
}
else
{
action.HideORShowIconHand (false);
}
}
private void menuItem1_Click(object sender, System.EventArgs e)
{
int tabindex=tabControl.SelectedIndex ;
string icopath="";
int icoindex=0;
if(tabindex==0)
{
if(this.DeskTopIconList.SelectedItems !=null)
{
icopath=action.getDeskTopIcon(this.DeskTopIconList.SelectedItems[0].Text);
GetIcon gi=new GetIcon ();
if(icopath.LastIndexOf(",")>0)
{
icoindex=icopath.LastIndexOf(",");
}
if(icoindex>0)
{
gi.setIconpath(icopath.Substring(0,icoindex),int.Parse(icopath.Substring(icoindex+1)));
}
else
{
gi.setIconpath(icopath,0);
}
gi.ShowDialog();
}
}
else if(tabindex==1)
{
if(this.SystemIconList.SelectedItems!=null)
{
icopath=action.getSystemIcon(this.SystemIconList.SelectedItems[0].Text);
GetIcon gi=new GetIcon ();
if(icopath.LastIndexOf(",")>0)
{
icoindex=icopath.LastIndexOf(",");
}
if(icoindex>0)
{
gi.setIconpath(icopath.Substring(0,icoindex),int.Parse(icopath.Substring(icoindex+1)));
}
else
{
gi.setIconpath(icopath,0);
}
gi.ShowDialog();
}
}
else if(tabindex==2)
{
if(this.FileIconList.SelectedItems!=null)
{
icopath=action.getFileIcon(this.FileIconList.SelectedItems[0].Text);
GetIcon gi=new GetIcon ();
if(icopath.LastIndexOf(",")>0)
{
icoindex=icopath.LastIndexOf(",");
}
if(icoindex>0)
{
gi.setIconpath(icopath.Substring(0,icoindex),int.Parse(icopath.Substring(icoindex+1)));
}
else
{
gi.setIconpath(icopath,0);
}
gi.ShowDialog();
}
}
}
private void bn_changeIcon_Click(object sender, System.EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -