|
The Form design,
agenda_time.cs
Create Visual C# .Net Forn - agenda_time.cs
Classes used in this
Form: PictureBox,
Panel, RadioButton, ListBox
- On the View menu ,
click Solution Explorer
- In Solution
Explorer
In Solution Explorer, right click the
work_VCnet, select Add on the shortcut menu to
open other shortcut menu, click Add New Item,
the Add New Item - work_VCnet dialog box
appears. |

|
- In the Add New
Item -work_VCnet dialog box:
- In the
Categories pane, select Local Project
Items
- In the Templates
pane, select Windows form . A message
appears - (a form for Windows Applications).
- In the Name
box, type agenda_time.cs
- Click
Open
|

|
- In the windows
Forms Designer appears the empty window Form
design
|
1. |
Picture files used by this form ...
|
|
- The folder
c:\work_VCnet\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_VCnet\pic\
p_close..bmp
- PictureBox2
- Bitmap file added =
C:\work_VCnet\pic\
time_title.bmp
- Pic\A1 -
Bitmap file added = C:\work_VCnet\pic\time_am
.bmp
- PicA2 -
Bitmap file added = C:\work_VCnet\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
...
The
text
Code
is red color, the codes added manuel |
|
using
System;
using
System.Drawing;
using
System.Collections;
using
System.ComponentModel;
using
System.Windows.Forms;
namespace
work_VCnet
{
///
<summary>
///
Summary description for aganda_time.
///
</summary>
public
class
aganda_time : System.Windows.Forms.Form
{
internal
System.Windows.Forms.PictureBox PictureBox2;
internal
System.Windows.Forms.Panel Panel4;
internal
System.Windows.Forms.Panel Panel3;
internal
System.Windows.Forms.Panel Panel2;
internal
System.Windows.Forms.PictureBox PictureBox1;
internal
System.Windows.Forms.PictureBox PicA2;
internal
System.Windows.Forms.PictureBox PicA1;
internal
System.Windows.Forms.RadioButton RadPM;
internal
System.Windows.Forms.RadioButton RadAM;
internal
System.Windows.Forms.ListBox Listtime;
internal
System.Windows.Forms.Panel Panel1;
///
<summary>
///
Required designer variable.
///
</summary>
private
System.ComponentModel.Container components =
null;
// Variables
string
vj;
string
vi;
string
v_str;
int
vitem;
int
j;
int
j1;
int
i;
public
aganda_time()
{
//
// Required for
Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any
constructor code after InitializeComponent call
//
}
///
<summary>
///
Clean up any resources being used.
///
</summary>
protected
override
void
Dispose( bool
disposing )
{
if(
disposing )
{
if(components
!= null)
{
components.Dispose();
}
}
base.Dispose(
disposing );
}
Windows Form Designer
generated code |
// public variables
public class
aganda_time_cl
{
public static
bool time_flag;
public static
string
appoint_time;
}
private void
aganda_time_Load(object
sender, System.EventArgs e)
{
int
vleft;
int
vtop;
// Move
vleft =
work_VCnet.agenda_appoint.agenda_appoint_cl.appoint_left +
work_VCnet.agenda_appoint.agenda_appoint_cl.appointtxttime_Left;
vtop =
work_VCnet.agenda_appoint.agenda_appoint_cl.appoint_Top +
work_VCnet.agenda_appoint.agenda_appoint_cl.appointtxttime_Top
+ (work_VCnet.agenda_appoint.agenda_appoint_cl.appointtxttime_Height
* 5 )/ 2;
//vleft = 5;
//vtop = 5;
this.Left
= vleft;
this.Top
= vtop;
aganda_time_cl.time_flag =
false;
this.RadAM.Checked = true;
}
private void
RadAM_CheckedChanged(object
sender, System.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, System.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, System.EventArgs e)
{
aganda_time_cl.appoint_time =
this.Listtime.SelectedItem.ToString();
aganda_time_cl.time_flag =
true;
}
private void
PictureBox1_Click(object
sender, System.EventArgs e)
{
System.Windows.Forms.DialogResult
response;
if (aganda_time_cl.time_flag
== true)
{
this.Close();
//fagenda_appoint.sub_timeok()
}
if (aganda_time_cl.time_flag
== false)
{
response = MessageBox.Show("Time,
not selected ...", work_VCnet.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;
}
}
}
}
| | |
|
|