In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces asp.net how to achieve icon extraction and icon conversion, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
The copy code is as follows:
Using System
Using System.Collections.Generic
Using System.Drawing
Using System.Windows.Forms
Using System.IO
Using System.Resources
Using System.Reflection
Using System.Runtime.InteropServices
Namespace newExtIcon
{
Public partial class MainForm: Form
{
Public Assembly asm = Assembly.GetExecutingAssembly ()
Public MainForm ()
{
InitializeComponent ()
}
Void MainForm_Load (object sender, EventArgs e)
{
Lbl_display.Text = "No Work!"
}
Void btnExtractClick (object sender, EventArgs e)
{
Random rd = new Random ()
OpenFileDialog1.Filter= "applications | * .dll;*.exe | all programs | *. *"
If (openFileDialog1.ShowDialog () = = DialogResult.OK)
{
Icon icon = Icon.ExtractAssociatedIcon (openFileDialog1.FileName)
FileStream fileStream = new FileStream ("d:\" + rd.Next (1mai 100000) + ".ico", FileMode.Create)
Icon.Save (fileStream)
FileStream.Close ()
Lbl_display.Text= "Work Done!"
}
Else
{
Return
}
}
Void BtnChangeClick (object sender, EventArgs e)
{
Size sz = new Size (329.32)
Random rd = new Random ()
OpenFileDialog1.Filter= "Picture | * .jpg;*.png;*.bmp | all programs | *. *"
/ / openFileDialog1.Filter= "Picture | * .jpg;*.png;*.bmp | Application | * .dll;*.exe"
If (openFileDialog1.ShowDialog () = = DialogResult.OK)
{
Using (Bitmap bm = new Bitmap (openFileDialog1.FileName))
{
Using (Bitmap IconBM = new Bitmap (bm,sz))
{
Using (Icon icon_t = Icon.FromHandle (IconBM.GetHicon ()
{
FileStream fileStream = new FileStream ("d:\" + rd.Next (1mai 100000) + ".ico", FileMode.Create)
Icon_t.Save (fileStream)
FileStream.Close ()
Lbl_display.Text= "Work Done!"
}
}
}
}
Else
{
Return
}
}
Void Pic_Click (object sender, System.EventArgs e)
{
Int int_index = Convert.ToInt32 (PictureBox) sender) .tag)
Switch (int_index)
{
Case 1:
This.Close ()
Application.Exit ()
Break
Case 2:
WindowState = FormWindowState.Minimized
Break
Default:
Break
}
}
Void Pic_Hover (object sender,EventArgs e)
{
String name_1 = "btn_close_hightligth.png"
String name_2 = "btn_mini_highlight.png"
Bitmap bm_1 = new Bitmap (asm.GetManifestResourceStream (name_1))
Bitmap bm_2 = new Bitmap (asm.GetManifestResourceStream (name_2))
Int int_index = Convert.ToInt32 (PictureBox) sender) .tag)
Switch (int_index)
{
Case 1:
PictureBox1.BackgroundImage=bm_1
Break
Case 2:
PictureBox2 .BackgroundImage = bm_2
Break
Default:
Break
}
}
Void Pic_Leave (object sender,EventArgs e)
{
String name_1 = "btn_close_down.png"
String name_2 = "btn_mini_down.png"
Bitmap bm_1 = new Bitmap (asm.GetManifestResourceStream (name_1))
Bitmap bm_2 = new Bitmap (asm.GetManifestResourceStream (name_2))
/ / GetMainfestResourceStream gets the stream
Int int_index = Convert.ToInt32 (PictureBox) sender) .tag)
Switch (int_index)
{
Case 1:
PictureBox1.BackgroundImage=bm_1
Break
Case 2:
PictureBox2 .BackgroundImage = bm_2
Break
Default:
Break
}
}
Private const int WM_NCLBUTTONDOWN = 0xA1
Private const int HTCAPTION = 2
[DllImport ("user32.dll")]
Private static extern int SendMessage (int hwnd, int wMsg, int wParam, int lParam)
[DllImport ("user32.dll")]
Private static extern int ReleaseCapture ()
Private void form_MouseDown (object sender, System.Windows.Forms.MouseEventArgs e)
{
/ / release mouse capture for the current application
ReleaseCapture ()
/ / send a message to make the system think that you are pressing the mouse on the title block
SendMessage ((int) this.Handle,WM_NCLBUTTONDOWN,HTCAPTION,0)
}
}
}
Thank you for reading this article carefully. I hope the article "how to achieve icon extraction and icon conversion in asp.net" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.