1 using System.Windows.Forms;
\r
2 using System.Drawing;
\r
3 using com.andoutomo.kybernetes.data.DAO;
\r
6 namespace com.andoutomo.kybernetes.view
\r
8 internal class PanelController
\r
10 private BaseForm baseForm;
\r
11 internal PanelController(BaseForm form)
\r
13 this.baseForm = form;
\r
15 internal Panel createRow(int point,TaskData data)
\r
17 Panel rowPanel=new Panel();
\r
18 Color frColor = Color.FromArgb(data.FrColor);
\r
19 Color bgColor = Color.FromArgb(data.BgColor);
\r
21 FontStyle timeStyle;
\r
25 if (data.ForecastMin >= 90|| data.RealMin >=90)
\r
30 if (data.isComplete)
\r
32 style = FontStyle.Strikeout;
\r
33 timeStyle = FontStyle.Strikeout;
\r
34 frColor = Color.Gray;
\r
36 else if (data.ForecastMin >= 120 || data.RealMin >=120)
\r
38 style = FontStyle.Regular;
\r
39 timeStyle = FontStyle.Bold;
\r
43 timeStyle = FontStyle.Regular;
\r
44 style = FontStyle.Regular;
\r
47 else if (data.ForecastMin >= 60 || data.RealMin >= 60)
\r
52 if (data.isComplete)
\r
54 timeStyle = FontStyle.Strikeout;
\r
55 style = FontStyle.Strikeout;
\r
56 frColor = Color.Gray;
\r
60 timeStyle = FontStyle.Regular;
\r
61 style = FontStyle.Regular;
\r
70 if (data.isComplete)
\r
72 timeStyle = FontStyle.Strikeout;
\r
73 style = FontStyle.Strikeout;
\r
74 frColor = Color.Gray;
\r
78 timeStyle = FontStyle.Regular;
\r
79 style = FontStyle.Regular;
\r
83 //全体サイズからContentの長さを決める。
\r
85 int wkPanelSize = baseForm.getPanelSize();
\r
87 int wkContentSize = wkPanelSize - 570;
\r
88 int wkDelaySize = wkContentSize - 210;
\r
89 sortID = data.SortID;
\r
91 rowPanel.Controls.Add(new CustomLabel(data.Indicator, frColor, bgColor, FontStyle.Regular, 9F, 0, 21, rowsize,ContentAlignment.MiddleCenter));
\r
92 rowPanel.Controls.Add(new CustomLabel(data.DoDate.getDateString(), frColor, bgColor, style, 9F, 20, 56, rowsize,ContentAlignment.MiddleCenter));
\r
93 rowPanel.Controls.Add(new CustomLabel(data.DoDate.getDowStr(), frColor, bgColor, style, 9F, 75, 26, rowsize,ContentAlignment.MiddleCenter));
\r
94 rowPanel.Controls.Add(new CustomLabel(data.TimeArea, frColor, bgColor, style, 9F, 100, 21, rowsize,ContentAlignment.MiddleCenter));
\r
95 rowPanel.Controls.Add(new CustomLabel(data.SortID.ToString(), frColor, bgColor, style, 9F, 120, 41, rowsize,ContentAlignment.MiddleRight));
\r
96 rowPanel.Controls.Add(new CustomLabel(data.Category, frColor, bgColor, style, 9F, 160, 81, rowsize));
\r
97 rowPanel.Controls.Add(new CustomLabel(data.Contents, frColor, bgColor, style, 9F, 240, wkContentSize + 1, rowsize));
\r
98 rowPanel.Controls.Add(new CustomLabel(data.getForcastHourStr, frColor, bgColor, timeStyle, fontsize, wkDelaySize + 450, 51, rowsize,ContentAlignment.MiddleRight));
\r
99 rowPanel.Controls.Add(new CustomLabel(data.ForecastMin.ToString(), frColor, bgColor, timeStyle, fontsize, wkDelaySize + 500, 51, rowsize, ContentAlignment.MiddleRight));
\r
100 rowPanel.Controls.Add(new CustomLabel(data.RealMin.ToString(), frColor, bgColor, timeStyle, fontsize, wkDelaySize + 550, 51, rowsize, ContentAlignment.MiddleRight));
\r
101 rowPanel.Controls.Add(new CustomLabel(data.StartTime.ToString(), frColor, bgColor, style, 9F, wkDelaySize + 600, 61, rowsize, ContentAlignment.MiddleCenter));
\r
102 rowPanel.Controls.Add(new CustomLabel(data.EndTime.ToString(), frColor, bgColor, style, 9F, wkDelaySize + 660, 61, rowsize, ContentAlignment.MiddleCenter));
\r
103 rowPanel.Controls.Add(new CustomLabel((data.IsRepeat == 1 ? "R" : ""), frColor, bgColor, style, 9F, wkDelaySize + 720, 21, rowsize, ContentAlignment.MiddleCenter));
\r
104 rowPanel.Controls.Add(new CustomLabel((data.HasComment == 1 ? "*" : ""), frColor, bgColor, style, 9F, wkDelaySize + 740, 21, rowsize, ContentAlignment.MiddleCenter));
\r
106 rowPanel.Location = new Point(0, point);
\r
107 rowPanel.Size = new Size(wkPanelSize - 19, rowsize);
\r
109 rowPanel.TabStop = false;
\r
110 foreach (Control eachControls in rowPanel.Controls)
\r
112 eachControls.DoubleClick += new System.EventHandler(rowPanelDblClickAction);
\r
117 private int sortID;
\r
119 private void rowPanelDblClickAction(object sender, EventArgs args)
\r
121 baseForm.AddIDToText(sortID.ToString());
\r
128 internal class CustomLabel:Label
\r
130 internal CustomLabel(string text,Color FRColor,Color BGColor,FontStyle style,float size,int location,int colsize,int rowSize)
\r
132 //innerLabel = new Label();
\r
135 this.BackColor = BGColor;
\r
136 this.ForeColor = FRColor;
\r
137 this.Font = new Font("MS UI Gothic", size, style, GraphicsUnit.Point, 128);
\r
138 this.Location = new Point(location, 0);
\r
139 this.Size = new Size(colsize, rowSize);
\r
142 this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
\r
144 this.TextAlign = ContentAlignment.MiddleLeft;
\r
145 this.Anchor = (AnchorStyles.Left | AnchorStyles.Top);
\r
147 internal CustomLabel(string text, Color FRColor, Color BGColor, FontStyle style, float size, int location, int colsize, int rowSize, ContentAlignment align)
\r
148 :this(text,FRColor,BGColor,style,size,location,colsize,rowSize)
\r
150 this.TextAlign = align;
\r