如何启用datagridview的滚动条选项? [英] how to enable scroll bar options of datagridview?

查看:698
本文介绍了如何启用datagridview的滚动条选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在禁用DataGridView选择功能的同时启用datagridview的滚动条选项。帮助我.THANX?

how to enable scroll bar options of datagridview while DataGridView select ability is disabled. help me with this.THANX?

dataGridView1.Enabled = false;

推荐答案

GridView仍然没有ScrollBars属性。要使用水平或垂直滚动​​条创建GridView,您需要将GridView放在< div>内。标签或Panel控件内部。

GridView里面< div> HTML标签

要使用div标签生成GridView滚动条,请使用以下代码:

GridView still have not ScrollBars property. To create GridView with horizontal or vertical scrollbar you need to place GridView inside <div > tag or inside Panel control.
GridView inside <div > HTML tag
To produce GridView scrollbars with div tag, use this code:
<div style="width:100%; height:300; overflow:auto;">
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>



面板控制中的GridView

要在Panel控件的帮助下创建GridView滚动条,请使用此代码:


GridView inside Panel Control
To create GridView scrollbars with a little help of Panel control, use this code:

<asp:Panel ID="Panel1" runat="server" ScrollBars="Both" Height="300" Width="100%">
 <asp:GridView ID="GridView1" runat="server">
 </asp:GridView>
</asp:Panel>


通过设置
DataGridView.Enabled=false;

您正在为任何操作禁用DataGridViewControl。要使用滚动条,您可以尝试以下其他选项。



a)DataGridView.ReadOnly = false;

b)dataGridColumn.ReadOnly = false;

c)除了a或b之外,在DefaultCellStyle中将SelectionBackColor更改为白色

d)在单元格/行选择更改方法中调用dataGridView.ClearSelection()方法。

you are making the DataGridViewControl disabled for any operation.To use the scroll bar you can try the following other options.

a) DataGridView.ReadOnly = false;
b) dataGridColumn.ReadOnly = false;
c) addition to a or b, change the SelectionBackColor to white in DefaultCellStyle
d) call dataGridView.ClearSelection() method in your cell/row selection change method.


这篇关于如何启用datagridview的滚动条选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆