Tag: C#

  • C++ 中箭头操作符(->)和点操作符(.)的不同

    针对 -> 和 . 的定义区别如下: 如果 p 是指针,p -> function(); 如果 p 是对象和结构体,p.function(); 例如:

  • 全屏 WinForm C#

    by

    in

    下面是让程序全屏的代码,其实非常简单。去除窗体边框,运行最大化,最前方运行。 不过应用时需要注意控件的重新定位。 this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; this.TopMost = true;

  • GridView vs DataGrid, Server.HtmlDecode()

    dotNet 2.0后,M$开始推荐使用GridView取代DataGrid(Comparing the GridView and DataGrid Web Server Controls)。前些天在做Testlink测试Case的Chart,然后想在表中插入HTML format的时候出现了奇怪的问题。DataGrid一切正常,GridView貌似对直接插入的HTML进行了encode,HTML被原原本本地显示了出来。 在MSDN上找到Server类下边有个HTML解码的方法Server.HtmlDecode(),题外话还有个Server.HtmlEncode()的方法。 protected void gvTestPlan_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Cells[1].Text = Server.HtmlDecode(e.Row.Cells[1].Text); } } 这下加入的HTML format就不会给encode了。