01 2013 档案
摘要:例1:<div style="width:100px; height:50px;"> <div style="float:left; width:50px; height:50px; background-color:blue"></div> <div style="float:left; width:50px; height:50px; background-color:red"></div> </div>例2:<div style="width
阅读全文
摘要:C#如果遇到图片文件被占用资源时无法删除或者修改不能使用以下方法调用图片//1Image img = Image.FromFile(path);//2pictureBox1.Image = Image.FromFile(path);//解决方法:应该使用如下函数将图片转换成数据流形式,再调用public Image GetImage(string path){ FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read); Image result = Image.FromStream(fs); ...
阅读全文
摘要:private void Form1_Load(object sender, EventArgs e) { this.MouseWheel += new MouseEventHandler(Form1_MouseWheel); } void Form1_MouseWheel(object sender, Mo...
阅读全文
摘要:可以用Control.MousePosition获得当前鼠标的坐标,使用PointToClient计算鼠标相对于某个控件的坐标,如下//鼠标相对于屏幕左上角的坐标Point screenPoint = Control.MousePosition;//鼠标相对于窗体左上角的坐标Point formPoint = this.PointToClient(Control.MousePosition);//鼠标相对于contextMenuStrip1左上角的坐标Point contextMenuPoint = contextMenuStrip1.PointToClient(Control.MousePo
阅读全文
摘要:1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Text; 7 using System.Windows.Forms; 8 9 namesp...
阅读全文
摘要:using System.IO; Path.GetDirectoryName(str);
阅读全文
摘要:View Code //使用方法:右键要打开的图片文件,打开方式-选择默认程序-浏览- pic.exe//Form1.csusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.IO;namespace pic{ public partial class Form1 : Form { p...
阅读全文
摘要:winform 中 TextBox 的 Multiline属性设置为 true ,敲入几个字符和几个回车,然后保存到数据库,再从数据库中读取出来赋值给TextBox,换行符丢失。将读取出的字符串中的"\n"替换为"\r\n"解决问题。1、TextBox 中换行符为: "\r\n"2、Windows 中的换行符(即:Environment.NewLine) 为 "\r\n"3、MessageBox.Show() 的换行符为 "\n"4、Console 的换行符为 "\n"从数据
阅读全文