Working with form properties:
Property defines the look and feel of an object
1)NAME:this property changes class names with forms & object names with controls
2)back color
3)font
3)fore color
4)back ground image
5)back ground image layout
6)opacity:when this value is decreasing then transparency ratio will be increases
7)show in taskbar=true/false
8)Transparency key:this value must be same as form back color, Then except form border and control’s body, The remaining part of the form will be displayed fully transparent
9)form border style:fixed/sizable/none
Working with label and timer controls:
About label:
1)a label control is used to display some text along with an image.
2)label control supports nine types of alignments
3)all these alignments are stored in a predefined enum called as content alignment
About timer control:
1)timer control is used to execute a set of statements repetedly
2)timer control logic will be executed only when enabled true
3)timer control is not visible at runtime
4)timer control is having only one event called as tick
5)tick event will be executed after equal interval (milli seconds)
1000 ms=1 sec
Developing digital watch:
Open windows forms application project:
Start->programs->Microsoft visual studio 2010->Microsoft Visual studio 2010->file menu->new->
project->select visual c# from installed templates->select windows forms application project
open toolbox [view->toolbox]
place a label control and timer control
choose timer1->properties and set enabled-true and interval=1000.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
label1.Text = DateTime.Now.ToLongTimeString();
timer1.Interval = 2000;
}
}
}
Goto f5
Developing a screen sever
Open windows forms application project:
Start->programs->Microsoft visual studio 2010->Microsoft Visual studio 2010->file menu->new->
project->select visual c# from installed templates->select windows forms application project
choose form properties and set
backcolor=black
form border style=none
window state=maximized
place a picturebox control->properties &set image=select an image from the harddisk
place a timer with enabled=true
place one more timer with enabled=false
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//code for Timer1_tick
private void timer1_Tick(object sender, EventArgs e)
{
pictureBox1.Top = pictureBox1.Top - 4;
if (pictureBox1.Top < 0)
{
timer1.Enabled = false;
timer2.Enabled = true;
}
}
//code for timer2_tick
private void timer2_Tick(object sender, EventArgs e)
{
pictureBox1.Top = pictureBox1.Top + 4;
if (pictureBox1.Top > 500)
{
timer1.Enabled = true;
timer2.Enabled = false;
}
timer1.Interval = 1;
timer2.Interval = 1;
}
}
}
EXeute the project F5
Image control:
This control can be used to display image on asp.net webform
Properties:
1.ID
2.image url-specify image filename (or) image url to be displayed with image control
Hyperlink control:
1)hyperlink allows user to download a file from server system to client system
2)hyperlink can be text (or) image
Properties:
1)Id
2)text-specify hyperlink text
3)image url-specify hyperlink image
4)navigate url-specify filename to be downloaded
Creating website to work with image control & hyper link control
Goto visual studio
Start->run->devenv
It will display main window of visual studio
File menu->new->website->visual c#->select asp.net empty website
Weblocation->e:\aspnet\hyperlinksite[drive:\dir\websitename]
Visual studio create a folder with website name, in this folder website related files will be placed
Place existing image files into website
Goto solution explorer
Rightclick on website path and select add existing item
Select image files c:/images->logo.gif
Speakers.gif
Place existing audio and video file into website s.mp3 and d.mpg
Create html page into website with speakers
Product info:
Goto solution explorer
Rightclick on website path and select add new item
Select html page template
Give name as speakers.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">
<head>
<t-itle></title>
</head>
<body>
<h1>place speakers info</h1>
</body>
</html>
Creating html page
Goto solution explorer
Rightclick on website path and select add new item
Select html page template
Give name as aboutus.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">
<head>
<title></title>
</head>
<body>
<h1>place company profile </h1>
</body>
</html>
Creating home page [asp.net webpage] into website
Add webform
Goto view menu and select solution explorer
Right click on website path and select add new item
Select webform
Give name as home.aspx
Goto design part
Place imagecontrol and 4 hyperlinks as shown below
imagecontrol about us play audio play video
HyperLink
image1 properties
image url------[click]
select logo.gif
hyperlink1 properties
1)imageurl-speakers.gif
2)navigateurl-speakers.html
Hyperlink2 properties
1)text-aboutus
2)navigate url-aboutus.html
Hyperlink3 properties
1)text-play audio
2)navigate url-select s.mp3
Hyperlink4 properties
1)text-play video
2)navigate url-d.mpg
Goto contrl F5
Note:clicking on hyperlink will download navigate url file from website to client system.