首页
畅所欲言
友情链接
壁纸大全
数据统计
推荐
工具箱
在线白板
Search
1
职教云小助手重构更新,职教云助手最新版下载地址【已和谐】
13,544 阅读
2
职教云-智慧职教,网课观看分析(秒刷网课)
11,095 阅读
3
gradle-5.4.1-all.zip下载
9,058 阅读
4
职教云-智慧职教,签到补签分析(逆天改命系列)
7,927 阅读
5
一个优秀的程序员从写文档开始:免费领14个月语雀云笔记会员
6,908 阅读
学习笔记
Web
Python
转载文章
算法刷题
JS逆向
综合笔记
安卓
物联网
Java
C
资源收集
软件收藏
网络资源
影视专辑
TED英语角
随便写写
随手拍
登录
/
注册
Search
Lan
累计撰写
626
篇文章
累计收到
624
条评论
首页
栏目
学习笔记
Web
Python
转载文章
算法刷题
JS逆向
综合笔记
安卓
物联网
Java
C
资源收集
软件收藏
网络资源
影视专辑
TED英语角
随便写写
随手拍
页面
畅所欲言
友情链接
壁纸大全
数据统计
推荐
工具箱
在线白板
搜索到
65
篇与
的结果
2020-07-07
Windows子系统之Ubuntu装Python,pip
刚刚突然想起Windows似乎可以装Linux子系统了,于是想着装一个试试看的态度,然后选择了Ubuntu下载速度其快,下载完第一件事当然是安装Python,sudo apt install python3事情一切都很顺利。但是发现pip似乎装不了然后就换源到了阿里:deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse再将更新软件源sudo apt-get update成功解决
2020年07月07日
750 阅读
0 评论
0 点赞
2020-07-04
GitHub无法显示图片
修改Host文件,添加# GitHub Start 140.82.113.3 github.com140.82.114.20 gist.github.com151.101.184.133 assets-cdn.github.com151.101.184.133 raw.githubusercontent.com151.101.184.133 gist.githubusercontent.com151.101.184.133 cloud.githubusercontent.com151.101.184.133 camo.githubusercontent.com151.101.184.133 avatars0.githubusercontent.com199.232.68.133 avatars0.githubusercontent.com199.232.28.133 avatars1.githubusercontent.com151.101.184.133 avatars1.githubusercontent.com151.101.184.133 avatars2.githubusercontent.com199.232.28.133 avatars2.githubusercontent.com151.101.184.133 avatars3.githubusercontent.com199.232.68.133 avatars3.githubusercontent.com151.101.184.133 avatars4.githubusercontent.com199.232.68.133 avatars4.githubusercontent.com151.101.184.133 avatars5.githubusercontent.com199.232.68.133 avatars5.githubusercontent.com151.101.184.133 avatars6.githubusercontent.com199.232.68.133 avatars6.githubusercontent.com151.101.184.133 avatars7.githubusercontent.com199.232.68.133 avatars7.githubusercontent.com151.101.184.133 avatars8.githubusercontent.com199.232.68.133 avatars8.githubusercontent.com# GitHub End
2020年07月04日
144 阅读
0 评论
0 点赞
2020-06-08
C# DBhelpMySQL代码 MysqlDBhelp类代码
这段时间开发用的一直是MySQL,虽然教的是SQLserver,但是都差不多,这里做个笔记。using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using MySql.Data.MySqlClient; namespace LanFilmSystem { class DBHelpMysql { //数据库链接字符串 public static string ConnetStr = "server=;port=3306;user=;password=;database="; //数据库链接对象 public static MySqlConnection Conn = new MySqlConnection(ConnetStr); // 初始化数据库链接 public static void InitConnection() { // 如果链接对象不存在,则打开链接 if (Conn == null) { Conn = new MySqlConnection(ConnetStr); } // 如果链接对象关闭,则打开链接 if (Conn.State == System.Data.ConnectionState.Closed) { Conn.Open(); } // 如果链接中断,则重启链接 if (Conn.State == System.Data.ConnectionState.Broken) { Conn.Close(); Conn.Open(); } } // 查询,获取DataReader public static MySqlDataReader GetDataReader(string SqlStr) { InitConnection(); MySqlCommand cmd = new MySqlCommand(SqlStr, Conn); // CommandBehavior.CloseConnection 命令行为,当DataReader对象被关闭时,自动关闭 // 占用的链接对象 return cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection); } // 查询表 public static MySqlDataAdapter GetAllInfo(string SqlStr) { InitConnection(); MySqlCommand cmd = new MySqlCommand(SqlStr, Conn); MySqlDataAdapter da = new MySqlDataAdapter(cmd); return da; } //增、删、改操作 public static bool ExecuteNonQuery(string sqlStr) { InitConnection(); MySqlCommand cmd = new MySqlCommand(sqlStr, Conn); int result = cmd.ExecuteNonQuery(); Conn.Close(); return result > 0; } // 执行集合函数 public static object ExecuteScalar(string sqlStr) { InitConnection(); MySqlCommand cmd = new MySqlCommand(sqlStr, Conn); object result = cmd.ExecuteScalar(); Conn.Close(); return result; } } }
2020年06月08日
1,844 阅读
1 评论
1 点赞
2020-06-07
Winform开发笔记之不重复打开MDI子窗口。
昨天发现切换子窗口会出现闪屏等情况,而且还有点延迟,造成卡顿这样子,今早灵光一现,会不会是重复打开了,因为我之前都是直接填充整个父窗口,所以看不到,然后我就取消了Fill,发现还真的是这样,于是百度找了一下,解决方案,然后在CSDN看到了一篇文章,解决了我的问题。需求描述:在MDI窗体中,子窗体只能被打开一次,如果已有窗体不会在重新创建窗体对象1 窗体的创建(1)创建mdi窗体:新建窗体将其名称更改为FormMain,属性IsMdiContainer设置为true(2)创建子窗体1:新建窗体将其名称更改为childForm1(3)创建子窗体1:新建窗体将其名称更改为childForm2(4)增加菜单项tsmi_singleMode,其Text属性设置为单例模式子窗体(5)增加菜单项tsmi_application,其Text属性设置为函数模式子窗体(6)增加菜单项tsmi_foreach,其Text属性设置为函数模式子窗体界面如下:2 单例模式的实现(1)在子窗体1中将其构造函数改成private;添加静态成员和静态变量//私有构造函数 private childForm1() { InitializeComponent(); } //私有静态类类型的成员变量 private static childForm1 inquire = null; //公有静态类型成员函数 public static childForm1 GetWindows() { if (inquire == null && inquire.IsDisposed) { inquire = new childForm1(); } return inquire; }(2)父窗体MDI中的为tsmi_singleMode按钮添加Click事件: private void tsmi_singleMode_Click(object sender, EventArgs e) { childForm1 cf1 = childForm1.GetWindows(); cf1.MdiParent = this; cf1.Show(); }3 函数模式之Application.OpenForms实现使用Application.OpenForms来判断是否创建新的子窗体//使用Application搜集已经打开的子窗体;若找不到就创建;找到则显示 private void tsmi_application_Click(object sender, EventArgs e) { foreach (Form frm in Application.OpenForms) { if (frm is ChildForm2) { frm.Activate(); frm.WindowState = FormWindowState.Normal; return; } } ChildForm2 youForm = new ChildForm2(); youForm.MdiParent = this; youForm.Show(); }4 函数模式实现之遍历this.MdiChildren子窗体实现定义判断函数 private void OpenChildForm(Form formChild)//formChild只是是实例化的但既没有设置为父窗体的子窗体也没有显示 { bool isOpened = false; foreach (Form form in this.MdiChildren) { //如果要显示的子窗体已经在父窗体的子窗体数组数组中,我们就把新建的多余的formChild销毁 if (formChild.Name == form.Name) { form.Activate();//既然我们想新建但已经有了,那就把之前存在的激活并调到最前边来 form.WindowState = FormWindowState.Normal;//窗口大小 为窗口模式 formChild.Dispose(); isOpened = true;//表示窗口已经打开 break; } } if (!isOpened)//如果没打开 { formChild.MdiParent = this;//设置为子窗体 formChild.Show(); } }添加点击事件private void tmsi_foreach_Click(object sender, EventArgs e) { childForm3 cf3 = new childForm3(); cf3.Name = "childForm3"; OpenChildForm(cf3); }5 总结列举了三种实现方式,第一种将类定义为私有构造函数、私有静态成员和公有静态成员的单例模式来实现;方法二遍历Application.OpenForms判断子窗体是否打开;方法三,遍历this.MdiChildren判断子窗体是否存在原文链接:https://blog.csdn.net/m1m2m3mmm/article/details/90551875
2020年06月07日
981 阅读
0 评论
0 点赞
2020-06-07
Winform开发笔记之菜单栏切换窗口会闪屏、闪烁
发现的情况如图:经过百度,找到的解决方案如下:将此代码写在要解决闪烁问题的父窗体中:protected override CreateParams CreateParams { get { CreateParams cp = base.CreateParams; cp.ExStyle |= 0x02000000; return cp; } }最后成功解决。
2020年06月07日
980 阅读
0 评论
0 点赞
2020-06-05
C# 可视化程序设计机试知识点汇总,DBhelper类代码
打开窗体HotelType ht = new HotelType(); ht.Show();//非模式窗体 ht.ShowDialog();//模式窗体在父窗体中打开子窗体HotelType ht = new HotelType(); ht.MdiParent = this; ht.Show();//非模式窗体 ht.ShowDialog();//模式窗体退出系统Application.Exit();清空文本框两种方式 this.TextBox.clear(); this.TextBox.text=””;窗体加载时查询绑定到DataGridView控件中(Load事件,查询)//定义SQL语句 string sql1 = "select * from RoomType"; //调用DBHelper类的查询方法,返回DataTable类型数据 DataTable dt = DBHelper.getDataTable(sql1); //将返回的结果绑定到DataGridView控件的数据源中 this.dataGridView1.DataSource = dt;数据中查出数据绑定到DataGridView控件中(Load事件,查询,给下拉框赋值)//定义SQL语句 string sql1 = "select * from RoomType"; //调用DBHelper类的查询方法,返回DataTable类型数据 DataTable dt = DBHelper.getDataTable(sql1); // DisplayMember为显示的文本值,ValueMember为真实的值一般为主键 this.comboBox1.DisplayMember = "typeName"; this.comboBox1.ValueMember = "typeID" //将返回的结果绑定到DataGridView控件中 this.comboBox1.DataSource = dt;根据条件查询并重新绑定到DataGridView控件中(点击查询按钮,模糊查询)一、单条件模糊查询 //获得界面上输入的查询的条件 string typeName = this.textBox1.Text; //定义包含查询条件的sql语句 string sql = string.Format("select * from RoomType where TypeName like '%{0}%'", typeName); //调用DBHelper类的查询方法,返回DataTable类型数据 DataTable dt = DBHelper.getDataTable(sql); //将返回的结果绑定到DataGridView控件中 this.dataGridView1.DataSource = dt; 二、多条件模糊查询(eg:按名称模糊查询,按日期查询)//获得界面上输入的查询的条件 string typeName = this.textBox1.Text; string dateValue= this.textBox2.Text; //定义包含查询条件的sql语句 string sql = string.Format("select * from RoomType where 1=1"); if(typeName!=””){ sql +=” and TypeName like '%”+ money1 +”%'” ; } if(dateValue!=””){ sql +=” and dateValue = '”+ dateValue +” '” ; } //调用DBHelper类的查询方法,返回DataTable类型数据 DataTable dt = DBHelper.getDataTable(sql); //将返回的结果绑定到DataGridView控件中 this.dataGridView1.DataSource = dt; 选中DataGridView中的行,将所有列的数据一个个放入到文本控件中(cellClick事件)。//在cellClick事件外定义typeID string typeID; //判断选中的行数是否>0 if (this.dataGridView1.SelectedRows.Count>0) { //”=”号左边给全局变量typeID赋值, ”=”号右边获得选中第一行第一列的值转为string类型(列标号以数据库中的顺序为准) typeID = this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); //”=”号左边给文本框赋值, ”=”号右边获得选中第一行第二列的值转为string类型 this.textBox2.Text = this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); //”=”号定义变量接收, ”=”号右边获得选中第一行第三列的值转为string类型(根据值选中复选框) string IsAddBed = this.dataGridView1.SelectedRows[0].Cells[2].Value.ToString(); //去掉变量中isAddBed数据中的空格 IsAddBed = IsAddBed.Trim(); //如果IsAddBed的内容是等于”是“,就选中复选框,否则不选中 if (IsAddBed=="是"){ this.checkBox1.Checked = true; }else{ this.checkBox1.Checked = false; } //”=”号定义变量接收, ”=”号右边获得选中第一行第四列的值转为string类型(根据值选中单选按钮) string radioButton= this.dataGridView1.SelectedRows[0].Cells[3].Value.ToString(); //如果radioButton的内容是等于”男“,就选中所对应的单选按钮 if (IsAddBed=="男"){ this.radioButton1.Checked = true; } //如果radioButton的内容等于”女“,就选中所对应的单选按钮 if (IsAddBed=="女"){ this.radioButton1.Checked = true; } }添加(click事件) 第一步、获取值//(获得文本框的值) string TypeName = this.textBox2.Text; //(判断复选框是否选中)选中了给IsAddBed赋值为”是“,否则为”否“ string IsAddBed = ""; if (this.checkBox1.Checked) { IsAddBed = "是"; }else{ IsAddBed = "否"; } //(判断单选按钮是否选中)如果男性单选按钮选中了,给sex赋值为”男“,否则为”女“ string sex = ""; if (this.radioButton1.Checked) { sex = "男"; } If(this.radioButton2.Checked){ sex = "女"; } //(获取下拉框中选中的value值) string index= this.comboBox1.SelectedValue.ToString(); //(获得下拉框中选中的文本值) string gender = this.comboBox1.text; 第二步、为空判断if (TypeName==""|| IsAddBed ==""|| sex ==""|| gender =="") { MessageBox.Show("信息填写不完整,请重新填写!"); //返回 return; } 第三步、定义sql语句string sql = string.Format("insert into RoomType values('{0}','{1}','{2}','{3}','{4}')", TypeName, TypePrice, AddBedPrice, IsAddBed, Remark); 第四步、调用dbhelper类增删改方法int result = DBHelper.Zsg(sql); 第五步、判断执行结果if (result>0) { MessageBox.Show("添加成功!"); } else { MessageBox.Show("添加失败!"); }修改(click事件)第一步、获取值//(获得文本框的值) string TypeName = this.textBox2.Text; //(判断复选框是否选中)选中了给IsAddBed赋值为”是“,否则为”否“ string IsAddBed = ""; if (this.checkBox1.Checked) { IsAddBed = "是"; }else{ IsAddBed = "否"; } //(判断单选按钮是否选中)如果男性单选按钮选中了,给sex赋值为”男“,否则为”女“ string sex = ""; if (this.radioButton1.Checked) { sex = "男"; } If(this.radioButton2.Checked){ sex = "女"; } //(获取下拉框中选中的value值) string index= this.comboBox1.SelectedValue.ToString(); //(获得下拉框中选中的文本值) string gender = this.comboBox1.text; 第二步、为空判断if (TypeName==""|| IsAddBed ==""|| sex ==""|| gender =="") { MessageBox.Show("信息填写不完整,请重新填写!"); //返回 return; } 第三步、定义sql语句(根据typeId修改)//(typeID是全局变量,从DataGridView控件的cellClick事件中获取选中的隐藏的类型ID) string sql = string.Format("update RoomType set TypeName='{0}',TypePrice='{1}',AddBedPrice='{2}',IsAddBed='{3}',Remark='{4}' where TypeID='{5}'", TypeName, TypePrice, AddBedPrice, IsAddBed, Remark, typeID); 第四步、调用dbhelper类增删改方法 int result = DBHelper.Zsg(sql); 第五步、判断执行结果 if (result>0) { MessageBox.Show("修改成功!"); //这个是刷新DataGridView列表 string sql1 = "select * from RoomType"; DataTable dt = DBHelper.getDataTable(sql1); this.dataGridView1.DataSource = dt; } else { MessageBox.Show("修改失败!"); }删除(Click事件)//定义sql语句(typeID是全局变量,从DataGridView控件的cellClick事件中获取选中的隐藏的类型ID) string sql = string.Format("delete from RoomType where TypeID='{0}'", typeID); //调用dbhelper类增删改方法 int result = DBHelper.Zsg(sql); //判断执行结果 if (result > 0) { MessageBox.Show("删除成功!"); //这个是刷新DataGridView列表 string sql1 = "select * from RoomType"; DataTable dt = DBHelper.getDataTable(sql1); this.dataGridView1.DataSource = dt; } else { MessageBox.Show("删除失败!"); } 点击关闭时再次确定是否关闭(FormClosing事件)//弹出自定义对话框 DialogResult dr = MessageBox.Show("确定要关闭吗?","提示:",MessageBoxButtons.YesNo,MessageBoxIcon.Question); //判断用户点击哪个按钮 if (dr==DialogResult.Yes) { //如果用户选择了“是”,执行关闭 Application.Exit(); } else{ //如果用户选择了“否”,取消窗体关闭事件 e.Cancel = true; } 最后再来一个DBHelper类的笔记:using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GMP { class DBHelper { //数据库链接字符串 public static string ConnString = "server=.;database=;uid=;pwd="; //数据库链接对象 public static SqlConnection Conn = null; // 初始化数据库链接 public static void InitConnection() { // 如果链接对象不存在,则打开链接 if (Conn == null) { Conn = new SqlConnection(ConnString); } // 如果链接对象关闭,则打开链接 if (Conn.State == System.Data.ConnectionState.Closed) { Conn.Open(); } // 如果链接中断,则重启链接 if (Conn.State == System.Data.ConnectionState.Broken) { Conn.Close(); Conn.Open(); } } // 查询,获取DataReader public static SqlDataReader GetDataReader(string SqlStr) { InitConnection(); SqlCommand cmd = new SqlCommand(SqlStr, Conn); // CommandBehavior.CloseConnection 命令行为,当DataReader对象被关闭时,自动关闭 // 占用的链接对象 return cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection); } //增、删、改操作 public static bool ExecuteNonQuery(string sqlStr) { InitConnection(); SqlCommand cmd = new SqlCommand(sqlStr, Conn); int result = cmd.ExecuteNonQuery(); Conn.Close(); return result > 0; } // 执行集合函数 public static object ExecuteScalar(string sqlStr) { InitConnection(); SqlCommand cmd = new SqlCommand(sqlStr, Conn); object result = cmd.ExecuteScalar(); Conn.Close(); return result; } } }
2020年06月05日
1,021 阅读
0 评论
0 点赞
2020-05-28
记第一次用C#写Windows窗口应用,就一不小心写出来恶意代码
今天终于开始学C#可视化了,C#这方面一直都是跟着进度走,自己也没去自学啥的,所以对一切还是比较陌生的,然后就跟着走了。你以为这样就木有了吗?点击背景,就会改变颜色(哈哈,没啥技术含量)https://www.lanol.cn加了webBrowser组件之后,访问本博客提示脚本错误,经过百度加一句就可以解决了private void Form1_Load(object sender, EventArgs e) { # By: Lan webBrowser1.ScriptErrorsSuppressed = true; # 解决报错 webBrowser1.Navigate(" # 打开网址 }然后,我就看了下似乎点右上角的关闭符号,可以弹出一个信息框,选择是否关闭。他的代码是这样的。DialogResult result = MessageBox.Show("确定要关闭吗?","提示:",MessageBoxButtons.YesNo,MessageBoxIcon.Question); if (result == DialogResult.Yes){ # www.lanol.cn } else{ e.Cancel = true; }然后我就稍微改了一下然后变成了这样子。private void Form1_FormClosing(object sender, FormClosingEventArgs e) { MessageBox.Show("禁止"); e.Cancel = true; }成功的变成了一个流氓程序。除了任务管理器,也就只能关机重启才能关掉了。这里面还有一个彩蛋(静待有缘人)。MyFirstWinForm.zip大小:9kb已经过安全软件检测无毒,请您放心下载。
2020年05月28日
895 阅读
0 评论
0 点赞
1
...
7
8
9
10