using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
public class Form1 : Form
{
AutoProgress status = new AutoProgress();
public Form1() {
this.status = new AutoProgress();
this.SuspendLayout();
//
// status
//
this.status.Location = new System.Drawing.Point(12, 8);
this.status.Name = "status";
this.status.Size = new System.Drawing.Size(600, 20);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
this.ClientSize = new System.Drawing.Size(292, 194);
this.Controls.Add(this.status);
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Name = "Form1";
this.Text = "Progress Host";
this.ResumeLayout(false);
status.Start();
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Form1());
}
}
public class AutoProgress : System.Windows.Forms.UserControl
{
internal System.Windows.Forms.ProgressBar myProgressBar;
internal Timer myTimer;
private int percentPerSecond = 5;
public AutoProgress()
{
this.myProgressBar = new System.Windows.Forms.ProgressBar();
this.myTimer = new System.Windows.Forms.Timer(new System.ComponentModel.Container());
this.SuspendLayout();
this.myProgressBar.Dock = System.Windows.Forms.DockStyle.Fill;
this.myProgressBar.Location = new System.Drawing.Point(0, 0);
this.myProgressBar.Name = "myProgressBar";
this.myProgressBar.Size = new System.Drawing.Size(164, 42);
this.myProgressBar.TabIndex = 2;
this.myTimer.Tick += new System.EventHandler(this.myTimer_Tick);
this.Controls.Add(this.myProgressBar);
this.Name = "AutoProgress";
this.Size = new System.Drawing.Size(164, 42);
this.ResumeLayout(false);
}
public int PercentPerSecond
{
get {
return percentPerSecond;
}
set {
if (value < 0)
{
throw new ArgumentException("Progress cannot go backward.");
}
else if (value == 0)
{
throw new ArgumentException("Progress must go on.");
}
percentPerSecond = value;
}
}
public void Start()
{
myProgressBar.Maximum = 200;
myTimer.Interval = 100;
decimal step = Math.Round((decimal)myProgressBar.Maximum * PercentPerSecond / 1000);
myProgressBar.Step = (int)step;
myProgressBar.Value = 0;
myTimer.Start();
}
public void Stop()
{
myTimer.Stop();
myProgressBar.Value = 0;
}
public void Finish()
{
myTimer.Stop();
myProgressBar.Value = myProgressBar.Maximum;
}
private void myTimer_Tick(object sender, EventArgs e)
{
myProgressBar.PerformStep();
if (myProgressBar.Value == myProgressBar.Maximum)
{
myProgressBar.Value = 0;
}
}
}
Wednesday, 13 July 2011
C sharp- Progress bar .......
Friday, 1 July 2011
creating circle in php
<?php
header ("Content-type: image/png");
$im = ImageCreate (150, 150);
$grey = ImageColorAllocate ($im, 230, 230, 230);
$black = ImageColorAllocate ($im, 0, 0, 0);
ImageString($im, 3, 5, 5, "Figure 18.5: Circle", $black);
ImageArc($im, 75, 75, 50, 50, 0, 360, $black);
ImagePng ($im);
ImageDestroy ($im);
?>
Monday, 20 June 2011
ASP.Net go back to previous page after logged in ...
First of all Save current page in a Session Variable...........
Session["previous"] = Request.UrlReferrer.ToString();
after that redirect to login page
Response.Redirect("~/login.aspx");
then write down this code after login code to got redirect to previous page...
Response.Redirect(Session["previous"].toString());
Page will got back redirect to previous page........
Session["previous"] = Request.UrlReferrer.ToString();
after that redirect to login page
Response.Redirect("~/login.aspx");
then write down this code after login code to got redirect to previous page...
Response.Redirect(Session["previous"].toString());
Page will got back redirect to previous page........
Saturday, 14 May 2011
Menu with hover display and auto hide ASP & jquery
<head>
<script src="jquery-1.2.6.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#lab").hover(function () {
$("#img2").stop().animate({ height: "7px" }, "slow");
$("#divfirst").stop().animate({ height: "112px" }, "slow");
}
);
});
</script>
<script type="text/javascript">
</script>
<script type="text/javascript">
$(function () {
$("#lab2").hover(function () {
$("#divfirst").stop().animate({ height: "7px" }, "slow");
$("#divsecond").stop().animate({ height: "112px" }, "slow");
$("#divfirst").mouseleave(function () {
$("#divfirst").stop().animate({ height: "7px" });
}
);
$("#divsecond").mouseleave(function () {
$("#divsecond").stop().animate({ height: "7px" });
}
);
});
});
</script>
<script type="text/javascript">
function hide() {
$("#divfirst").stop().animate({ height: "7px" });
$("#divsecond").stop().animate({ height: "7px" });
}
</script>
<style type="text/css">
#img1
{
height: 7px;
width: 238px;
z-index: 1;
left: 0px;
top: 0px;
position: absolute;
}
#lab
{
z-index: 1;
left: 94px;
top: 32px;
position: absolute;
}
#img2
{
z-index: 1;
left: 505px;
top: 16px;
position: absolute;
height: 7px;
width: 302px;
}
#lab2
{
z-index: 1;
left: 391px;
top: 33px;
position: absolute;
}
#divsecond
{
z-index: 1;
left: 615px;
top: 18px;
position: absolute;
height: 2px;
width: 277px;
}
</style>
</head>
<body>
<div id="divsecond" style="background-image:url('http://localhost:50453/WebSite1/adimage/submenuimg.png'); border-color:Black; border-style:solid; border-width:1px;">
<asp:HyperLink ID="hyp2" runat="server"
style="height: 24px; width: 83px; top:83px; left:27px; position:absolute; z-index: 1;"
Font-Names="Iskoola Pota" Font-Size="13pt" ForeColor="White"
NavigateUrl="http://www.feedback.indiatimes.com/gcReport/feedback/index.jsp?CID=20"
Font-Bold="True">Feedback</asp:HyperLink>
<asp:HyperLink ID="hyp4" runat="server"
style="height: 25px; width: 83px; top:53px; left:26px; position:absolute; z-index: 1;"
Font-Names="Iskoola Pota" Font-Size="13pt" ForeColor="White"
NavigateUrl="http://www.feedback.indiatimes.com/gcReport/feedback/index.jsp?CID=20">Contact</asp:HyperLink>
</div>
<div style="position:absolute; background-image:url('http://localhost:50453/WebSite1/adimage/submenuimg.png'); top: 10px; left: 259px; height: 61px; width: 674px;">
<label id="lab" style="color:White; font-size:medium; font-family:Iskoola Pota;" >Term & Condition</label>
<label id="lab2" style="color:White; font-size:medium; font-family:Iskoola Pota;" >Support</label>
</div>
<div id="divfirst"
style="border: 1px solid Black; z-index: 1; left: 311px; top: 18px; position: absolute; height: 3px; width: 278px;
background-image:url('http://localhost:50453/WebSite1/adimage/submenuimg.png');">
<asp:HyperLink
ID="hyp1" runat="server"
style="height: 25px; width: 83px; top:59px; left:37px; position:absolute; z-index: 1;"
Font-Names="Iskoola Pota" Font-Size="13pt" ForeColor="White"
NavigateUrl="http://shopping.indiatimes.com/media/misc/ishop/shoppingTC.html">Term Use</asp:HyperLink>
<asp:HyperLink ID="hyp3" runat="server"
style="height: 25px; width: 174px; top:88px; left:36px; position:absolute; z-index: 1;"
Font-Names="Iskoola Pota" Font-Size="13pt" ForeColor="White"
NavigateUrl="http://shopping.indiatimes.com/media/misc/ishop/USB_terms.html">Rules & Conditions</asp:HyperLink>
</div>
</body>
//// Screenshot
<script src="jquery-1.2.6.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#lab").hover(function () {
$("#img2").stop().animate({ height: "7px" }, "slow");
$("#divfirst").stop().animate({ height: "112px" }, "slow");
}
);
});
</script>
<script type="text/javascript">
</script>
<script type="text/javascript">
$(function () {
$("#lab2").hover(function () {
$("#divfirst").stop().animate({ height: "7px" }, "slow");
$("#divsecond").stop().animate({ height: "112px" }, "slow");
$("#divfirst").mouseleave(function () {
$("#divfirst").stop().animate({ height: "7px" });
}
);
$("#divsecond").mouseleave(function () {
$("#divsecond").stop().animate({ height: "7px" });
}
);
});
});
</script>
<script type="text/javascript">
function hide() {
$("#divfirst").stop().animate({ height: "7px" });
$("#divsecond").stop().animate({ height: "7px" });
}
</script>
<style type="text/css">
#img1
{
height: 7px;
width: 238px;
z-index: 1;
left: 0px;
top: 0px;
position: absolute;
}
#lab
{
z-index: 1;
left: 94px;
top: 32px;
position: absolute;
}
#img2
{
z-index: 1;
left: 505px;
top: 16px;
position: absolute;
height: 7px;
width: 302px;
}
#lab2
{
z-index: 1;
left: 391px;
top: 33px;
position: absolute;
}
#divsecond
{
z-index: 1;
left: 615px;
top: 18px;
position: absolute;
height: 2px;
width: 277px;
}
</style>
</head>
<body>
<div id="divsecond" style="background-image:url('http://localhost:50453/WebSite1/adimage/submenuimg.png'); border-color:Black; border-style:solid; border-width:1px;">
<asp:HyperLink ID="hyp2" runat="server"
style="height: 24px; width: 83px; top:83px; left:27px; position:absolute; z-index: 1;"
Font-Names="Iskoola Pota" Font-Size="13pt" ForeColor="White"
NavigateUrl="http://www.feedback.indiatimes.com/gcReport/feedback/index.jsp?CID=20"
Font-Bold="True">Feedback</asp:HyperLink>
<asp:HyperLink ID="hyp4" runat="server"
style="height: 25px; width: 83px; top:53px; left:26px; position:absolute; z-index: 1;"
Font-Names="Iskoola Pota" Font-Size="13pt" ForeColor="White"
NavigateUrl="http://www.feedback.indiatimes.com/gcReport/feedback/index.jsp?CID=20">Contact</asp:HyperLink>
</div>
<div style="position:absolute; background-image:url('http://localhost:50453/WebSite1/adimage/submenuimg.png'); top: 10px; left: 259px; height: 61px; width: 674px;">
<label id="lab" style="color:White; font-size:medium; font-family:Iskoola Pota;" >Term & Condition</label>
<label id="lab2" style="color:White; font-size:medium; font-family:Iskoola Pota;" >Support</label>
</div>
<div id="divfirst"
style="border: 1px solid Black; z-index: 1; left: 311px; top: 18px; position: absolute; height: 3px; width: 278px;
background-image:url('http://localhost:50453/WebSite1/adimage/submenuimg.png');">
<asp:HyperLink
ID="hyp1" runat="server"
style="height: 25px; width: 83px; top:59px; left:37px; position:absolute; z-index: 1;"
Font-Names="Iskoola Pota" Font-Size="13pt" ForeColor="White"
NavigateUrl="http://shopping.indiatimes.com/media/misc/ishop/shoppingTC.html">Term Use</asp:HyperLink>
<asp:HyperLink ID="hyp3" runat="server"
style="height: 25px; width: 174px; top:88px; left:36px; position:absolute; z-index: 1;"
Font-Names="Iskoola Pota" Font-Size="13pt" ForeColor="White"
NavigateUrl="http://shopping.indiatimes.com/media/misc/ishop/USB_terms.html">Rules & Conditions</asp:HyperLink>
</div>
</body>
//// Screenshot
Friday, 6 May 2011
Welcome
Hello visitor, All the posts are related to C sharp & ASP programs, Other topics Will be added soon.......'mAf'
All type Message Box
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
public class RadioButtonsTest : System.Windows.Forms.Form {
private System.Windows.Forms.Label promptLabel;
private System.Windows.Forms.Label displayLabel;
private System.Windows.Forms.Button displayButton;
private System.Windows.Forms.RadioButton questionButton;
private System.Windows.Forms.RadioButton informationButton;
private System.Windows.Forms.RadioButton exclamationButton;
private System.Windows.Forms.RadioButton errorButton;
private System.Windows.Forms.RadioButton retryCancelButton;
private System.Windows.Forms.RadioButton yesNoButton;
private System.Windows.Forms.RadioButton yesNoCancelButton;
private System.Windows.Forms.RadioButton okCancelButton;
private System.Windows.Forms.RadioButton okButton;
private System.Windows.Forms.RadioButton abortRetryIgnoreButton;
private System.Windows.Forms.GroupBox iconTypeGroupBox;
private System.Windows.Forms.GroupBox buttonTypeGroupBox;
private MessageBoxIcon iconType = MessageBoxIcon.Error;
private MessageBoxButtons buttonType = MessageBoxButtons.OK;
public RadioButtonsTest() {
InitializeComponent();
}
private void InitializeComponent() {
this.informationButton = new System.Windows.Forms.RadioButton();
this.buttonTypeGroupBox = new System.Windows.Forms.GroupBox();
this.retryCancelButton = new System.Windows.Forms.RadioButton();
this.yesNoButton = new System.Windows.Forms.RadioButton();
this.yesNoCancelButton = new System.Windows.Forms.RadioButton();
this.abortRetryIgnoreButton = new System.Windows.Forms.RadioButton();
this.okCancelButton = new System.Windows.Forms.RadioButton();
this.okButton = new System.Windows.Forms.RadioButton();
this.iconTypeGroupBox = new System.Windows.Forms.GroupBox();
this.questionButton = new System.Windows.Forms.RadioButton();
this.exclamationButton = new System.Windows.Forms.RadioButton();
this.errorButton = new System.Windows.Forms.RadioButton();
this.displayLabel = new System.Windows.Forms.Label();
this.displayButton = new System.Windows.Forms.Button();
this.promptLabel = new System.Windows.Forms.Label();
this.buttonTypeGroupBox.SuspendLayout();
this.iconTypeGroupBox.SuspendLayout();
this.SuspendLayout();
//
// informationButton
//
this.informationButton.Location = new System.Drawing.Point( 16, 104 );
this.informationButton.Name = "informationButton";
this.informationButton.Size = new System.Drawing.Size( 100, 23 );
this.informationButton.TabIndex = 4;
this.informationButton.Text = "Information";
this.informationButton.CheckedChanged += new System.EventHandler(this.iconType_CheckedChanged );
//
// buttonTypeGroupBox
//
this.buttonTypeGroupBox.Controls.AddRange(new System.Windows.Forms.Control[] {
this.retryCancelButton,this.yesNoButton,this.yesNoCancelButton,
this.abortRetryIgnoreButton,this.okCancelButton,this.okButton } );
this.buttonTypeGroupBox.Location =new System.Drawing.Point( 16, 56 );
this.buttonTypeGroupBox.Name = "buttonTypeGroupBox";
this.buttonTypeGroupBox.Size =new System.Drawing.Size( 152, 272 );
this.buttonTypeGroupBox.TabIndex = 0;
this.buttonTypeGroupBox.TabStop = false;
this.buttonTypeGroupBox.Text = "Button Type";
//
// retryCancelButton
//
this.retryCancelButton.Location =new System.Drawing.Point( 16, 224 );
this.retryCancelButton.Name = "retryCancelButton";
this.retryCancelButton.Size =new System.Drawing.Size( 100, 23 );
this.retryCancelButton.TabIndex = 4;
this.retryCancelButton.Text = "RetryCancel";
// all radio buttons for button types are registered
// to buttonType_CheckedChanged event handler
this.retryCancelButton.CheckedChanged +=new System.EventHandler(this.buttonType_CheckedChanged );
//
// yesNoButton
//
this.yesNoButton.Location = new System.Drawing.Point( 16, 184 );
this.yesNoButton.Name = "yesNoButton";
this.yesNoButton.Size = new System.Drawing.Size( 100, 23 );
this.yesNoButton.TabIndex = 0;
this.yesNoButton.Text = "YesNo";
this.yesNoButton.CheckedChanged +=new System.EventHandler(this.buttonType_CheckedChanged );
//
// yesNoCancelButton
//
this.yesNoCancelButton.Location =new System.Drawing.Point( 16, 144 );
this.yesNoCancelButton.Name = "yesNoCancelButton";
this.yesNoCancelButton.Size =new System.Drawing.Size( 100, 23 );
this.yesNoCancelButton.TabIndex = 3;
this.yesNoCancelButton.Text = "YesNoCancel";
this.yesNoCancelButton.CheckedChanged +=new System.EventHandler(this.buttonType_CheckedChanged );
//
// abortRetryIgnoreButton
//
this.abortRetryIgnoreButton.Location =new System.Drawing.Point( 16, 104 );
this.abortRetryIgnoreButton.Name ="abortRetryIgnoreButton";
this.abortRetryIgnoreButton.Size =new System.Drawing.Size( 120, 23 );
this.abortRetryIgnoreButton.TabIndex = 2;
this.abortRetryIgnoreButton.Text = "AbortRetryIgnore";
this.abortRetryIgnoreButton.CheckedChanged += new System.EventHandler(this.buttonType_CheckedChanged );
//
// okCancelButton
//
this.okCancelButton.Location =new System.Drawing.Point( 16, 64 );
this.okCancelButton.Name = "okCancelButton";
this.okCancelButton.Size =new System.Drawing.Size( 100, 23 );
this.okCancelButton.TabIndex = 1;
this.okCancelButton.Text = "OKCancel";
this.okCancelButton.CheckedChanged +=new System.EventHandler(this.buttonType_CheckedChanged );
//
// okButton
//
this.okButton.Checked = true;
this.okButton.Location =new System.Drawing.Point( 16, 24 );
this.okButton.Name = "okButton";
this.okButton.Size =new System.Drawing.Size( 100, 23 );
this.okButton.TabIndex = 0;
this.okButton.TabStop = true;
this.okButton.Text = "OK";
this.okButton.CheckedChanged +=new System.EventHandler(this.buttonType_CheckedChanged );
//
// iconTypeGroupBox
//
this.iconTypeGroupBox.Controls.AddRange(new System.Windows.Forms.Control[] {
this.questionButton,this.informationButton,this.exclamationButton,
this.errorButton } );
this.iconTypeGroupBox.Location =new System.Drawing.Point( 200, 56 );
this.iconTypeGroupBox.Name = "iconTypeGroupBox";
this.iconTypeGroupBox.Size =new System.Drawing.Size( 136, 176 );
this.iconTypeGroupBox.TabIndex = 1;
this.iconTypeGroupBox.TabStop = false;
this.iconTypeGroupBox.Text = "Icon";
//
// questionButton
//
this.questionButton.Location =new System.Drawing.Point( 16, 144 );
this.questionButton.Name = "questionButton";
this.questionButton.Size =new System.Drawing.Size( 100, 23 );
this.questionButton.TabIndex = 0;
this.questionButton.Text = "Question";
// all radio buttons for icon types are registered
// to iconType_CheckedChanged event handler
this.questionButton.CheckedChanged +=new System.EventHandler(this.iconType_CheckedChanged );
//
// exclamationButton
//
this.exclamationButton.Location =new System.Drawing.Point( 16, 64 );
this.exclamationButton.Name = "exclamationButton";
this.exclamationButton.Size =new System.Drawing.Size( 104, 23 );
this.exclamationButton.TabIndex = 2;
this.exclamationButton.Text = "Exclamation";
this.exclamationButton.CheckedChanged +=new System.EventHandler(this.iconType_CheckedChanged );
//
// errorButton
//
this.errorButton.Location =new System.Drawing.Point( 16, 24 );
this.errorButton.Name = "errorButton";
this.errorButton.Size =new System.Drawing.Size( 100, 23 );
this.errorButton.TabIndex = 1;
this.errorButton.Text = "Error";
this.errorButton.CheckedChanged +=new System.EventHandler(this.iconType_CheckedChanged );
//
// displayLabel
//
this.displayLabel.Location =new System.Drawing.Point( 200, 304 );
this.displayLabel.Name = "displayLabel";
this.displayLabel.Size =
new System.Drawing.Size( 136, 24 );
this.displayLabel.TabIndex = 4;
//
// displayButton
//
this.displayButton.Location =new System.Drawing.Point( 200, 240 );
this.displayButton.Name = "displayButton";
this.displayButton.Size =new System.Drawing.Size( 136, 48 );
this.displayButton.TabIndex = 3;
this.displayButton.Text = "Display";
this.displayButton.Click +=new System.EventHandler( this.displayButton_Click );
//
// promptLabel
//
this.promptLabel.Font =new System.Drawing.Font("Microsoft Sans Serif", 9.5F,
System.Drawing.FontStyle.Regular,System.Drawing.GraphicsUnit.Point,( ( System.Byte )( 0 ) ) );
this.promptLabel.Location =new System.Drawing.Point( 8, 16 );
this.promptLabel.Name = "promptLabel";
this.promptLabel.Size =new System.Drawing.Size( 344, 24 );
this.promptLabel.TabIndex = 5;
this.promptLabel.Text = "Choose the type of MessageBox you would like to display!";
//
// RadioButtonsTest
//
this.AutoScaleBaseSize =new System.Drawing.Size( 5, 13 );
this.ClientSize =new System.Drawing.Size( 360, 341 );
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.promptLabel,this.displayLabel,this.displayButton,
this.iconTypeGroupBox,this.buttonTypeGroupBox } );
this.Name = "RadioButtonsTest";
this.Text = "Demonstrating RadioButtons";
this.buttonTypeGroupBox.ResumeLayout( false );
this.iconTypeGroupBox.ResumeLayout( false );
this.ResumeLayout( false );
}
[STAThread]
static void Main()
{
Application.Run( new RadioButtonsTest() );
}
private void buttonType_CheckedChanged(object sender, System.EventArgs e )
{
if ( sender == okButton )
buttonType = MessageBoxButtons.OK;
else if ( sender == okCancelButton )
buttonType = MessageBoxButtons.OKCancel;
else if ( sender == abortRetryIgnoreButton )
buttonType = MessageBoxButtons.AbortRetryIgnore;
else if ( sender == yesNoCancelButton )
buttonType = MessageBoxButtons.YesNoCancel;
else if ( sender == yesNoButton )
buttonType = MessageBoxButtons.YesNo;
else
buttonType = MessageBoxButtons.RetryCancel;
}
private void iconType_CheckedChanged(object sender, System.EventArgs e )
{
if ( sender == errorButton )
iconType = MessageBoxIcon.Error;
else if ( sender == exclamationButton )
iconType = MessageBoxIcon.Exclamation;
else if ( sender == informationButton )
iconType = MessageBoxIcon.Information;
else
iconType = MessageBoxIcon.Question;
}
protected void displayButton_Click(object sender, System.EventArgs e )
{
DialogResult result =MessageBox.Show( "This is Your Custom MessageBox.",
"Custom MessageBox", buttonType, iconType, 0, 0 );
switch ( result ) {
case DialogResult.OK:
displayLabel.Text = "OK was pressed.";
break;
case DialogResult.Cancel:
displayLabel.Text = "Cancel was pressed.";
break;
case DialogResult.Abort:
displayLabel.Text = "Abort was pressed.";
break;
case DialogResult.Retry:
displayLabel.Text = "Retry was pressed.";
break;
case DialogResult.Ignore:
displayLabel.Text = "Ignore was pressed.";
break;
case DialogResult.Yes:
displayLabel.Text = "Yes was pressed.";
break;
case DialogResult.No:
displayLabel.Text = "No was pressed.";
break;
}
}
}
Subscribe to:
Posts (Atom)