|
The Form design,
agenda_time.jsl
Create Visual J# .Net Forn - agenda_time.jsl
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_VJnet, select Add on the shortcut menu to
open other shortcut menu, click Add New Item,
the Add New Item - work_VJnet dialog box
appears. |

|
- In the Add New
Item -work_VJnet 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.jsl
- Click
Open
|

|
- In the windows
Forms Designer appears the empty window Form
design
|
1. |
Picture files used by this form ...
|
|
- The folder
c:\work_VJnet\pic stored the bmp
files time_am.bmp, time_pm.bmp,
time_title.bmp, p_close.bmp
|
2. |
The
agenda_time.jsl design |
|
 |
The Properties of
the Form - agenda_time.jsl... |
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_VJnet\pic\
p_close..bmp
- PictureBox2
- Bitmap file added =
C:\work_VJnet\pic\
time_title.bmp
- Pic\A1 -
Bitmap file added = C:\work_VJnet\pic\time_am
.bmp
- PicA2 -
Bitmap file added = C:\work_VJnet\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.jsl file, the codes after modification
...
The
text
Code is
red
color, the codes added
manuel |
|
package
work_VJnet;
import System.Drawing.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;
/**
* Summary description for aganda_time.
*/
public
class
aganda_time
extends System.Windows.Forms.Form
{
System.Windows.Forms.PictureBox PictureBox2;
System.Windows.Forms.Panel Panel4;
System.Windows.Forms.Panel Panel3;
System.Windows.Forms.Panel Panel2;
System.Windows.Forms.PictureBox PictureBox1;
System.Windows.Forms.PictureBox PicA2;
System.Windows.Forms.PictureBox PicA1;
System.Windows.Forms.RadioButton RadPM;
System.Windows.Forms.RadioButton RadAM;
System.Windows.Forms.ListBox Listtime;
System.Windows.Forms.Panel Panel1;
/**
* Required designer variable.
*/
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
//
}
/**
* Clean up any resources being used.
*/
protected
void
Dispose(boolean
disposing)
{
if
(disposing)
{
if
(components !=
null)
{
components.Dispose();
}
}
super.Dispose(disposing);
}
Windows Form Designer
generated code |
public static class
aganda_time_cl
{
public static
boolean
time_flag;
public static
String appoint_time;
}
private void
aganda_time_Load (Object sender, System.EventArgs e)
{
int
vleft = 0;
int
vtop = 0;
// Move
vleft =
work_VJnet.agenda_appoint.agenda_appoint_cl.appoint_left
+
work_VJnet.agenda_appoint.agenda_appoint_cl.appointtxttime_Left;
vtop =
work_VJnet.agenda_appoint.agenda_appoint_cl.appoint_Top
+
work_VJnet.agenda_appoint.agenda_appoint_cl.appointtxttime_Top
+ (work_VJnet.agenda_appoint.agenda_appoint_cl.appointtxttime_Height
* 5 )/ 2;
this.set_Left(vleft);
this.set_Top(vtop);
aganda_time_cl.time_flag =
false;
this.RadAM.set_Checked(true);
}
private void
RadAM_CheckedChanged (Object sender, System.EventArgs e)
{
if (this.Listtime.get_Items().get_Count()
> 0)
{
vitem = ( this.Listtime.get_Items().get_Count()
- 1);
this.Listtime.get_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.get_Items().Add(v_str.Trim());
}
}
if (this.RadAM.get_Checked()
== true)
this.RadPM.set_Checked(false);
}
private void
RadPM_CheckedChanged (Object sender, System.EventArgs e)
{
if (this.Listtime.get_Items().get_Count()
> 0)
{
vitem = ( this.Listtime.get_Items().get_Count()
- 1);
this.Listtime.get_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.get_Items().Add(v_str.Trim());
}
}
if (this.RadPM.get_Checked()
== true)
this.RadAM.set_Checked(false);
}
private void
Listtime_SelectedIndexChanged (Object sender,
System.EventArgs e)
{
aganda_time_cl.appoint_time =
this.Listtime.get_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_VJnet.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;
}
}
}
| | |
|
|