|
The Form design,
agenda_task.jsl
Create Visual J# .Net Forn - agenda_task.jsl
Classes used in this
Form:
PictureBox,
RadioButton, Button, ImageList, TextBox, Label,
GroupBox
- 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_task.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 p_high.bmp, p_low.bmp,
p_normal.bmp, btn_cancel.bmp,
btn_ok.bmp
|
2. |
The
agenda_task.jsl design |
|
 |
The Properties of
the Form - agenda_task.jsl... |
Name: Icon: Maximize: Menu: Size: Start
Position: Text: Window
State: |
agenda_task Icon False (none) 368,332 CenterScreen agenda_task
... Normal | | | |
3. |
From the Toolbox/Windows Form add these
controls . .3 PictureBox controls, 1 GroupBox
control, 3 RadioButton controls, 2 Button
controls, 1 ImageList control, 1 TextBox
control, 1 Label control |
|
- Add t3 PictureBox
control
- PicA1,
PictureBox Properties
Name: Image: Size
Mode: |
Picico System.Drawing.Bitmap Autosize | |
Bitmap file added = C:\work_VJnet\pic\p_high.bmp
- PicA2 -
Bitmap file added = C:\work_VJnet\pic\p_low.bmp
- Pic\A3 -
Bitmap file added = C:\work_VJnet\pic\p_normal.bmp
|
- Add the GroupBox
control - GroupBox1 Properties:
Name: Size: Text: |
GroupBox1 104, 84 task
prirority | |
- Add 2
RadioButton
controls
- rad_ligh,
RadioButton
Properties
- rad_low
Text:
low
- rad_normal
Text:
normal
|
- Add the Button
control
- btn_ok, Button
Properties
Name: ImageIndex: ImageList: Size: Text: |
btn_ok 0 ImageList1 65,24 | |
- btn_cancel
ImageIndex:
1
|
- Add the ImageList
control
-
ImageList1, ImageList
Properties:
Name: Images: ImageSize: |
ImageList1 (Collection)
- of 2 Bitmap
images 56,
36 | |
The
folder c:\work_VJnet\pic stored the
2 bmp files
btn_cancel.bmp, btn_ok.bmp
- Add the TextBox
control
- txtdescription,
TextBox Properties
Name: Multiline: Size: Text: |
txtdescription True 400,
84 | |
- Add the Label
control
- ldescription,
Label Properties
Name: Font: Size: Text: TextAlign: |
ldescription Microsoft Sans
Serif, 8.25pt 80, 16 description
TopLeft | | | | |
|
agenda_task.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 agenda_task.
*/
public
class
agenda_task
extends System.Windows.Forms.Form
{
System.Windows.Forms.Label ldescription;
System.Windows.Forms.Button Btn_ok;
System.Windows.Forms.ImageList ImageList1;
System.Windows.Forms.GroupBox GroupBox1;
System.Windows.Forms.PictureBox PicA3;
System.Windows.Forms.PictureBox PicA2;
System.Windows.Forms.PictureBox PicA1;
System.Windows.Forms.RadioButton Rad_low;
System.Windows.Forms.RadioButton Rad_normal;
System.Windows.Forms.RadioButton rad_ligh;
System.Windows.Forms.TextBox txtdescription;
System.Windows.Forms.Button Btn_cancel;
private
System.ComponentModel.IContainer components;
public
agenda_task()
{
//
// 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
agenda_task_cl
{
public static
boolean
task_flag;
}
private void
agenda_task_Load (Object sender, System.EventArgs e)
{
//new task
if
(work_VJnet.agenda.agenda_cl.task_type.Trim().Equals("new"))
{
this.set_Text("new
task");
this.txtdescription.set_Text("");
this.rad_ligh.set_Checked(false);
this.Rad_normal.set_Checked(true);
this.Rad_low.set_Checked(false);
work_VJnet.agenda.agenda_cl.task_prirority = "N";
}
//edit task
if
(work_VJnet.agenda.agenda_cl.task_type.Trim().Equals("edit"))
{
this.set_Text("edit
task");
this.txtdescription.set_Text(work_VJnet.agenda.agenda_cl.agenda_desc);
//task_prirority
value ...
if
(work_VJnet.agenda.agenda_cl.task_prirority.Trim().Equals("H"))
{
this.rad_ligh.set_Checked(true);
this.Rad_normal.set_Checked(false);
this.Rad_low.set_Checked(false);
}
if
(work_VJnet.agenda.agenda_cl.task_prirority.Trim().Equals("N"))
{
this.rad_ligh.set_Checked(false);
this.Rad_normal.set_Checked(true);
this.Rad_low.set_Checked(false);
}
if
(work_VJnet.agenda.agenda_cl.task_prirority.Trim().Equals("L"))
{
this.rad_ligh.set_Checked(false);
this.Rad_normal.set_Checked(false);
this.Rad_low.set_Checked(true);
}
}
agenda_task_cl.task_flag =
false;
this.Btn_cancel.set_Left((this.txtdescription.get_Left()
+ this.txtdescription.get_Width()) - this.Btn_cancel.get_Width());
this.Btn_ok.set_Enabled(false);
this.txtdescription.get_Focused();
}
private void
rad_ligh_CheckedChanged (Object sender, System.EventArgs
e)
{
if (this.rad_ligh.get_Checked()
== true)
{
this.Rad_normal.set_Checked(false);
this.Rad_low.set_Checked(false);
work_VJnet.agenda.agenda_cl.task_prirority = "H";
if (this.Btn_ok.get_Enabled()
== false)
this.Btn_ok.set_Enabled(true);
this.txtdescription.get_Focused();
}
}
private void
Rad_normal_CheckedChanged (Object sender,
System.EventArgs e)
{
if (this.Rad_normal.get_Checked()
== true)
{
this.rad_ligh.set_Checked(false);
this.Rad_low.set_Checked(false);
work_VJnet.agenda.agenda_cl.task_prirority = "N";
if (this.Btn_ok.get_Enabled()
== false)
this.Btn_ok.set_Enabled(true);
this.txtdescription.get_Focused();
}
}
private void
Rad_low_CheckedChanged (Object sender, System.EventArgs
e)
{
if (this.Rad_low.get_Checked()
== true)
{
this.rad_ligh.set_Checked(false);
this.Rad_normal.set_Checked(false);
work_VJnet.agenda.agenda_cl.task_prirority = "L";
if (this.Btn_ok.get_Enabled()
== false)
this.Btn_ok.set_Enabled(true);
this.txtdescription.get_Focused();
}
}
private void
txtdescription_TextChanged (Object sender,
System.EventArgs e)
{
if (this.Btn_ok.get_Enabled()
== false)
this.Btn_ok.set_Enabled(true);
}
private void
Btn_ok_Click (Object sender, System.EventArgs e)
{
if (this.txtdescription.get_Text().Trim().get_Length()
> 0)
{
if
(work_VJnet.agenda.agenda_cl.task_type.Trim().Equals("new"))
{
agenda_task_cl.task_flag =
true;
work_VJnet.agenda.agenda_cl.agenda_desc =
this.txtdescription.get_Text();
this.Close();
work_VJnet.agenda.get_ActiveForm().Refresh();
work_VJnet.agenda.get_ActiveForm().Activate();
}
if
(work_VJnet.agenda.agenda_cl.task_type.Trim().Equals("edit"))
{
agenda_task_cl.task_flag =
true;
work_VJnet.agenda.agenda_cl.agenda_desc =
this.txtdescription.get_Text();
this.Close();
work_VJnet.agenda.get_ActiveForm().Refresh();
work_VJnet.agenda.get_ActiveForm().Activate();
}
}
else
MessageBox.Show("description
value, empty ... not available",
work_VJnet.mainform.mainform_cl.Title,
MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Information);
}
private void
Btn_cancel_Click (Object sender, System.EventArgs e)
{
work_VJnet.agenda.agenda_cl.agenda_desc = "";
work_VJnet.agenda.agenda_cl.task_prirority = "";
this.Close();
work_VJnet.agenda.get_ActiveForm().Refresh();
work_VJnet.agenda.get_ActiveForm().Activate();
}
}
| | |
|
|