Không có gì tuyệt vời hơn là luyện tập với ví dụ thực tế. Nào cùng nhau thử thách bản thân với ứng dụng: Lập lịch.
Bạn nên có kiến thức về:
Lập trình Winform cơ bản Delegate – Event Timer NotifyIcon Registry Xử lý ngày tháng năm
Code Form1.Designer.cs
namespace Calender
{
partial class Form1
{
private System.ComponentModel.IContainer components = null ;
protected override void Dispose (bool disposing)
{
if (disposing && (components != null ))
{
components.Dispose();
}
base .Dispose(disposing);
}
#region Windows Form Designer generated code
private void InitializeComponent ()
{
this .panel1 = new System.Windows.Forms.Panel();
this .panel3 = new System.Windows.Forms.Panel();
this .panel6 = new System.Windows.Forms.Panel();
this .nmNotify = new System.Windows.Forms.NumericUpDown();
this .ckbNotify = new System.Windows.Forms.CheckBox();
this .btnToDay = new System.Windows.Forms.Button();
this .dtpkDate = new System.Windows.Forms.DateTimePicker();
this .panel2 = new System.Windows.Forms.Panel();
this .pnlMatrix = new System.Windows.Forms.Panel();
this .panel4 = new System.Windows.Forms.Panel();
this .btnNext = new System.Windows.Forms.Button();
this .btnPreviours = new System.Windows.Forms.Button();
this .btnSunday = new System.Windows.Forms.Button();
this .btnSaturday = new System.Windows.Forms.Button();
this .btnFriday = new System.Windows.Forms.Button();
this .btnThusday = new System.Windows.Forms.Button();
this .btnWednesday = new System.Windows.Forms.Button();
this .btnTuesday = new System.Windows.Forms.Button();
this .btnMonday = new System.Windows.Forms.Button();
this .panel1.SuspendLayout();
this .panel3.SuspendLayout();
this .panel6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this .nmNotify)).BeginInit();
this .panel2.SuspendLayout();
this .panel4.SuspendLayout();
this .SuspendLayout();
this .panel1.Controls.Add(this .panel3);
this .panel1.Controls.Add(this .panel2);
this .panel1.Location = new System.Drawing.Point(12 , 12 );
this .panel1.Name = "panel1" ;
this .panel1.Size = new System.Drawing.Size(741 , 356 );
this .panel1.TabIndex = 0 ;
this .panel3.Controls.Add(this .panel6);
this .panel3.Controls.Add(this .btnToDay);
this .panel3.Controls.Add(this .dtpkDate);
this .panel3.Location = new System.Drawing.Point(3 , 3 );
this .panel3.Name = "panel3" ;
this .panel3.Size = new System.Drawing.Size(735 , 28 );
this .panel3.TabIndex = 1 ;
this .panel6.Controls.Add(this .nmNotify);
this .panel6.Controls.Add(this .ckbNotify);
this .panel6.Location = new System.Drawing.Point(7 , 0 );
this .panel6.Name = "panel6" ;
this .panel6.Size = new System.Drawing.Size(210 , 28 );
this .panel6.TabIndex = 2 ;
this .nmNotify.Location = new System.Drawing.Point(81 , 3 );
this .nmNotify.Maximum = new decimal (new int [] {
3600 ,
0 ,
0 ,
0 });
this .nmNotify.Minimum = new decimal (new int [] {
1 ,
0 ,
0 ,
0 });
this .nmNotify.Name = "nmNotify" ;
this .nmNotify.Size = new System.Drawing.Size(60 , 20 );
this .nmNotify.TabIndex = 1 ;
this .nmNotify.Value = new decimal (new int [] {
1 ,
0 ,
0 ,
0 });
this .ckbNotify.AutoSize = true ;
this .ckbNotify.Location = new System.Drawing.Point(3 , 4 );
this .ckbNotify.Name = "ckbNotify" ;
this .ckbNotify.Size = new System.Drawing.Size(78 , 17 );
this .ckbNotify.TabIndex = 0 ;
this .ckbNotify.Text = "Thông báo" ;
this .ckbNotify.UseVisualStyleBackColor = true ;
this .btnToDay.Location = new System.Drawing.Point(493 , 0 );
this .btnToDay.Name = "btnToDay" ;
this .btnToDay.Size = new System.Drawing.Size(75 , 23 );
this .btnToDay.TabIndex = 1 ;
this .btnToDay.Text = "Hôm nay" ;
this .btnToDay.UseVisualStyleBackColor = true ;
this .btnToDay.Click += new System.EventHandler(this .btnToDay_Click);
this .dtpkDate.Location = new System.Drawing.Point(287 , 3 );
this .dtpkDate.Name = "dtpkDate" ;
this .dtpkDate.Size = new System.Drawing.Size(200 , 20 );
this .dtpkDate.TabIndex = 0 ;
this .dtpkDate.ValueChanged += new System.EventHandler(this .dtpkDate_ValueChanged);
this .panel2.Controls.Add(this .pnlMatrix);
this .panel2.Controls.Add(this .panel4);
this .panel2.Location = new System.Drawing.Point(3 , 37 );
this .panel2.Name = "panel2" ;
this .panel2.Size = new System.Drawing.Size(735 , 314 );
this .panel2.TabIndex = 0 ;
this .pnlMatrix.Location = new System.Drawing.Point(88 , 55 );
this .pnlMatrix.Name = "pnlMatrix" ;
this .pnlMatrix.Size = new System.Drawing.Size(561 , 254 );
this .pnlMatrix.TabIndex = 1 ;
this .panel4.Controls.Add(this .btnNext);
this .panel4.Controls.Add(this .btnPreviours);
this .panel4.Controls.Add(this .btnSunday);
this .panel4.Controls.Add(this .btnSaturday);
this .panel4.Controls.Add(this .btnFriday);
this .panel4.Controls.Add(this .btnThusday);
this .panel4.Controls.Add(this .btnWednesday);
this .panel4.Controls.Add(this .btnTuesday);
this .panel4.Controls.Add(this .btnMonday);
this .panel4.Location = new System.Drawing.Point(3 , 3 );
this .panel4.Name = "panel4" ;
this .panel4.Size = new System.Drawing.Size(729 , 46 );
this .panel4.TabIndex = 0 ;
this .btnNext.Location = new System.Drawing.Point(651 , 3 );
this .btnNext.Name = "btnNext" ;
this .btnNext.Size = new System.Drawing.Size(75 , 40 );
this .btnNext.TabIndex = 8 ;
this .btnNext.Text = "Tháng sau" ;
this .btnNext.UseVisualStyleBackColor = true ;
this .btnNext.Click += new System.EventHandler(this .btnNext_Click);
this .btnPreviours.Location = new System.Drawing.Point(4 , 3 );
this .btnPreviours.Name = "btnPreviours" ;
this .btnPreviours.Size = new System.Drawing.Size(75 , 40 );
this .btnPreviours.TabIndex = 7 ;
this .btnPreviours.Text = "Tháng trước" ;
this .btnPreviours.UseVisualStyleBackColor = true ;
this .btnPreviours.Click += new System.EventHandler(this .btnPreviours_Click);
this .btnSunday.Location = new System.Drawing.Point(571 , 3 );
this .btnSunday.Name = "btnSunday" ;
this .btnSunday.Size = new System.Drawing.Size(75 , 40 );
this .btnSunday.TabIndex = 6 ;
this .btnSunday.Text = "Chủ nhật" ;
this .btnSunday.UseVisualStyleBackColor = true ;
this .btnSaturday.Location = new System.Drawing.Point(490 , 3 );
this .btnSaturday.Name = "btnSaturday" ;
this .btnSaturday.Size = new System.Drawing.Size(75 , 40 );
this .btnSaturday.TabIndex = 5 ;
this .btnSaturday.Text = "Thứ 7" ;
this .btnSaturday.UseVisualStyleBackColor = true ;
this .btnFriday.Location = new System.Drawing.Point(409 , 3 );
this .btnFriday.Name = "btnFriday" ;
this .btnFriday.Size = new System.Drawing.Size(75 , 40 );
this .btnFriday.TabIndex = 4 ;
this .btnFriday.Text = "Thứ 6" ;
this .btnFriday.UseVisualStyleBackColor = true ;
this .btnThusday.Location = new System.Drawing.Point(328 , 3 );
this .btnThusday.Name = "btnThusday" ;
this .btnThusday.Size = new System.Drawing.Size(75 , 40 );
this .btnThusday.TabIndex = 3 ;
this .btnThusday.Text = "Thứ 5" ;
this .btnThusday.UseVisualStyleBackColor = true ;
this .btnWednesday.Location = new System.Drawing.Point(247 , 3 );
this .btnWednesday.Name = "btnWednesday" ;
this .btnWednesday.Size = new System.Drawing.Size(75 , 40 );
this .btnWednesday.TabIndex = 2 ;
this .btnWednesday.Text = "Thứ 4" ;
this .btnWednesday.UseVisualStyleBackColor = true ;
this .btnTuesday.Location = new System.Drawing.Point(166 , 3 );
this .btnTuesday.Name = "btnTuesday" ;
this .btnTuesday.Size = new System.Drawing.Size(75 , 40 );
this .btnTuesday.TabIndex = 1 ;
this .btnTuesday.Text = "Thứ 3" ;
this .btnTuesday.UseVisualStyleBackColor = true ;
this .btnMonday.Location = new System.Drawing.Point(85 , 3 );
this .btnMonday.Name = "btnMonday" ;
this .btnMonday.Size = new System.Drawing.Size(75 , 40 );
this .btnMonday.TabIndex = 0 ;
this .btnMonday.Text = "Thứ 2" ;
this .btnMonday.UseVisualStyleBackColor = true ;
this .AutoScaleDimensions = new System.Drawing.SizeF(6 F, 13 F);
this .AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this .ClientSize = new System.Drawing.Size(765 , 370 );
this .Controls.Add(this .panel1);
this .Name = "Form1" ;
this .Text = "Lập lịch công việc" ;
this .panel1.ResumeLayout(false );
this .panel3.ResumeLayout(false );
this .panel6.ResumeLayout(false );
this .panel6.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this .nmNotify)).EndInit();
this .panel2.ResumeLayout(false );
this .panel4.ResumeLayout(false );
this .ResumeLayout(false );
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.NumericUpDown nmNotify;
private System.Windows.Forms.CheckBox ckbNotify;
private System.Windows.Forms.Button btnToDay;
private System.Windows.Forms.DateTimePicker dtpkDate;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel pnlMatrix;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Button btnNext;
private System.Windows.Forms.Button btnPreviours;
private System.Windows.Forms.Button btnSunday;
private System.Windows.Forms.Button btnSaturday;
private System.Windows.Forms.Button btnFriday;
private System.Windows.Forms.Button btnThusday;
private System.Windows.Forms.Button btnWednesday;
private System.Windows.Forms.Button btnTuesday;
private System.Windows.Forms.Button btnMonday;
}
}
Code Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Calender
{
public partial class Form1 : Form
{
#region Peoperties
private List<List<Button>> matrix;
public List<List<Button>> Matrix
{
get { return matrix; }
set { matrix = value ; }
}
private List<string > dateOfWeek = new List<string >(){ "Monday" , "Tuesday" , "Wednesday" , "Thursday" , "Friday" , "Saturday" , "Sunday" };
#endregion
public Form1 ()
{
InitializeComponent();
LoadMatrix();
}
void LoadMatrix()
{
Matrix = new List<List<Button>>();
Button oldBtn = new Button() { Width = 0 , Height = 0 , Location = new Point(-Cons.margin, 0 ) };
for (int i = 0 ; i < Cons.DayOfColumn; i++)
{
Matrix.Add(new List<Button>());
for (int j = 0 ; j < Cons.DayOfWeek; j++)
{
Button btn = new Button() { Width = Cons.dateButtonWidth, Height = Cons.dateButtonHeight};
btn.Location = new Point(oldBtn.Location.X + oldBtn.Width + Cons.margin, oldBtn.Location.Y);
pnlMatrix.Controls.Add(btn);
Matrix[i].Add(btn);
oldBtn = btn;
}
oldBtn = new Button() { Width = 0 , Height = 0 , Location = new Point(-Cons.margin, oldBtn.Location.Y + Cons.dateButtonHeight) };
}
SetDefaultDate();
}
int DayOfMonth(DateTime date)
{
switch (date.Month)
{
case 1 :
case 3 :
case 5 :
case 7 :
case 8 :
case 10 :
case 12 :
return 31 ;
case 2 :
if ((date.Year % 4 == 0 && date.Year % 100 != 0 ) || date.Year % 400 == 0 )
return 29 ;
else
return 28 ;
default :
return 30 ;;
}
}
void AddNumberIntoMatrixByDate(DateTime date)
{
ClearMatrix();
DateTime useDate = new DateTime(date.Year, date.Month, 1 );
int line = 0 ;
for (int i = 1 ; i <= DayOfMonth(date); i++)
{
int column = dateOfWeek.IndexOf(useDate.DayOfWeek.ToString());
Button btn = Matrix[line][column];
btn.Text = i.ToString();
if (isEqualDate(useDate, DateTime.Now))
{
btn.BackColor = Color.Yellow;
}
if (isEqualDate(useDate, date))
{
btn.BackColor = Color.Aqua;
}
if (column >= 6 )
line++;
useDate = useDate.AddDays(1 );
}
}
bool isEqualDate(DateTime dateA, DateTime dateB)
{
return dateA.Year == dateB.Year && dateA.Month == dateB.Month && dateA.Day == dateB.Day;
}
void ClearMatrix()
{
for (int i = 0 ; i < Matrix.Count; i++)
{
for (int j = 0 ; j < Matrix[i].Count; j++)
{
Button btn = Matrix[i][j];
btn.Text = "" ;
btn.BackColor = Color.WhiteSmoke;
}
}
}
void SetDefaultDate()
{
dtpkDate.Value = DateTime.Now;
}
private void dtpkDate_ValueChanged (object sender, EventArgs e)
{
AddNumberIntoMatrixByDate((sender as DateTimePicker).Value);
}
private void btnNext_Click (object sender, EventArgs e)
{
dtpkDate.Value = dtpkDate.Value.AddMonths(1 );
}
private void btnPreviours_Click (object sender, EventArgs e)
{
dtpkDate.Value = dtpkDate.Value.AddMonths(-1 );
}
private void btnToDay_Click (object sender, EventArgs e)
{
SetDefaultDate();
}
}
}
Code DailyPlan.Designer.cs
namespace Calender
{
partial class DailyPlan
{
private System.ComponentModel.IContainer components = null ;
protected override void Dispose (bool disposing)
{
if (disposing && (components != null ))
{
components.Dispose();
}
base .Dispose(disposing);
}
#region Windows Form Designer generated code
private void InitializeComponent ()
{
this .panel1 = new System.Windows.Forms.Panel();
this .pnlJob = new System.Windows.Forms.Panel();
this .dtpkDate = new System.Windows.Forms.DateTimePicker();
this .mnsMain = new System.Windows.Forms.MenuStrip();
this .mnsiAddJob = new System.Windows.Forms.ToolStripMenuItem();
this .mnsiToDay = new System.Windows.Forms.ToolStripMenuItem();
this .panel3 = new System.Windows.Forms.Panel();
this .btnNextDay = new System.Windows.Forms.Button();
this .btnPrevioursDay = new System.Windows.Forms.Button();
this .panel1.SuspendLayout();
this .mnsMain.SuspendLayout();
this .panel3.SuspendLayout();
this .SuspendLayout();
this .panel1.Controls.Add(this .panel3);
this .panel1.Controls.Add(this .pnlJob);
this .panel1.Location = new System.Drawing.Point(12 , 27 );
this .panel1.Name = "panel1" ;
this .panel1.Size = new System.Drawing.Size(754 , 484 );
this .panel1.TabIndex = 0 ;
this .pnlJob.Location = new System.Drawing.Point(3 , 32 );
this .pnlJob.Name = "pnlJob" ;
this .pnlJob.Size = new System.Drawing.Size(748 , 447 );
this .pnlJob.TabIndex = 0 ;
this .dtpkDate.Location = new System.Drawing.Point(265 , 4 );
this .dtpkDate.Name = "dtpkDate" ;
this .dtpkDate.Size = new System.Drawing.Size(200 , 20 );
this .dtpkDate.TabIndex = 1 ;
this .mnsMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this .mnsiAddJob,
this .mnsiToDay});
this .mnsMain.Location = new System.Drawing.Point(0 , 0 );
this .mnsMain.Name = "mnsMain" ;
this .mnsMain.Size = new System.Drawing.Size(775 , 24 );
this .mnsMain.TabIndex = 1 ;
this .mnsMain.Text = "menuStrip1" ;
this .mnsiAddJob.Name = "mnsiAddJob" ;
this .mnsiAddJob.Size = new System.Drawing.Size(74 , 20 );
this .mnsiAddJob.Text = "Thêm việc" ;
this .mnsiToDay.Name = "mnsiToDay" ;
this .mnsiToDay.Size = new System.Drawing.Size(68 , 20 );
this .mnsiToDay.Text = "Hôm nay" ;
this .panel3.Controls.Add(this .btnPrevioursDay);
this .panel3.Controls.Add(this .btnNextDay);
this .panel3.Controls.Add(this .dtpkDate);
this .panel3.Location = new System.Drawing.Point(3 , 3 );
this .panel3.Name = "panel3" ;
this .panel3.Size = new System.Drawing.Size(748 , 27 );
this .panel3.TabIndex = 1 ;
this .btnNextDay.Location = new System.Drawing.Point(670 , 3 );
this .btnNextDay.Name = "btnNextDay" ;
this .btnNextDay.Size = new System.Drawing.Size(75 , 23 );
this .btnNextDay.TabIndex = 2 ;
this .btnNextDay.Text = "Ngày mai" ;
this .btnNextDay.UseVisualStyleBackColor = true ;
this .btnPrevioursDay.Location = new System.Drawing.Point(3 , 1 );
this .btnPrevioursDay.Name = "btnPrevioursDay" ;
this .btnPrevioursDay.Size = new System.Drawing.Size(75 , 23 );
this .btnPrevioursDay.TabIndex = 3 ;
this .btnPrevioursDay.Text = "Hôm qua" ;
this .btnPrevioursDay.UseVisualStyleBackColor = true ;
this .AutoScaleDimensions = new System.Drawing.SizeF(6 F, 13 F);
this .AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this .ClientSize = new System.Drawing.Size(775 , 511 );
this .Controls.Add(this .panel1);
this .Controls.Add(this .mnsMain);
this .MainMenuStrip = this .mnsMain;
this .Name = "DailyPlan" ;
this .Text = "Lịch trong ngày" ;
this .panel1.ResumeLayout(false );
this .mnsMain.ResumeLayout(false );
this .mnsMain.PerformLayout();
this .panel3.ResumeLayout(false );
this .ResumeLayout(false );
this .PerformLayout();
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Button btnPrevioursDay;
private System.Windows.Forms.Button btnNextDay;
private System.Windows.Forms.DateTimePicker dtpkDate;
private System.Windows.Forms.Panel pnlJob;
private System.Windows.Forms.MenuStrip mnsMain;
private System.Windows.Forms.ToolStripMenuItem mnsiAddJob;
private System.Windows.Forms.ToolStripMenuItem mnsiToDay;
}
}
Code DailyPlan.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Calender
{
public partial class DailyPlan : Form
{
public DailyPlan ()
{
InitializeComponent();
}
}
}
Code AJob.Designer.cs
namespace Calender
{
partial class AJob
{
private System.ComponentModel.IContainer components = null ;
protected override void Dispose (bool disposing)
{
if (disposing && (components != null ))
{
components.Dispose();
}
base .Dispose(disposing);
}
#region Component Designer generated code
private void InitializeComponent ()
{
this .panel1 = new System.Windows.Forms.Panel();
this .ckbDone = new System.Windows.Forms.CheckBox();
this .txbJob = new System.Windows.Forms.TextBox();
this .panel2 = new System.Windows.Forms.Panel();
this .nmFromHours = new System.Windows.Forms.NumericUpDown();
this .nmFromMinute = new System.Windows.Forms.NumericUpDown();
this .label1 = new System.Windows.Forms.Label();
this .nmToMinute = new System.Windows.Forms.NumericUpDown();
this .nmToHours = new System.Windows.Forms.NumericUpDown();
this .cbStatus = new System.Windows.Forms.ComboBox();
this .btnEdit = new System.Windows.Forms.Button();
this .btnDelete = new System.Windows.Forms.Button();
this .panel1.SuspendLayout();
this .panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this .nmFromHours)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this .nmFromMinute)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this .nmToMinute)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this .nmToHours)).BeginInit();
this .SuspendLayout();
this .panel1.Controls.Add(this .btnDelete);
this .panel1.Controls.Add(this .btnEdit);
this .panel1.Controls.Add(this .cbStatus);
this .panel1.Controls.Add(this .panel2);
this .panel1.Controls.Add(this .txbJob);
this .panel1.Controls.Add(this .ckbDone);
this .panel1.Location = new System.Drawing.Point(3 , 0 );
this .panel1.Name = "panel1" ;
this .panel1.Size = new System.Drawing.Size(747 , 30 );
this .panel1.TabIndex = 0 ;
this .ckbDone.AutoSize = true ;
this .ckbDone.Location = new System.Drawing.Point(3 , 3 );
this .ckbDone.Name = "ckbDone" ;
this .ckbDone.Size = new System.Drawing.Size(15 , 14 );
this .ckbDone.TabIndex = 0 ;
this .ckbDone.UseVisualStyleBackColor = true ;
this .txbJob.Location = new System.Drawing.Point(24 , 0 );
this .txbJob.Name = "txbJob" ;
this .txbJob.Size = new System.Drawing.Size(308 , 20 );
this .txbJob.TabIndex = 1 ;
this .panel2.Controls.Add(this .nmToMinute);
this .panel2.Controls.Add(this .nmToHours);
this .panel2.Controls.Add(this .label1);
this .panel2.Controls.Add(this .nmFromMinute);
this .panel2.Controls.Add(this .nmFromHours);
this .panel2.Location = new System.Drawing.Point(338 , 0 );
this .panel2.Name = "panel2" ;
this .panel2.Size = new System.Drawing.Size(200 , 30 );
this .panel2.TabIndex = 2 ;
this .nmFromHours.Location = new System.Drawing.Point(3 , 3 );
this .nmFromHours.Name = "nmFromHours" ;
this .nmFromHours.Size = new System.Drawing.Size(37 , 20 );
this .nmFromHours.TabIndex = 0 ;
this .nmFromMinute.Location = new System.Drawing.Point(46 , 3 );
this .nmFromMinute.Name = "nmFromMinute" ;
this .nmFromMinute.Size = new System.Drawing.Size(37 , 20 );
this .nmFromMinute.TabIndex = 1 ;
this .label1.AutoSize = true ;
this .label1.Location = new System.Drawing.Point(89 , 5 );
this .label1.Name = "label1" ;
this .label1.Size = new System.Drawing.Size(27 , 13 );
this .label1.TabIndex = 2 ;
this .label1.Text = "Đến" ;
this .nmToMinute.Location = new System.Drawing.Point(160 , 3 );
this .nmToMinute.Name = "nmToMinute" ;
this .nmToMinute.Size = new System.Drawing.Size(37 , 20 );
this .nmToMinute.TabIndex = 4 ;
this .nmToHours.Location = new System.Drawing.Point(117 , 3 );
this .nmToHours.Name = "nmToHours" ;
this .nmToHours.Size = new System.Drawing.Size(37 , 20 );
this .nmToHours.TabIndex = 3 ;
this .cbStatus.FormattingEnabled = true ;
this .cbStatus.Location = new System.Drawing.Point(541 , 2 );
this .cbStatus.Name = "cbStatus" ;
this .cbStatus.Size = new System.Drawing.Size(103 , 21 );
this .cbStatus.TabIndex = 3 ;
this .btnEdit.Location = new System.Drawing.Point(650 , 0 );
this .btnEdit.Name = "btnEdit" ;
this .btnEdit.Size = new System.Drawing.Size(45 , 23 );
this .btnEdit.TabIndex = 4 ;
this .btnEdit.Text = "Sửa" ;
this .btnEdit.UseVisualStyleBackColor = true ;
this .btnDelete.Location = new System.Drawing.Point(699 , 0 );
this .btnDelete.Name = "btnDelete" ;
this .btnDelete.Size = new System.Drawing.Size(45 , 23 );
this .btnDelete.TabIndex = 5 ;
this .btnDelete.Text = "Xóa" ;
this .btnDelete.UseVisualStyleBackColor = true ;
this .AutoScaleDimensions = new System.Drawing.SizeF(6 F, 13 F);
this .AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this .Controls.Add(this .panel1);
this .Name = "AJob" ;
this .Size = new System.Drawing.Size(753 , 33 );
this .panel1.ResumeLayout(false );
this .panel1.PerformLayout();
this .panel2.ResumeLayout(false );
this .panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this .nmFromHours)).EndInit();
((System.ComponentModel.ISupportInitialize)(this .nmFromMinute)).EndInit();
((System.ComponentModel.ISupportInitialize)(this .nmToMinute)).EndInit();
((System.ComponentModel.ISupportInitialize)(this .nmToHours)).EndInit();
this .ResumeLayout(false );
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.NumericUpDown nmFromHours;
private System.Windows.Forms.TextBox txbJob;
private System.Windows.Forms.CheckBox ckbDone;
private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.Button btnEdit;
private System.Windows.Forms.ComboBox cbStatus;
private System.Windows.Forms.NumericUpDown nmToMinute;
private System.Windows.Forms.NumericUpDown nmToHours;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.NumericUpDown nmFromMinute;
}
}
Code AJob.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Calender
{
public partial class AJob : UserControl
{
public AJob ()
{
InitializeComponent();
}
}
}
Code Cons.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Calender
{
class Cons
{
public static int DayOfWeek = 7 ;
public static int DayOfColumn = 6 ;
public static int dateButtonWidth = 75 ;
public static int dateButtonHeight = 40 ;
public static int margin = 6 ;
}
}
Bài sau chúng ta sẽ cùng nhau tạo cấu trúc công việc.
Đừng quên: “Luyện tập – Thử thách – Không ngại khó ”
Tải xuống
Tài liệu
Nhằm phục vụ mục đích học tập Offline của cộng đồng, Kteam hỗ trợ tính năng lưu trữ nội dung bài học Hiển thị lịch theo ngày được chọn ứng dụng Lập lịch C# Winform dưới dạng file PDF trong link bên dưới.
Ngoài ra, bạn cũng có thể tìm thấy các tài liệu được đóng góp từ cộng đồng ở mục TÀI LIỆU trên thư viện Howkteam.com
Đừng quên like và share để ủng hộ Kteam và tác giả nhé!
Thảo luận
Nếu bạn có bất kỳ khó khăn hay thắc mắc gì về khóa học, đừng ngần ngại đặt câu hỏi trong phần BÌNH LUẬN bên dưới hoặc trong mục HỎI & ĐÁP trên thư viện Howkteam.com để nhận được sự hỗ trợ từ cộng đồng.
Cho em hỏi chỗ ClearMatrix, khi em thêm nó vào hàm thêm số vào ma trận thì nó đứng luôn máy ạ
Làm ơn cho em hỏi chỗ hiển thị ngày trên button e làm tại sao đến ngày thứ 4 nó k xác định được column số mấy ạ,lúc đó column nó ra -1,ngày thứ 1,2,3 thì nó xác định được,nhưng cứ sang ngày thứ 4 là column=-1. Giải thích giúp e với ạ. Em cảm ơn
Em cảm ơn team đã ra seri hướng dẫn ạ,nhưng ở chỗ hiển thị ngày trên button e làm tại sao đến ngày thứ 4 nó k xác định được column số mấy ạ,lúc đó column nó bay ra -1,ngày thứ 1,2,3 thì nó xác định được,nhưng cứ sang ngày thứ 4 là column=-1.A có thể giải thích giúp e dc k ạ?E cảm ơn nhiều.