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 - 689;
\r
88 int wkDelaySize = wkContentSize - 211;
\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.SortID.ToString(), frColor, bgColor, style, 9F, 0, 41, rowsize, ContentAlignment.MiddleRight));
\r
93 rowPanel.Controls.Add(new CustomLabel(data.DoDate.getDateString(), frColor, bgColor, style, 9F, 40, 56, rowsize,ContentAlignment.MiddleCenter));
\r
94 rowPanel.Controls.Add(new CustomLabel(data.DoDate.getDowStr(), frColor, bgColor, style, 9F, 95, 26, rowsize,ContentAlignment.MiddleCenter));
\r
95 rowPanel.Controls.Add(new CustomLabel(data.TimeArea, frColor, bgColor, style, 9F, 120, 21, rowsize,ContentAlignment.MiddleCenter));
\r
96 rowPanel.Controls.Add(new CustomLabel(data.Category, frColor, bgColor, style, 9F, 140, 81, rowsize));
\r
97 rowPanel.Controls.Add(new CustomLabel(data.Contents, frColor, bgColor, style, 9F, 220, wkContentSize, rowsize));
\r
98 rowPanel.Controls.Add(new CustomLabel(data.getForcastHourStr, frColor, bgColor, timeStyle, fontsize, wkDelaySize + 430, 51, rowsize,ContentAlignment.MiddleRight));
\r
99 rowPanel.Controls.Add(new CustomLabel(data.ForecastMin.ToString(), frColor, bgColor, timeStyle, fontsize, wkDelaySize + 480, 51, rowsize, ContentAlignment.MiddleRight));
\r
100 rowPanel.Controls.Add(new CustomLabel(data.RealMin.ToString(), frColor, bgColor, timeStyle, fontsize, wkDelaySize + 530, 51, rowsize, ContentAlignment.MiddleRight));
\r
101 rowPanel.Controls.Add(new CustomLabel(data.StartTime.ToString(), frColor, bgColor, style, 9F, wkDelaySize + 580, 61, rowsize, ContentAlignment.MiddleCenter));
\r
102 rowPanel.Controls.Add(new CustomLabel(data.EndTime.ToString(), frColor, bgColor, style, 9F, wkDelaySize + 640, 61, rowsize, ContentAlignment.MiddleCenter));
\r
104 rowPanel.Controls.Add(new CustomLabel(data.Project, frColor, bgColor, style, 9F, wkDelaySize + 700, 81, rowsize));
\r
105 rowPanel.Controls.Add(new CustomLabel((data.IsRepeat == 1 ? "R" : ""), frColor, bgColor, style, 9F, wkDelaySize + 780, 21, rowsize, ContentAlignment.MiddleCenter));
\r
106 rowPanel.Controls.Add(new CustomLabel((data.HasComment == 1 ? "*" : ""), frColor, bgColor, style, 9F, wkDelaySize + 800, 21, rowsize, ContentAlignment.MiddleCenter));
\r
107 rowPanel.Controls.Add(new CustomLabel((string.IsNullOrEmpty(data.Tags) ? "" : "*"), frColor, bgColor, style, 9F, wkDelaySize + 820, 21, rowsize, ContentAlignment.MiddleCenter,data.Tags));
\r
108 rowPanel.Controls.Add(new CustomLabel(data.SortID.ToString(), frColor, bgColor, style, 9F, wkDelaySize + 840, 41, rowsize, ContentAlignment.MiddleRight));
\r
110 rowPanel.Location = new Point(0, point);
\r
111 rowPanel.Size = new Size(wkPanelSize - 19, rowsize);
\r
113 rowPanel.TabStop = false;
\r
114 foreach (Control eachControls in rowPanel.Controls)
\r
116 eachControls.DoubleClick += new System.EventHandler(rowPanelDblClickAction);
\r
121 private int sortID;
\r
123 private void rowPanelDblClickAction(object sender, EventArgs args)
\r
125 baseForm.AddIDToText(sortID.ToString());
\r
130 internal class CustomLabel:Label
\r
132 internal CustomLabel(string text,Color FRColor,Color BGColor,FontStyle style,float size,int location,int colsize,int rowSize)
\r
134 //innerLabel = new Label();
\r
137 this.BackColor = BGColor;
\r
138 this.ForeColor = FRColor;
\r
139 this.Font = new Font("MS UI Gothic", size, style, GraphicsUnit.Point, 128);
\r
140 this.Location = new Point(location, 0);
\r
141 this.Size = new Size(colsize, rowSize);
\r
144 this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
\r
146 this.TextAlign = ContentAlignment.MiddleLeft;
\r
147 this.Anchor = (AnchorStyles.Left | AnchorStyles.Top);
\r
149 internal CustomLabel(string text, Color FRColor, Color BGColor, FontStyle style, float size, int location, int colsize, int rowSize, ContentAlignment align)
\r
150 :this(text,FRColor,BGColor,style,size,location,colsize,rowSize)
\r
152 this.TextAlign = align;
\r
155 internal CustomLabel(string text, Color FRColor, Color BGColor, FontStyle style, float size, int location, int colsize, int rowSize, ContentAlignment align, string tooltipStr)
\r
156 : this(text, FRColor, BGColor, style, size, location, colsize, rowSize,align)
\r
158 ToolTip pop = new ToolTip();
\r
160 //ToolTipが表示されるまでの時間
\r
161 pop.InitialDelay = 500;
\r
162 //ToolTipが表示されている時に、別のToolTipを表示するまでの時間
\r
163 pop.ReshowDelay = 100;
\r
165 pop.AutoPopDelay = 4000;
\r
166 //フォームがアクティブでない時でもToolTipを表示する
\r
167 pop.ShowAlways = false;
\r
169 //このオブジェクトにToolTipが表示されるようにする
\r
170 pop.SetToolTip(this, tooltipStr);
\r