134 lines
5.9 KiB
HTML
134 lines
5.9 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<head>
|
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
|
<title>Check Boxes</title>
|
|
<link href="style.css" rel="stylesheet" type="text/css">
|
|
<link href="prettify.css" type="text/css" rel="stylesheet">
|
|
<script type="text/javascript" src="prettify.js"></script><script type="text/javascript" src="lang-vb.js"></script><link href="../resources/main.css" media="screen" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body onload="prettyPrint()"><div class="placing">
|
|
<br><table class="navigation"><tr>
|
|
<td class="navigation-previous"><a href="chapter-background-image.html"><strong>
|
|
« Background Image</strong></a></td>
|
|
<td class="navigation-index"><a href="../../../better-listview-express/documentation.html"><strong>Index</strong></a></td>
|
|
<td class="navigation-next"><a href="chapter-collections.html"><strong>Collections »
|
|
</strong></a></td>
|
|
</tr></table>
|
|
<br><h1>Check Boxes</h1>
|
|
<div class="banner">
|
|
<a href="../../../blog/page/6/index.html"><img src="../resources/overview.gif" alt="Better ListView" class="ss"></a>
|
|
<div class="inside">
|
|
<div class="text">Better ListView: Ultimate .NET ListView replacement control for WinForms (C#, VB.NET)</div>
|
|
<span class="dbtn-c dbtn-hilight"><span class="dbtn-w"><a href="../../../betterlistview.exe" class="dbtn">Download</a></span></span>
|
|
<span class="dbtn-c"><span class="dbtn-w"><a href="../../../blog/page/6/index.html" class="dbtn">More Info</a></span></span>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<br><hr>
|
|
<p class="note">Only two-state check boxes are available in <strong><em>Better
|
|
ListView Express</em></strong>.</p>
|
|
<hr>
|
|
<br><p>To set up check boxes, set <span class="code">CheckBoxes</span> property to either
|
|
<span class="code">TwoState</span> or <span class="code">ThreeState</span>. You can disable check box
|
|
on certain items by setting
|
|
<span class="code">BetterListViewItem.AllowShowCheckBox</span> property to
|
|
<span class="code"></span></p>
|
|
|
|
<p><span class="code">false</span>. The following image shows three state check boxes
|
|
with the last items with check box disabled:</p>
|
|
|
|
<p class="images"><img src="checkboxes-overview.png"></p>
|
|
|
|
<p>Check boxes are supported in every view. For example, here are the
|
|
check boxes enabled in <span class="code">Thumbnails</span> view:</p>
|
|
|
|
<p class="images"><img src="checkboxes-thumbnails.png"></p>
|
|
|
|
<h2>Sample Source Code</h2>
|
|
|
|
|
|
<p><strong>C#</strong></p>
|
|
<pre class="prettyprint"><code class="lang-cs">this.listView.BeginUpdate();
|
|
|
|
this.listView.Items.AddRange(
|
|
new[]
|
|
{
|
|
"unchecked by default",
|
|
"checked by default",
|
|
"indeterminate by default",
|
|
"check box disabled"
|
|
});
|
|
|
|
// set the first item unchecked
|
|
this.listView.Items[0].CheckState = CheckState.Unchecked;
|
|
// set the second item checked
|
|
this.listView.Items[1].CheckState = CheckState.Checked;
|
|
// set the third item in indeterminate state
|
|
this.listView.Items[2].CheckState = CheckState.Indeterminate;
|
|
// disable check box on the fourth item
|
|
this.listView.Items[3].AllowShowCheckBox = false;
|
|
|
|
// enable three-state check boxes (the same property can be used for disabling them or settings two-state ones)
|
|
this.listView.CheckBoxes = BetterListViewCheckBoxes.ThreeState;
|
|
// check boxes are supported in all views, so we can set for example the 'List' view
|
|
this.listView.View = BetterListViewView.List;
|
|
|
|
this.listView.EndUpdate();</code></pre>
|
|
|
|
<p><strong>Visual Basic</strong></p>
|
|
<pre class="prettyprint"><code class="lang-vb">ListView.BeginUpdate()
|
|
|
|
ListView.Items.AddRange(
|
|
New String() {
|
|
"unchecked by default",
|
|
"checked by default",
|
|
"indeterminate by default",
|
|
"check box disabled"
|
|
})
|
|
|
|
' set the first item unchecked
|
|
ListView.Items (0).CheckState = CheckState.Unchecked
|
|
' set the second item checked
|
|
ListView.Items (1).CheckState = CheckState.Checked
|
|
' set the third item in indeterminate state
|
|
ListView.Items (2).CheckState = CheckState.Indeterminate
|
|
' disable check box on the fourth item
|
|
ListView.Items (3).AllowShowCheckBox = False
|
|
|
|
' enable three-state check boxes (the same property can be used for disabling them or settings two-state ones)
|
|
ListView.CheckBoxes = BetterListViewCheckBoxes.ThreeState
|
|
' check boxes are supported in all views, so we can set for example the 'List' view
|
|
ListView.View = BetterListViewView.List
|
|
|
|
ListView.EndUpdate()</code></pre>
|
|
|
|
<br><div class="banner">
|
|
<a href="../../../blog/page/6/index.html"><img src="../resources/overview.gif" alt="Better ListView" class="ss"></a>
|
|
<div class="inside">
|
|
<div class="text">Better ListView: Ultimate .NET ListView replacement control for WinForms (C#, VB.NET)</div>
|
|
<span class="dbtn-c dbtn-hilight"><span class="dbtn-w"><a href="../../../betterlistview.exe" class="dbtn">Download</a></span></span>
|
|
<span class="dbtn-c"><span class="dbtn-w"><a href="../../../blog/page/6/index.html" class="dbtn">More Info</a></span></span>
|
|
</div>
|
|
</div>
|
|
<table class="navigation"><tr>
|
|
<td class="navigation-previous"><a href="chapter-background-image.html"><strong>
|
|
« Background Image</strong></a></td>
|
|
<td class="navigation-index"><a href="../../../better-listview-express/documentation.html"><strong>Index</strong></a></td>
|
|
<td class="navigation-next"><a href="chapter-collections.html"><strong>Collections »
|
|
</strong></a></td>
|
|
</tr></table>
|
|
<br><table class="footer"><tr>
|
|
<td class="footer-title">Better ListView Express Documentation
|
|
</td>
|
|
<td class="footer-copyright">
|
|
Copyright © <a href="../../../index.html" target="_blank">ComponentOwl.com</a>
|
|
</td>
|
|
</tr></table>
|
|
</div></body>
|
|
</html>
|