181 lines
7.8 KiB
HTML
181 lines
7.8 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-thumbnail-browser/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="../../../better-thumbnail-browser.html"><img src="../resources/better-thumbnail-browser-overview.gif" alt="Better Thumbnail Browser" class="ss"></a>
|
|||
|
|
<div class="inside">
|
|||
|
|
<div class="text">Better Thumbnail Browser for .NET (C#, VB) - Image thumbnail viewing and loading control</div>
|
|||
|
|
<span class="dbtn-c dbtn-hilight"><span class="dbtn-w"><a href="../../../betterthumbnailbrowser.exe" class="dbtn">Download</a></span></span>
|
|||
|
|
<span class="dbtn-c"><span class="dbtn-w"><a href="../../../better-thumbnail-browser.html" class="dbtn">More Info</a></span></span>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
<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>Check Box Appearance</h2>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<p>It is possible to customize check box appearance on each item using
|
|||
|
|
<span class="code">BetterListViewItem.CheckBoxAppearance</span> property. It can have
|
|||
|
|
on of three values:</p>
|
|||
|
|
|
|||
|
|
<ul style="list-style:none">
|
|||
|
|
<li>
|
|||
|
|
<span class="code">Hide</span><ul style="list-style:none"><li>
|
|||
|
|
<p>Check box is not displayed on the item.</p>
|
|||
|
|
</li></ul>
|
|||
|
|
</li>
|
|||
|
|
<li>
|
|||
|
|
<span class="code">CheckBox</span><ul style="list-style:none"><li>
|
|||
|
|
<p>Default appearance.</p>
|
|||
|
|
</li></ul>
|
|||
|
|
</li>
|
|||
|
|
<li>
|
|||
|
|
<span class="code">RadioButton</span><ul style="list-style:none"><li>
|
|||
|
|
<p>Check box appears as radio button.</p>
|
|||
|
|
</li></ul>
|
|||
|
|
</li>
|
|||
|
|
</ul>
|
|||
|
|
<p>Note that <strong><em>RadioButton</em></strong> appearance supports only
|
|||
|
|
two states. When three-state check boxes are used, the radio button-like
|
|||
|
|
check boxes will show only the two.</p>
|
|||
|
|
|
|||
|
|
<p>The following image shows how custom check box appearance can be
|
|||
|
|
used. Check boxes on parent items are hidden while the child items display
|
|||
|
|
radio buttons:</p>
|
|||
|
|
|
|||
|
|
<p class="images"><img src="checkboxes-radio.png"></p>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<h2>Check Box Alignment</h2>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<p>When check boxes are turned on, every item label is aligned such
|
|||
|
|
that there is enough space for a check box even when the check box is
|
|||
|
|
hidden on that item. This is a default appearance and can be adjusted by
|
|||
|
|
setting <span class="code">CheckBoxesAlign</span> property to <span class="code">false</span>. The
|
|||
|
|
following images show the default appearance (left) and adjusted
|
|||
|
|
appearance when <span class="code">CheckBoxesAlign</span> property is set to
|
|||
|
|
<span class="code">false</span> (right). The "parent 3" and "parent 4" items look on
|
|||
|
|
the left image like children of "parent 2" item, which is not the case.
|
|||
|
|
Removing the unnecessary offset clarifies their position:</p>
|
|||
|
|
|
|||
|
|
<p class="images"><img src="checkboxes-align1.png"><img src="checkboxes-align2.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].CheckBoxAppearance = BetterListViewCheckBoxAppearance.Hide;
|
|||
|
|
|
|||
|
|
// 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).CheckBoxAppearance = BetterListViewCheckBoxAppearance.Hide
|
|||
|
|
|
|||
|
|
' 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="../../../better-thumbnail-browser.html"><img src="../resources/better-thumbnail-browser-overview.gif" alt="Better Thumbnail Browser" class="ss"></a>
|
|||
|
|
<div class="inside">
|
|||
|
|
<div class="text">Better Thumbnail Browser for .NET (C#, VB) - Image thumbnail viewing and loading control</div>
|
|||
|
|
<span class="dbtn-c dbtn-hilight"><span class="dbtn-w"><a href="../../../betterthumbnailbrowser.exe" class="dbtn">Download</a></span></span>
|
|||
|
|
<span class="dbtn-c"><span class="dbtn-w"><a href="../../../better-thumbnail-browser.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-thumbnail-browser/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 Thumbnail Browser Documentation
|
|||
|
|
</td>
|
|||
|
|
<td class="footer-copyright">
|
|||
|
|
Copyright © 2010-2012 <a href="../../../index.html" target="_blank">ComponentOwl.com</a>
|
|||
|
|
</td>
|
|||
|
|
</tr></table>
|
|||
|
|
</div></body>
|
|||
|
|
</html>
|