Files

122 lines
5.3 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>Background Image</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="../../../better-listview-express/quick-start-guide.html"><strong>
« Quick Start</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-checkboxes.html"><strong>Check Boxes »
</strong></a></td>
</tr></table>
<br><h1>Background Image</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>
<p>There are four properties to control background image:</p>
<ul>
<li>
<p><span class="code">BackgroundImage</span></p>
</li>
<li>
<p><span class="code">BackgroundImageAlignment</span></p>
</li>
<li>
<p><span class="code">BackgroundImageLayout</span></p>
</li>
<li>
<p><span class="code">BackgroundImageOpacity</span></p>
</li>
</ul>
<p>The <span class="code">BackgroundImage</span> property is actually derived from
<span class="code">System.Windows.Forms.Control</span> class.</p>
<p>This property is hidden in the regular .NET ListView.</p>
<p>Setting <span class="code">BackgroundImageLayout</span> to <span class="code">None</span> and
changing the <span class="code">BackgroundImageAlignment</span> property yields different
positioning of background image:</p>
<p class="images"><img src="background-image-align1.png"><img src="background-image-align2.png"></p>
<p>The image can also be tiled, scaled proportionally or unproportionally
by changing the <span class="code">BackgroundImageLayout</span> property:</p>
<p class="images"><img src="background-image-layout1.png"><img src="background-image-layout2.png"></p>
<p>Image opacity can also be changed via the
<span class="code">BackgroundImageOpacity</span> property:</p>
<p class="images"><img src="background-image-opacity1.png"><img src="background-image-opacity2.png"></p>
<h2>Sample Source Code</h2>
<p><strong>C#</strong></p>
<pre class="prettyprint"><code class="lang-cs">this.listView.BeginUpdate();
// set background image
this.listView.BackgroundImage = Resources.ImageOwl;
// set background image properties
this.listView.BackgroundImageAlignment = ContentAlignment.BottomRight;
this.listView.BackgroundImageLayout = ImageLayout.None;
this.listView.BackgroundImageOpacity = 64;
this.listView.EndUpdate();</code></pre>
<p><strong>Visual Basic</strong></p>
<pre class="prettyprint"><code class="lang-vb">ListView.BeginUpdate()
' set background image
ListView.BackgroundImage = Resources.ImageOwl
' set background image properties
ListView.BackgroundImageAlignment = ContentAlignment.BottomRight
ListView.BackgroundImageLayout = ImageLayout.None
ListView.BackgroundImageOpacity = 64
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="../../../better-listview-express/quick-start-guide.html"><strong>
« Quick Start</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-checkboxes.html"><strong>Check Boxes »
</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>