|
The
Form design, agenda_time.cs
Create Visual C# 2010 Forn -
agenda_time.cs
Classes used in this Form: PictureBox,
Panel, RadioButton,
ListBox
Create the Form
agenda_time.cs
Add New Item -
agenda_time.cs Form to work_VCNet10
Project
- On the Projet
menu , click Add New Item ...,
Add New Item - work_VCNet10 dialog box appears, Select
Windows form Icon,
in the Name box type
agenda_time.cs and then click
Add.
|
 |
|
Note:
In the Windows Forms Designer appears the
design form created and in the Properties
Windows displays the corresponding properties
and
The design Form agenda_time.cs created, appears the empty window Form
design |
|
The codes file, created
... |
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
work_VCNet10
{
public
partial
class
agenda_time :
Form
{
public
agenda_time()
{
InitializeComponent();
}
private
void agenda_time_Load(object
sender,
EventArgs
e)
{
}
}
}
|
|
|
|
|
1. |
Picture files used by this form ...
|
|
- The folder
c:\work_VCNet10\work_VCNet10\pic stored the
bmp files time_am.bmp,
time_pm.bmp, time_title.bmp,
p_close.bmp
|
2. |
The
agenda_time.cs design |
|
 |
The Properties of
the Form -
agenda_time.cs... |
Name: Icon: FormBorderstyle: Menu: Size: Start
Position: Text: Window
State: |
agenda_time Icon None (none) 156,
140 Manual agenda_time
... Normal | | | |
3. |
From the Toolbox/Windows Form add these
controls .... 4 PictureBox
controls, 4 Panel controls, 2 RadioButton
controls, 1 ListBox
controls |
|
- Add
4 PictureBox
controls
- PictureBox1,
PictureBox
Properties
Name: Image: Size
Mode: |
PictureBox1 System.Drawing.Bitmap Autosize | |
Bitmap
file added = C:\work_VCNet10\work_VCNet10\pic\
p_close..bmp
- PictureBox2
-
Bitmap file added =
C:\work_VCNet10\work_VCNet10\pic\
time_title.bmp
- Pic\A1
-
Bitmap file added = C:\work_VCNet10\work_VCNet10\pic\time_am
.bmp
- PicA2 -
Bitmap
file added = C:\work_VCNet10\work_VCNet10\pic\time_pm.bmp
|
- Add
4 Panel
controls
- Panel1, Panel
Properties
- Panel2
-
Size: 4,
136
- Panel3
-
Size:
156,
4
- Panel4
-
Size:
156,
4
|
- Add
2
RadioButton
controls
- RadAM,
RadioButton
Properties
- RadPM
Text:
PM
|
- Add
the ListBox
control
-
Listtime, ListBox
Properties:
Name: Size: |
Listtime 72,
121 | |
| | |
|
agenda_time.cs file, the codes after modification
...
|
|
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
work_VCnet10
{
public
partial
class
agenda_time
:
Form
{
// Variables
string vj;
string vi;
string v_str;
int vitem;
int j;
int j1;
int i;
// public variables
public
class
agenda_time_cl
{
public
static
bool
time_flag;
public
static
string appoint_time;
}
public agenda_time()
{
InitializeComponent();
}
private
void
agenda_time_Load(object
sender,
EventArgs
e)
{
int vleft;
int vtop;
// Move
vleft = work_VCnet10. agenda_appoint.agenda_appoint_cl.appoint_left
+ work_VCnet10.agenda_appoint.agenda_appoint_cl.appointtxttime_Left;
vtop = work_VCnet10. agenda_appoint.agenda_appoint_cl.appoint_Top
+ work_VCnet10.agenda_appoint.agenda_appoint_cl.appointtxttime_Top
+ (work_VCnet10.agenda_appoint.agenda_appoint_cl.appointtxttime_Height
* 5) / 2;
//vleft = 5;
//vtop = 5;
this.Left = vleft;
this.Top = vtop;
agenda_time_cl.time_flag
=
false;
this.RadAM.Checked =
true;
}
private
void
RadAM_CheckedChanged(object
sender,
EventArgs
e)
{
if (this.Listtime.Items.Count
> 0)
{
vitem = ( this.Listtime.Items.Count
- 1);
this.Listtime.Items.Clear();
}
for (i = 0; i <= 11;
i++)
{
for (j1 = 0; j1 <=
11; j1++)
{
j = j1 * 5;
if (i < 10)
vi =
"0"
+ System.Convert.ToString(i);
else
vi = System. Convert.ToString(i);
if (j < 10)
vj =
"0"
+ System.Convert.ToString(j);
else
vj = System. Convert.ToString(j);
v_str = vi +
":"
+ vj +
" AM";
this.Listtime.Items.Add(v_str.Trim());
}
}
if (this.RadAM.Checked
==
true)
this.RadPM.Checked =
false;
}
private
void
RadPM_CheckedChanged(object
sender,
EventArgs
e)
{
if (this.Listtime.Items.Count
> 0)
{
vitem = ( this.Listtime.Items.Count
- 1);
this.Listtime.Items.Clear();
}
for (i = 12; i <=
23; i++)
{
for (j1 = 0; j1 <=
11; j1++)
{
j = j1 * 5;
if (i < 10)
vi =
"0"
+ System.Convert.ToString(i);
else
vi = System. Convert.ToString(i);
if (j < 10)
vj =
"0"
+ System.Convert.ToString(j);
else
vj = System. Convert.ToString(j);
v_str = vi +
":"
+ vj +
" PM";
this.Listtime.Items.Add(v_str.Trim());
}
}
if (this.RadPM.Checked
==
true)
this.RadAM.Checked =
false;
}
private
void
Listtime_SelectedIndexChanged(object
sender,
EventArgs
e)
{
agenda_time_cl.appoint_time
=
this.Listtime.SelectedItem.ToString();
agenda_time_cl.time_flag
=
true;
}
private
void
PictureBox1_Click(object
sender,
EventArgs
e)
{
System.Windows.Forms. DialogResult
response;
if (agenda_time_cl.time_flag
==
true)
{
this.Close();
//fagenda_appoint.sub_timeok()
}
if (agenda_time_cl.time_flag
==
false)
{
response =
MessageBox.Show("Time,
not selected ...",
work_VCnet10.mainform.mainform_cl.Title,
MessageBoxButtons.YesNo,
System.Windows.Forms.MessageBoxIcon.Information);
//Gets the result of the MessageBox display.
if (response ==
DialogResult.Yes)
this.Close();
if (response ==
DialogResult.No)
return;
}
}
}
}
| | |
|
|