zoukankan      html  css  js  c++  java
  • 试试Live Writer的代码插件

    插入代码VS2010

    http://my.oschina.net/nnhy/blog/11369

    修正从vs2010复制代码时中文乱码的问题。好消息:VS2010 SP1已经没有这个问题了。

    private void Application_UnhandledException(objectsender, ApplicationUnhandledExceptionEventArgse)
            {
               
    // 如果应用程序是在调试器外运行的,则使用浏览器的
                // 异常机制报告该异常。在 IE 上,将在状态栏中用一个
                // 黄色警报图标来显示该异常,而 Firefox 则会显示一个脚本错误。
               
    if(!System.Diagnostics.Debugger.IsAttached)
                {

                   
    // 注意: 这使应用程序可以在已引发异常但尚未处理该异常的情况下
                    // 继续运行。
                    // 对于生产应用程序,此错误处理应替换为向网站报告错误
                    // 并停止应用程序。
                   
    e.Handled= true;
                    Deployment.Current.Dispatcher.BeginInvoke(delegate{ ReportErrorToDOM(e); });
                }
            }


    插入代码块
    private void btnAbout_Click(object sender, RoutedEventArgs e)
            {
                //MessageBox.Show("欢迎进入SilverLight世界!");
                mSvClient.HelloWorldAsync();
                Type tp = Type.GetType("System.Nullable`1[System.DateTime]");
                //==================================================================            
                List<ClassHelper.CustPropertyInfo> lstCustPropertyInfo = new List<ClassHelper.CustPropertyInfo>();
                lstCustPropertyInfo.Add(new ClassHelper.CustPropertyInfo("System.Int32", "xx"));
                lstCustPropertyInfo.Add(new ClassHelper.CustPropertyInfo("System.String", "sname"));
                lstCustPropertyInfo.Add(new ClassHelper.CustPropertyInfo("System.Nullable`1[System.DateTime]", "intime"));            
                dataGrid1.ItemsSource = lp;
            }

    这里有一个小小的问题:如果不选择“折叠代码”,那么代码块就没有灰色的背景了。解决办法很简单,
    把展开视图代码模版改为:
    <div class="cnblogs_code"><pre><%hcode%></pre></div><br>
    其实就是在最外面那个div里加上css class,这样代码块有灰色的背景和自适应的滚动条。
    Insert Code(英文版)
       1:  private void btnAbout_Click(object sender, RoutedEventArgs e)
       2:          {
       3:              //MessageBox.Show("欢迎进入SilverLight世界!");
       4:   
       5:              mSvClient.HelloWorldAsync();
       6:              Type tp = Type.GetType("System.Nullable`1[System.DateTime]");
       7:              //==================================================================            
       8:              List<ClassHelper.CustPropertyInfo> lstCustPropertyInfo = new List<ClassHelper.CustPropertyInfo>();
       9:              lstCustPropertyInfo.Add(new ClassHelper.CustPropertyInfo("System.Int32", "xx"));
      10:              lstCustPropertyInfo.Add(new ClassHelper.CustPropertyInfo("System.String", "sname"));
      11:              lstCustPropertyInfo.Add(new ClassHelper.CustPropertyInfo("System.Nullable`1[System.DateTime]", "intime"));
      12:   
      13:              List<object> lp = new List<object>();
      14:              object obx = ClassHelper.CreateInstance(lstCustPropertyInfo);
      15:              ClassHelper.SetPropertyValue(obx, "xx", 789);
      16:              ClassHelper.SetPropertyValue(obx, "sname", "张三");
      17:              ClassHelper.SetPropertyValue(obx, "intime", DateTime.Now);
      18:              lp.Add(obx);
      19:              obx = ClassHelper.CreateInstance(lstCustPropertyInfo);
      20:              ClassHelper.SetPropertyValue(obx, "xx", 987);
      21:              ClassHelper.SetPropertyValue(obx, "sname", "李四");
      22:              ClassHelper.SetPropertyValue(obx, "intime", null);
      23:              lp.Add(obx);
      24:              
      25:              dataGrid1.ItemsSource = lp;
      26:          }
  • 相关阅读:
    非嵌入式数据库 软件很难普及 玩大
    FireMonkey下的异形窗体拖动(需要使用FmxHandleToHwnd函数转化一下句柄)
    公司开到高新技术区可以只收11的企业所得税,拿到软件企业认证后可享受所得税两免三减半(从盈利年度算起)
    猜测:信号槽的本质是使用Windows的自定义消息来实现的
    服务运行、停止流程浅析
    在线压缩JS的工具
    通用流程设计
    并行Linq(一)
    SQL基础知识总结(一)
    Easyui布局
  • 原文地址:https://www.cnblogs.com/edong/p/2133772.html
Copyright © 2011-2022 走看看