随笔分类 -  C# .Net

摘要:一、思路 1.使用ScrollView的Scroll.ScrollToVerticalOffset(offset)方法进行滚动 2.ScrollView中放置2个ListView,第一个滚动出边界后,移除,然后再动态添加一个内容相同的ListView 3.ListView设置最小高度,以保证在内容不 阅读全文
posted @ 2019-07-28 22:34 朋克 阅读(1434) 评论(2) 推荐(0)
摘要:错误示范: 正确示范: 两者区别在于on条件中,第一个条件new的对象要加入字段名 阅读全文
posted @ 2019-04-23 22:42 朋克 阅读(872) 评论(0) 推荐(0)
摘要:有一个需求是DataGridView中不符合要求的行变为红色,这网上查到的代码是 Row.DefaultCellStyle.BackColor = Color.Red;即可 但是写完之后发现不起作用 经过不断尝试,将此代码放在Form的Activated方法中即可生效,但放在构造方法中是不起作用的 阅读全文
posted @ 2019-03-10 22:23 朋克 阅读(781) 评论(0) 推荐(0)
摘要:原因:自动生成的类中有关联主键,没有自动生成Key及Column 解决方法:在xxx.tt的66行左右修改为 阅读全文
posted @ 2017-10-11 22:08 朋克 阅读(239) 评论(0) 推荐(0)
摘要:public void DoMerge(string[] source) { Microsoft.Office.Interop.Excel.Application sourceApp = new Microsoft.Office.Interop.Excel.Application(); Workbo 阅读全文
posted @ 2016-11-09 22:07 朋克 阅读(1087) 评论(0) 推荐(0)
摘要:修改AssemblyInfo.cs 1.注释[assembly: AssemblyFileVersion("1.0.0.0")] 2.[assembly: AssemblyVersion("1.0.*")] 通过版本号可实现自动更新 阅读全文
posted @ 2016-02-27 22:59 朋克 阅读(1704) 评论(0) 推荐(0)
摘要:1.在nuget控制台中执行:Enable-Migrations2.将出现的configuation.cs文件中的AutomaticMigrationsEnabled属性改为true3.在nuget中执行Update-Database 阅读全文
posted @ 2015-11-23 23:29 朋克 阅读(190) 评论(0) 推荐(0)
摘要:1.View显示return View();默认为/Views//return View("Test");显示/View//Test.cshtmlreturn View("~/Views/AAAA/BBB.cshtml");显示/View/AAAA/BBB.cshtml 阅读全文
posted @ 2015-10-25 01:40 朋克 阅读(124) 评论(0) 推荐(0)
摘要:1.Inner Join(默认)var Goods = from goods in db.T_Goods join types in db.T_GoodsType on goods.GoodsType equals types.GoodsTypeID join priceinfo in db.T_P... 阅读全文
posted @ 2015-08-09 01:49 朋克 阅读(203) 评论(0) 推荐(0)
摘要:常用的调用方法为Get/PostGet方法:服务器public string Get(int id){ return "value";}这个直接在网页就可以测试,用 http://地址/api/xxx(Controller名,即xxxController的xxx部分)?id=x即可看到返回值调... 阅读全文
posted @ 2015-05-28 23:22 朋克 阅读(498) 评论(0) 推荐(0)
摘要:1.增加数据PirateBayEntities db = new PirateBayEntities();T_Tests test = new T_Tests();test.Name = "老李";test.Age = 20;db.T_Tests.Add(test);db.SaveChanges()... 阅读全文
posted @ 2015-05-24 22:25 朋克 阅读(335) 评论(0) 推荐(0)
摘要:1.添加项,选择ADO.NET实体数据模型2.选择从数据库生成3.建立数据库连接4.选择要关联的表点击完成,数据库已连接完毕,并生成了对应的Model 阅读全文
posted @ 2015-05-24 22:15 朋克 阅读(210) 评论(0) 推荐(0)
摘要:新建.net mvc api项目后,直接运行,默认会访问http://localhost:xxxx/Home/Index页面,这个页面不是要访问的API页面。从项目的目录可以看出,默认的API页面访问地址为http://localhost:xxxx/api/values目前返回的内容为xml格式,要... 阅读全文
posted @ 2015-05-24 02:14 朋克 阅读(207) 评论(0) 推荐(0)
摘要:1.清了C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files 2.给上述文件夹EveryOne和IIS_User完全控制权限 3.给C:\Windows\Temp文件夹IIS_User完全控制权限 阅读全文
posted @ 2015-04-07 22:31 朋克 阅读(343) 评论(0) 推荐(0)
摘要:1.Margin顺序:左上右下 阅读全文
posted @ 2015-03-08 21:49 朋克 阅读(110) 评论(0) 推荐(0)
摘要:OPC客户端操作主要有4个步骤:1.连接OPC服务器2.创建组和项3.读写数据4.断开服务器连接全部代码:View Code using System;using System.Collections.Generic;using System.Net;using System.Threading;using OPCAutomation;namespace ConsoleOPC{ public class OPCClient { private OPCServer KepServer; private OPCGroups KepGroups; ... 阅读全文
posted @ 2012-09-01 09:09 朋克 阅读(11246) 评论(7) 推荐(1)
摘要:症状:打开WINCE程序时,报错:数据存储中找不到关于指定平台的信息解决方法:新建一个WINCE程序,打开csproj文件,复制PlatFormID一项的值到要打开的csproj文件中替换原有PlatFormID即可参考:http://mengyihh.blog.163.com/blog/static/123503620100602219372/ 阅读全文
posted @ 2012-06-17 04:05 朋克 阅读(321) 评论(0) 推荐(0)
摘要:1.在windows程序下,可使用如下代码播放ResourceManager rm = new ResourceManager( "WindowsFormsApplication1.Form1" , Assembly.GetExecutingAssembly() ); SoundPlayer sndplayr = new SoundPlayer( rm.GetStream( "ErrorSound" ) );sndplayr.Play();其中WindowsFormsApplication1为命名空间,Form1为资源文件所在类,ErrorSound为声 阅读全文
posted @ 2011-04-29 12:02 朋克 阅读(1066) 评论(0) 推荐(0)