• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
June's New World
知识和经验都是一点点积累的!现在努力也不晚,June加油!
博客园    首页    新随笔    联系   管理    订阅  订阅

随笔分类 -  .NET学习笔记

上一页 1 2 3 4 5 下一页
C#Winform中ToolTip的简单用法

摘要:ToolTip信息提示框的作用就不用说了吧,我也没去细研究,只是学习了一下怎么去用,简单记录一下:C#中提供了信息提示框,这有很多用处,可以提示控件或者用户自定义的属性信息,而且可以自动弹出或者用户指定弹出,也可以动画效果弹出。使用方法:①鼠标移动到控件或指定的位置自动显示:ToolTip.SetToolTip 方法 ,注意相关参数的设置。②动画效果:参数:AutoPopDelay InitialDelay ReshowDelay例如: // Create the ToolTip and associate with the Form container. ToolTip toolTip1 = 阅读全文
posted @ 2011-04-02 14:13 冬雨在路上 阅读(81257) 评论(19) 推荐(6)
Application--统计在线人数

摘要:Application最经典的一个方法:统计在线人数,这需要借助于我们的全局应用程序类来对登录的用户信息进行统计: void Application_Start(object sender, EventArgs e) { //在应用程序启动时运行的代码 Application["Count"] = 0; System.IO.FileStream fs = System.IO.File.Open(Server.MapPath("Count.txt"), System.IO.FileMode.OpenOrCreate); System.IO.StreamRe 阅读全文
posted @ 2011-03-28 16:32 冬雨在路上 阅读(2086) 评论(0) 推荐(0)
(转)c# winform 键盘按键控制操作移动控件,linkLabel,获取按键值,一个俄罗斯方块源码

摘要:调用start方法启动一个默认的Internet浏览器System.Diagnostics.Process.Start("http://www.baidu.com"); Form1 按键移动控件 C#代码using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace man100{ public parti 阅读全文
posted @ 2011-03-28 10:31 冬雨在路上 阅读(2357) 评论(0) 推荐(1)
DataList的使用+分页

摘要:datalist和repeater一样,都是根据自己的需要添加自己的模板,简单例子如下:前台代码如下:<body> <form id="form1" runat="server"> <div> <asp:DataList ID="DataList1" runat="server" DataKeyField="ID" RepeatDirection="Horizontal"> <ItemTemplate> <di 阅读全文
posted @ 2011-03-27 16:41 冬雨在路上 阅读(10074) 评论(2) 推荐(2)
winform中textbox提示框

摘要:在winform中向textbox输入内容时下面有提示信息,效果如图所示: private void Form1_Load(object sender, EventArgs e) { AutoCompleteStringCollection strings = new AutoCompleteStringCollection(); strings.Add("A1");//不区分大小写 strings.Add("A2"); strings.Add("Aas"); strings.Add("B1"); strings. 阅读全文
posted @ 2011-03-22 17:05 冬雨在路上 阅读(4184) 评论(20) 推荐(3)
C#重绘TabControl的Tabpage标签,添加图片及关闭按钮

摘要:以下就是C#重绘TabControl控件的源码:效果如同所示: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;namespace WindowsFormsApplication1.june{ public partial class TabTest : Form { public TabTest 阅读全文
posted @ 2011-03-15 17:01 冬雨在路上 阅读(30763) 评论(24) 推荐(5)
【转】C# 中的事件

摘要:事件类似于异常,因为它们都由对象引发。与异常的区别,没有与try...catch...finally类似的结构来处理事件,而必须订阅它们。订阅一个事件的含义是提供代码,在事件发生时候执行这些代码,它们称为事件处理程序。事件可以有许多订阅的处理程序,在该事件发生时候,这些处理程序都会被调用,其中包括引发该事件的对象所在的类的处理程序,但事件处理程序可能在其他类中。事件处理程序本身都是简单的函数。对事件处理程序函数的唯一的限制是它必须匹配事件所要求的签名(返回类型和参数)。这个签名是事件定义的一部分,有一个委托指定。代码Code highlighting produced by Actipro C 阅读全文
posted @ 2011-03-14 12:00 冬雨在路上 阅读(470) 评论(0) 推荐(0)
【转】数据库 事物的操作

摘要:进来对事物作一下总结,常用代码如下:view sourceprint?1--创建一个银行账户表 2create table bank1 3( 4id int identity(1,1) not null primary key, 5CurrentMoney int not null check(CurrentMoney >1), 6CurrentName nvarchar(10) 7)下面就是事物的操作:view sourceprint?01declare @sum int02set @sum =0 03begin tran 04update bank1 set CurrentMoney 阅读全文
posted @ 2011-03-14 11:03 冬雨在路上 阅读(320) 评论(0) 推荐(0)
C# Winform 中webBrowser显示html内容时禁止错误提示的方法

摘要:在winform中有一个控件可以显示html的内容,该控件就是webbrowser,设置它的DocumenText属性为HTML的内容即可。在使用WebBrowser做UI的时候,我们有时不希望里面的链接被用户点击,更不希望弹出烦人的脚本错误提示框,也不希望用户能点出右键的IE菜单,要做到这些,其实都是很easy地…//设置webBrowser webBrowser1.ScriptErrorsSuppressed = true; //禁用错误脚本提示 webBrowser1.IsWebBrowserContextMenuEnabled = false; //禁用右键菜单 webBrowser1 阅读全文
posted @ 2011-03-11 17:01 冬雨在路上 阅读(4457) 评论(1) 推荐(1)
[转] C# 路径(目录)

摘要:一、获取当前文件的路径1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName获取模块的完整路径,包括文件名。2. System.Environment.CurrentDirectory获取和设置当前目录(该进程从中启动的目录)的完全限定目录。3. System.IO.Directory.GetCurrentDirectory()获取应用程序的当前工作目录。这个不一定是程序从中启动的目录啊,有可能程序放在C:\www里,这个函数有可能返回C:\Documents and Settings\ZYB\,或者C:\Pr 阅读全文
posted @ 2011-03-09 09:52 冬雨在路上 阅读(604) 评论(0) 推荐(0)
NET学习总结----在winform中显示html内容

摘要:1.在winform中显示html内容:private void Test(){ WebBrowser w = new WebBrowser(); w.Parent = this; w.Dock = DockStyle.Fill; w.DocumentText = "<html><body><br><br><br>Please enter your name:<br/>" + "<input type='text' name='userName'/> 阅读全文
posted @ 2011-03-08 15:51 冬雨在路上 阅读(6816) 评论(0) 推荐(0)
最近写的简单的SQLHelper的类

摘要:using System;using System.Data;using System.Configuration;using System.Data.SqlClient;namespace DAL{ public class SQLHelper { public static SqlConnection conn = null; public static SqlCommand cmd = null; public static string connstr = ConfigurationManager.ConnectionStrings["connstr"].Conne 阅读全文
posted @ 2011-03-05 18:23 冬雨在路上 阅读(7239) 评论(1) 推荐(0)
LINQ TO XML练习

摘要:最近要用到LINQ,以前没用到过,进入linq的学习中............下面是我朋友给的练习using System;using System.Collections.Generic;using System.Linq;using System.Xml.Linq;using System.Text;namespace ConsoleApplication3{ class Program { static void Main(string[] args) { Dictionary<string, string> xDic = new Dictionary<string, 阅读全文
posted @ 2011-02-25 15:09 冬雨在路上 阅读(472) 评论(0) 推荐(0)
findcontrol()方法和repeater中的checkbox

摘要:今天要给repeater做上一个checkbox,然后能做到圈选反选,本来很简单的事,但是我发现了findcontrol方法的一个好的优点。前台绑定方法如下:asp:Repeater ID="Repeater1" runat="server" ItemTemplateasp:CheckBox ID="ch" runat="server" //ItemTemplate /asp:Repeater后台代码如下:foreach (Control c in this.Repeater1.Controls) { CheckBox check = (CheckBox)c.FindCo 阅读全文
posted @ 2010-12-14 12:43 冬雨在路上 阅读(3418) 评论(1) 推荐(0)
简单总结.NET中的各<% %>用法及区别

摘要:有时总是分不清<%... %>、<%#... %>、<%=... %>、<%@ %>到底有什么区别,最后在网上找了一下,便记录在此......①<% %>: 内联代码块里面可以在页面文件*.aspx或*.ascx文件里面嵌入后台代码如:<%Reaponse.Write("June");%>②<%# %>: 是在绑定... 阅读全文
posted @ 2010-12-02 09:59 冬雨在路上 阅读(335) 评论(0) 推荐(0)
asp.net获取URL和IP地址(转)

摘要:HttpContext.Current.Request.Url.ToString()并不可靠。如果当前URL为http://localhost/search.aspx?user=http://csharp.xdowns.com&tag=%BC%BC%CA%F5通过HttpContext.Current.Request.Url.ToString()获取到的却是http://localhost... 阅读全文
posted @ 2010-11-26 16:10 冬雨在路上 阅读(1849) 评论(0) 推荐(0)
在WEB里实现类似WinForm里的GroupBox

摘要:有时在web里要实现类似WinForm里的GroupBox,在网上找了很久都没找到好的解决方法,好不容易找到了,记录下来以后再用并和大家分享方法1:<fieldset> <legend>关于Silverlight</legend> <p> Silverlight是一个跨浏览器的、跨平台的插件,为网络带来下一代基于.NET的媒体体验和丰富的交互式应用程序。Silverlight提供灵活的编程模型,支持AJAX, VB, C#, Python, Ruby等语言,并集成到现有的网络应用程序中。Silverlight对运行在Mac或Windows上的主流 阅读全文
posted @ 2010-11-25 17:24 冬雨在路上 阅读(1918) 评论(0) 推荐(1)
ASP.NET根路径的获取和将Web站点下的绝对路径转换为虚拟路径的两种方案

摘要:ASP.NET 根路径的获取 private string _ApplicationPath; /// <summary> /// 虚拟应用程序根路径 /// </summary> public string ApplicationPath { get { _ApplicationPath = HttpContext.Current.Request.Appl... 阅读全文
posted @ 2010-11-23 17:16 冬雨在路上 阅读(14425) 评论(0) 推荐(2)
操作XML

摘要:读XML文件protected void Page_Load(object sender, EventArgs e) { XmlTextReader xmltextreader = new XmlTextReader(Server.MapPath("phonebook.xml")); string outMsg = ""; string currentNodeName = ""; int i = ... 阅读全文
posted @ 2010-11-23 17:01 冬雨在路上 阅读(408) 评论(0) 推荐(0)
ASP.NET母版页中调用内容页的方法和web用户控件调用.aspx页面里的方法

摘要:web用户控件调用.aspx页面里的方法今天做一个web用户控件里面有两个repeater一个是显示数据的,一个分页的。绑定数据部分我重写了绑定事件就搞定了。可是我是利用分页控件来控制repeater的数据,所以就用要到单击分页控件调用页面的绑定事件来重新去得不同页数的数据。在网上找了一下发现了以下这个方法。我在分页控件的ItemCommand事件中 protected void repCtrl_... 阅读全文
posted @ 2010-11-23 15:55 冬雨在路上 阅读(1741) 评论(1) 推荐(0)

上一页 1 2 3 4 5 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3