上图
控件的设置
<asp:TextBox ID="FileContent" runat="server" TextMode="MultiLine" Rows="40" Columns="100" />JS的设置
var editor = CodeMirror.fromTextArea(document.getElementById("<%=FileContent.ClientID %>"), {
            mode: "text/html",
            tabMode: "indent",
            width: '100%',
            height: '100%',
            autoMatchParens: true,
            textWrapping: true,
            lineNumbers: true
        });

解决方案 »

  1.   

    <asp:TextBox ID="FileContent" runat="server" TextMode="MultiLine" Rows="40" Columns="100" />Columns设多了吧。改少点试试<asp:TextBox ID="FileContent" runat="server" TextMode="MultiLine" Rows="40" Columns="50" />
      

  2.   


    ++如果这样还不行,那就改插件参数试试
      width: '300px',
      height: '500px',
      

  3.   

    非常感谢,我发现textarea的设置不能控制CodeMirror的代码显示区域.参数设置也无效(设置过)不过在 codemirror.css 设置能起作用.CodeMirror-scroll {
      overflow: auto;
      height: 440px;
      width:680px;

      /* This is needed to prevent an IE[67] bug where the scrolled content
         is visible outside of the scrolling box. */
      position: relative;
      outline: none;
    }
      

  4.   

    这样的插件设置,不太合理呀。应该不至于吧
    再试试
    width: '300',
    height: '500',
    或者
    width: '60%',
    height: '60%',
    这样的参数设置
      

  5.   

    确实有这样的问题。
    我也是和lz一样,修改的codemirror.css才生效。
      

  6.   

    在初始化时,设置属性lineWrapping为true即可自动换行
      

  7.   

    zai你的css文件中重新定义一个css规则.
    在codemirror中的定义是.CodeMirror {
      /* Set height, width, borders, and global font properties here */
      font-family: monospace;
      height: 300px;
    }
    在你自己中设置成.CodeMirror {
      /* Set height, width, borders, and global font properties here */
      font-family: monospace;
      height: auto;
    }这样就可以改变了.另外要注意的是,你的css文件引入要放在后面, 也就是要覆盖codemirror.css中的规则
      

  8.   

    你可以通过定义 CSS:   .CodeMirror {border: 2px inset #dee; height:800px; width: 800px}   来定义