效果图:

窗体设计器生成的代码:

namespace ImageCompact
{
partial class MainForm
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null; /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
} #region Windows 窗体设计器生成的代码 /// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lvSourceFolderList = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.btnSelectSourceFolder = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.tbSourceFolderPath = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.cbQualityRate = new System.Windows.Forms.ComboBox();
this.cbSizeRate = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.lvResultList = new System.Windows.Forms.ListView();
this.压缩文件 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.压缩结果 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.btnSelectTargetFolder = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.tbTargetFolderPath = new System.Windows.Forms.TextBox();
this.lbInfomation = new System.Windows.Forms.Label();
this.btnClose = new System.Windows.Forms.Button();
this.btnStart = new System.Windows.Forms.Button();
this.folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.lvSourceFolderList);
this.groupBox1.Controls.Add(this.btnSelectSourceFolder);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.tbSourceFolderPath);
this.groupBox1.Location = new System.Drawing.Point(, );
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(, );
this.groupBox1.TabIndex = ;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "文件来源";
//
// lvSourceFolderList
//
this.lvSourceFolderList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1});
this.lvSourceFolderList.FullRowSelect = true;
this.lvSourceFolderList.GridLines = true;
this.lvSourceFolderList.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.lvSourceFolderList.Location = new System.Drawing.Point(, );
this.lvSourceFolderList.MultiSelect = false;
this.lvSourceFolderList.Name = "lvSourceFolderList";
this.lvSourceFolderList.Size = new System.Drawing.Size(, );
this.lvSourceFolderList.TabIndex = ;
this.lvSourceFolderList.UseCompatibleStateImageBehavior = false;
this.lvSourceFolderList.View = System.Windows.Forms.View.Details;
//
// columnHeader1
//
this.columnHeader1.Text = "图片文件";
this.columnHeader1.Width = ;
//
// btnSelectSourceFolder
//
this.btnSelectSourceFolder.Location = new System.Drawing.Point(, );
this.btnSelectSourceFolder.Name = "btnSelectSourceFolder";
this.btnSelectSourceFolder.Size = new System.Drawing.Size(, );
this.btnSelectSourceFolder.TabIndex = ;
this.btnSelectSourceFolder.Text = "浏览";
this.btnSelectSourceFolder.UseVisualStyleBackColor = true;
this.btnSelectSourceFolder.Click += new System.EventHandler(this.btnSelectSourceFolder_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(, );
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(, );
this.label1.TabIndex = ;
this.label1.Text = "选择文件夹";
//
// tbSourceFolderPath
//
this.tbSourceFolderPath.Location = new System.Drawing.Point(, );
this.tbSourceFolderPath.Name = "tbSourceFolderPath";
this.tbSourceFolderPath.Size = new System.Drawing.Size(, );
this.tbSourceFolderPath.TabIndex = ;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.cbQualityRate);
this.groupBox2.Controls.Add(this.cbSizeRate);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.lvResultList);
this.groupBox2.Controls.Add(this.btnSelectTargetFolder);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.tbTargetFolderPath);
this.groupBox2.Location = new System.Drawing.Point(, );
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(, );
this.groupBox2.TabIndex = ;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "保存到";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(, );
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(, );
this.label6.TabIndex = ;
this.label6.Text = "%";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(, );
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(, );
this.label5.TabIndex = ;
this.label5.Text = "%";
//
// cbQualityRate
//
this.cbQualityRate.FormattingEnabled = true;
this.cbQualityRate.Items.AddRange(new object[] {
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
""});
this.cbQualityRate.Location = new System.Drawing.Point(, );
this.cbQualityRate.Name = "cbQualityRate";
this.cbQualityRate.Size = new System.Drawing.Size(, );
this.cbQualityRate.TabIndex = ;
//
// cbSizeRate
//
this.cbSizeRate.FormattingEnabled = true;
this.cbSizeRate.Items.AddRange(new object[] {
"",
"",
"",
"",
"",
"",
"",
"",
"",
""});
this.cbSizeRate.Location = new System.Drawing.Point(, );
this.cbSizeRate.Name = "cbSizeRate";
this.cbSizeRate.Size = new System.Drawing.Size(, );
this.cbSizeRate.TabIndex = ;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(, );
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(, );
this.label4.TabIndex = ;
this.label4.Text = "压缩质量:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(, );
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(, );
this.label3.TabIndex = ;
this.label3.Text = "压缩大小:";
//
// lvResultList
//
this.lvResultList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.压缩文件,
this.压缩结果});
this.lvResultList.FullRowSelect = true;
this.lvResultList.GridLines = true;
this.lvResultList.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.lvResultList.Location = new System.Drawing.Point(, );
this.lvResultList.MultiSelect = false;
this.lvResultList.Name = "lvResultList";
this.lvResultList.Size = new System.Drawing.Size(, );
this.lvResultList.TabIndex = ;
this.lvResultList.UseCompatibleStateImageBehavior = false;
this.lvResultList.View = System.Windows.Forms.View.Details;
//
// 压缩文件
//
this.压缩文件.Text = "压缩文件";
this.压缩文件.Width = ;
//
// 压缩结果
//
this.压缩结果.Text = "压缩结果";
this.压缩结果.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.压缩结果.Width = ;
//
// btnSelectTargetFolder
//
this.btnSelectTargetFolder.Location = new System.Drawing.Point(, );
this.btnSelectTargetFolder.Name = "btnSelectTargetFolder";
this.btnSelectTargetFolder.Size = new System.Drawing.Size(, );
this.btnSelectTargetFolder.TabIndex = ;
this.btnSelectTargetFolder.Text = "浏览";
this.btnSelectTargetFolder.UseVisualStyleBackColor = true;
this.btnSelectTargetFolder.Click += new System.EventHandler(this.btnSelectTargetFolder_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(, );
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(, );
this.label2.TabIndex = ;
this.label2.Text = "选择文件夹";
//
// tbTargetFolderPath
//
this.tbTargetFolderPath.Location = new System.Drawing.Point(, );
this.tbTargetFolderPath.Name = "tbTargetFolderPath";
this.tbTargetFolderPath.Size = new System.Drawing.Size(, );
this.tbTargetFolderPath.TabIndex = ;
//
// lbInfomation
//
this.lbInfomation.AutoSize = true;
this.lbInfomation.Location = new System.Drawing.Point(, );
this.lbInfomation.Name = "lbInfomation";
this.lbInfomation.Size = new System.Drawing.Size(, );
this.lbInfomation.TabIndex = ;
this.lbInfomation.Text = "已经停止";
//
// btnClose
//
this.btnClose.Location = new System.Drawing.Point(, );
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(, );
this.btnClose.TabIndex = ;
this.btnClose.Text = "关闭";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// btnStart
//
this.btnStart.Location = new System.Drawing.Point(, );
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(, );
this.btnStart.TabIndex = ;
this.btnStart.Text = "开始压缩";
this.btnStart.UseVisualStyleBackColor = true;
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(, );
this.Controls.Add(this.btnStart);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.lbInfomation);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "MainForm";
this.Text = "图片批量压缩";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout(); } #endregion private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox tbSourceFolderPath;
private System.Windows.Forms.Button btnSelectSourceFolder;
private System.Windows.Forms.Button btnSelectTargetFolder;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox tbTargetFolderPath;
private System.Windows.Forms.ListView lvSourceFolderList;
private System.Windows.Forms.ListView lvResultList;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.ComboBox cbQualityRate;
private System.Windows.Forms.ComboBox cbSizeRate;
private System.Windows.Forms.Label lbInfomation;
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader 压缩文件;
private System.Windows.Forms.ColumnHeader 压缩结果;
private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog; }
}

后台代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.IO;
using System.Threading;
using System.Drawing.Imaging; namespace ImageCompact
{
public partial class MainForm : Form
{
/// <summary>
/// 定义文件列表
/// </summary>
private IList<string> imageList = new List<string>();
/// <summary>
/// 压缩结果信息
/// </summary>
/// <param name="file"></param>
/// <param name="result"></param>
private delegate void DelegateWriteResult(string file, bool result);
/// <summary>
/// 压缩状态信息
/// </summary>
/// <param name="message"></param>
private delegate void DelegateWriteMessage(string message);
public MainForm()
{
InitializeComponent(); //压缩大小默认显示选项
cbSizeRate.SelectedIndex = ;
//压缩质量默认显示选项
cbQualityRate.SelectedIndex = ; RegistryKey folders;
folders = OpenRegistryPath(Registry.CurrentUser, @"\software\microsoft\windows\currentversion\explorer\shell folders");
//保存的选择文件夹默认路径
tbTargetFolderPath.Text = folders.GetValue("Desktop").ToString(); } /// <summary>
/// 获得注册表键对象
/// </summary>
/// <returns></returns>
private RegistryKey OpenRegistryPath(RegistryKey root, string s)
{
s = s.Remove(, ) + @"\";
while (s.IndexOf(@"\") != -)
{
root = root.OpenSubKey(s.Substring(, s.IndexOf(@"\")));
s = s.Remove(, s.IndexOf(@"\") + );
}
return root;
}
/// <summary>
/// 浏览选择文件夹
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSelectSourceFolder_Click(object sender, EventArgs e)
{
if (DialogResult.OK == folderBrowserDialog.ShowDialog())
{
this.lvSourceFolderList.Items.Clear();
tbSourceFolderPath.Text = folderBrowserDialog.SelectedPath;
ListFiles(new DirectoryInfo(tbSourceFolderPath.Text));
}
} /// <summary>
/// 遍历文件
/// </summary>
/// <param name="info"></param>
public void ListFiles(FileSystemInfo info)
{
if (!info.Exists) return;
DirectoryInfo dir = info as DirectoryInfo;
if (dir == null) return;
FileSystemInfo[] files = dir.GetFileSystemInfos();
for (int i = ; i < files.Length; i++)
{
FileInfo file = files[i] as FileInfo;
if (file != null && file.Name.Trim().LastIndexOf(".") > -)
{
if (file.Name.Substring(file.Name.LastIndexOf(".")).ToUpper() == ".JPG")
{
this.lvSourceFolderList.Items.Add(file.FullName);
imageList.Add(file.FullName);
}
}
else
{
ListFiles(files[i]); //对于子目录,进行递归调用
}
}
} /// <summary>
/// 将文件列表加载到list中
/// </summary>
/// <param name="path"></param>
//private void ScanFolder(string path)
//{
// imageList = new List<string>();
// string[] images = Directory.GetFiles(path, "*.bmp");
// for (int i = 0; i < images.Length; i++)
// {
// imageList.Add(images[i]);
// }
// images = Directory.GetFiles(path, "*.png");
// for (int i = 0; i < images.Length; i++)
// {
// imageList.Add(images[i]);
// }
// images = Directory.GetFiles(path, "*.jpg");
// for (int i = 0; i < images.Length; i++)
// {
// imageList.Add(images[i]);
// } // if (imageList.Count > 0)
// {
// ListFiles();
// }
//}
/// <summary>
/// 加载文件列表到listview
/// </summary>
private void ListFiles()
{
lvSourceFolderList.Items.Clear();
foreach (string item in imageList)
{
lvSourceFolderList.Items.Add(item);
}
}
/// <summary>
/// 保存到文件路径 的 选择文件夹
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSelectTargetFolder_Click(object sender, EventArgs e)
{
if (DialogResult.OK == folderBrowserDialog.ShowDialog())
{
tbTargetFolderPath.Text = folderBrowserDialog.SelectedPath;
}
}
/// <summary>
/// 退出
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnClose_Click(object sender, EventArgs e)
{
Application.Exit();
}
/// <summary>
/// 开始压缩
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnStart_Click(object sender, EventArgs e)
{
if (!Directory.Exists(tbTargetFolderPath.Text))
{
MessageBox.Show("目标文件夹不存在,请先建立这个文件夹。", "存储错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
if (Directory.GetFiles(tbTargetFolderPath.Text).Length > )
{
if (DialogResult.OK != MessageBox.Show("目标文件夹不是空的,同名文件将被覆盖,确认?", "目标文件夹不是空的", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
{
return;
}
}
lvResultList.Items.Clear();
Thread workThread = new Thread(new ThreadStart(CompressAll));
workThread.IsBackground = true;
workThread.Start();
} /// <summary>
/// 压缩所有文件
/// </summary>
private void CompressAll()
{
string message = "";
foreach (string item in imageList)
{
int index = item.LastIndexOf("\\");
if (index != -)
{
string fileName = item.Substring(index + ); string targetFilePath = tbTargetFolderPath.Text + "\\" + fileName; message = "正在处理" + fileName;
if (this.InvokeRequired)
{
this.Invoke(new DelegateWriteMessage(WriteMessage), new object[] { message });
}
else
{
this.WriteMessage(message);
} if (CompressPicture(item, targetFilePath))
{
if (this.InvokeRequired)
{
this.Invoke(new DelegateWriteResult(WriteResult), new object[] { item, true });
}
else
{
this.WriteResult(item, true);
}
}
else
{
if (this.InvokeRequired)
{
this.Invoke(new DelegateWriteResult(WriteResult), new object[] { item, false });
}
else
{
this.WriteResult(item, false);
}
}
}
} message = "全部完成";
if (this.InvokeRequired)
{
this.Invoke(new DelegateWriteMessage(WriteMessage), new object[] { message });
}
else
{
this.WriteMessage(message);
}
}
/// <summary>
/// 显示状态信息
/// </summary>
/// <param name="message"></param>
private void WriteMessage(string message)
{
lbInfomation.Text = message;
}
/// <summary>
/// 显示压缩结果信息
/// </summary>
/// <param name="fileName"></param>
/// <param name="result"></param>
private void WriteResult(string fileName, bool result)
{
if (result)
{
ListViewItem thisListItem = new ListViewItem();
thisListItem.ForeColor = Color.White;
thisListItem.BackColor = Color.DarkGreen;
thisListItem.SubItems[].Text = fileName;
thisListItem.SubItems.Add("成功");
lvResultList.Items.Add(thisListItem);
}
else
{
ListViewItem thisListItem = new ListViewItem();
thisListItem.ForeColor = Color.White;
thisListItem.BackColor = Color.Red;
thisListItem.SubItems[].Text = fileName;
thisListItem.SubItems.Add("失败");
lvResultList.Items.Add(thisListItem);
}
} /// <summary>
/// 压缩图片方法
/// </summary>
/// <param name="sourcePath">原目录</param>
/// <param name="targetPath">目标目录</param>
/// <returns>压缩是否成功</returns>
private bool CompressPicture(string sourcePath, string targetPath)
{
try
{
double sizeRate = double.Parse(cbSizeRate.Text) / ;// 大小比率
int qualityRate = int.Parse(cbQualityRate.Text);// 品质比率 Image sourceImage = Image.FromFile(sourcePath);
//调整图片大小
Bitmap bmp = new Bitmap(sourceImage, new Size((int)(sourceImage.Width * sizeRate), (int)(sourceImage.Height * sizeRate)));
//压缩图片
SaveAsJPEG(bmp, targetPath, qualityRate); GC.Collect();
return true;
}
catch
{
return false;
}
}
/// <summary>
/// 保存为JPEG格式,支持压缩质量选项
/// </summary>
/// <param name="bmp">原始位图</param>
/// <param name="FileName">新文件地址</param>
/// <param name="Qty">压缩质量,越大越好,文件也越大(0-100)</param>
/// <returns>成功标志</returns>
public static bool SaveAsJPEG(Bitmap bmp, string FileName, int Qty)
{
try
{
EncoderParameter p;
EncoderParameters ps; ps = new EncoderParameters(); p = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, Qty);
ps.Param[] = p; bmp.Save(FileName, GetCodecInfo("image/jpeg"), ps); return true;
}
catch
{
return false;
}
} /// <summary>
/// 保存JPG时用
/// </summary>
/// <param name="mimeType"></param>
/// <returns>得到指定mimeType的ImageCodecInfo</returns>
private static ImageCodecInfo GetCodecInfo(string mimeType)
{
ImageCodecInfo[] CodecInfo = ImageCodecInfo.GetImageEncoders();
foreach (ImageCodecInfo ici in CodecInfo)
{
if (ici.MimeType == mimeType) return ici;
}
return null;
}
}
}

Winform文件夹图片批量压缩整理修改的更多相关文章

  1. python之对指定目录文件夹的批量重命名

    python之对指定目录文件夹的批量重命名 import os,shutil,string dir = "/Users/lee0oo0/Documents/python/test" ...

  2. (WinForm)文件夹状态监控,最小化到托盘,开机自启动

    原文 (WinForm)文件夹状态监控,最小化到托盘,开机自启动 . 文件夾監控(監測文件夾中的文件動態): //MSDN上的例子 public class Watcher { public stat ...

  3. Python小代码_15_遍历指定路径下的所有文件和文件夹,并格式化输出文件路径文件名和文件夹名,文件大小,修改时间

    遍历指定路径下的所有文件和文件夹,并格式化输出文件路径文件名和文件夹名,文件大小,修改时间 import osimport datetime def print_tree(dir_path): for ...

  4. Python 写了一个批量生成文件夹和批量重命名的工具

    Python 写了一个批量生成文件夹和批量重命名的工具 目录 Python 写了一个批量生成文件夹和批量重命名的工具 演示 功能 1. 可以读取excel内容,使用excel单元格内容进行新建文件夹, ...

  5. python3_learn 实现文件夹内批量对图片重命名

    初衷 练习Python,提高动手能力. 珍藏的壁纸文件夹名命有点乱. 可以学习下一些基础的库 开始(.jpg,无筛选) First 首先找到OS库,寻找可以遍历文件名的.找到了OS.walk() os ...

  6. 命令行方式调用winrar对文件夹进行zip压缩示例代码

    调用winRAR进行压缩 using System; using System.Collections.Generic; using System.Linq; using System.Text; u ...

  7. iOS-iOS 获取蓝色文件夹图片

    Xcode创建的iOS项目内存在两种文件夹:Group(黄色, 伪文件夹) 和Folder(蓝色, 真文件夹): Group: Folder: Images.xcassets或Group文件夹内的PN ...

  8. PHP实现图片批量压缩

    set_time_limit(0); global $source_dir; global $target_dir; $source_dir = "D:/images/";//目标 ...

  9. C#合并文件夹图片列表 自定义排版顺序

    本次程序编写主要为了将pdf word等文档转换为图片后设置不同的打印排版 前提 目标文件夹中的图片高宽都是一致的 /// <summary> /// 合并图片 /// </summ ...

随机推荐

  1. 监听器(web基础学习笔记二十二)

    一.监听器 监听器是一个专门用于对其他对象身上发生的事件或状态改变进行监听和相应处理的对象,当被监视的对象发生情况时,立即采取相应的行动.监听器其实就是一个实现特定接口的普通java程序,这个程序专门 ...

  2. request.getSession().setAttribute(&quot;&quot;,..)和request.setAttribute(&quot;&quot;,...)的差别

    request.getSession.setAttribute()是获得当前会话的session,然后再setAttribute到session里面去,有效范围是session而不是request. ...

  3. oracle 建表时显示ORA-00984: 列在此处不允许

      oracle 建表时显示ORA-00984: 列在此处不允许 CreationTime--2018年7月19日16点10分 Author:Marydon 1.情景展示 使用plsql建表时,报错 ...

  4. maven POM.xml内的标签大全详解

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  5. 12、static final

    Java中修饰常量用static final 用static final同时修饰的变量只能是成员变量而不能是局部变量 初始化: ①:定义时赋值 ②:静态代码块static{}中赋值 static 和 ...

  6. SET GLOBAL FOREIGN_KEY_CHECKS取消外键约束

    今天在工作中遇到的问题,在删除一个表时报错,发现有外键约束,所以不能删除,查了下发现需要取消外键约束. SET GLOBAL FOREIGN_KEY_CHECKS=0;全局取消外键约束 SET SES ...

  7. LoadRunner如何监控Linux系统资源

    LoadRunner如何监控Linux系统资源 一 简述:LoadRunner监控Linux资源时弹出如下错误: Monitor name :UNIX Resources. Cannot initia ...

  8. 微信小程序--搜索关键词高亮

    代码地址如下:http://www.demodashi.com/demo/14249.html 一.前期准备工作 软件环境:微信开发者工具 官方下载地址:https://mp.weixin.qq.co ...

  9. java 快速求素数

    package test ; import java.util.Scanner ; public class hello { public static void main(String [] arg ...

  10. HDUOJ-----(1329)Calling Extraterrestrial Intelligence Again

    Calling Extraterrestrial Intelligence Again Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: ...