|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
IntroductionThe following C# custom control will create a percentage complete color bar with a custom text in the middle. You can compare this with those of Yahoo/Hotmail, when you log into them, it shows you the percentage of space that is occupied by you out of the space that is allocated to you. If you provide UsagePercentageComplete.Zip has PercentageComplete.cs file. You can include this control in your controls set and then use it in your web page. I recommend you to download the complete demo project to understand it better. <%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %>
<Controls:PercentageComplete id="PercentageComplete2"
runat="server" Count="65" FillColor="#0099FF" Gradient="false"
cellspacing="2" TextFontColor="#FF6600" TextBold="true"
TextFontSize="2" RemainingColor="#ABD0BC" />
<Controls:PercentageComplete id="PercentageComplete1"
runat="server" Count="79" />
<Controls:PercentageComplete id="Percentagecomplete4"
runat="server" Count="80" Text="8 of 10"
StartColor="#6868B9" EndColor="#ABD0BC"
BoxBorderColor="#FF6600" CellSpacing="0"
TextFontFamily="Times New Roman"
TextFontColor="White" TextFontSize="3"
BorderType="double" BoxBorderWidth="3" />
<Controls:PercentageComplete id="Percentagecomplete3"
runat="server" Count="55" StartColor="#B7B748"
EndColor="#E5E5E5" BoxBorderColor="green"
BgColor="#E5E5E5" BorderType="dotted" />
<Controls:PercentageComplete id="Percentagecomplete5"
runat="server" Count="90" StartColor="#FF6600"
EndColor="#0099FF" BoxBorderColor="Red"
CellPadding="3" cellspacing="1" TextFontFamily="Verdana"
TextBold="True" TextFontColor="#FF9999"
TextFontSize="3" BorderType="inset"
GradientVertical="True" BoxBorderWidth="1" />
<Controls:PercentageComplete id="Percentagecomplete6"
runat="server" Count="45" StartColor="#99FF00"
EndColor="#6600FF" BoxBorderColor="Red"
CellPadding="4" BgColor="#E8E8FF"
BorderType="dashed" TextFontFamily="Tahoma"
TextFontColor="red" TextFontSize="2" />
Note: Attribute " It has lots of other attributes. If you download the sample project, you will see the various usages of these attributes. Attributes
OutputHere I am providing you the HTML output of this, so that any non .NET programmer can extract this and use it in his web page. I searched a lot over the internet to get this: <table cellspacing='2' cellpadding='0'
style='border:1 solid #547095;background-color:white' width='95%'
align='center' ID="Table1">
<tr>
<td width='100%' style='background-color:#ABD0BC'>
<div style='position:absolute;background-color:#0099FF;width:65%;'
align='center'>
<font size='2'> </font></div>
<div style='position:relative;width:100%' align='center'>
<font style='font-weight:bold' size='2'
color='#FF6600' face='verdana'>65%</font>
</div>
</td>
</tr>
</table>
CourtesyPlease feel free to change or use this control in any manner you want, but I will appreciate if you let the author email id TittleJoseph@yahoo.com remain in the control file.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||