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 public class PanelController
\r
10 public static displayMode mode;
\r
13 private BaseForm baseForm;
\r
14 public PanelController(BaseForm form)
\r
16 this.baseForm = form;
\r
18 public Panel createRow(int point,TaskData data)
\r
20 Panel rowPanel=new Panel();
\r
21 Color frColor = Color.White;
\r
22 Color ctgFrColor = Color.White;
\r
23 if (!string.IsNullOrEmpty(data.Category))
\r
25 frColor = Color.FromArgb(data.FrColor);
\r
27 //カテゴリ用だけ、元の設定色を保持しておく。
\r
28 ctgFrColor = Color.FromArgb(data.FrColor);
\r
31 FontStyle timeStyle;
\r
33 float contentFontSize;
\r
36 if (data.isComplete)
\r
38 //完了済みの場合は実測時間からサイズを判断
\r
39 timeStyle = FontStyle.Strikeout;
\r
40 style = FontStyle.Strikeout;
\r
41 frColor = Color.Gray;
\r
44 if (data.RealMin >= 120)
\r
47 contentFontSize = 12F;
\r
50 else if (data.RealMin >= 90)
\r
53 contentFontSize = 12F;
\r
56 else if (data.RealMin >= 60)
\r
60 contentFontSize = 9F;
\r
66 contentFontSize = 9F;
\r
72 //未完了の場合は予測時間からサイズを判断
\r
73 if (data.ForecastMin >= 120)
\r
76 contentFontSize = 12F;
\r
79 else if (data.ForecastMin >= 90)
\r
82 contentFontSize = 12F;
\r
85 else if (data.ForecastMin >= 60)
\r
88 contentFontSize = 9F;
\r
94 contentFontSize = 9F;
\r
98 if (data.StartTime.IsValid)
\r
100 timeStyle = FontStyle.Underline;
\r
101 style = FontStyle.Underline | FontStyle.Bold;
\r
106 timeStyle = FontStyle.Regular;
\r
107 style = FontStyle.Regular;
\r
110 //全体サイズからContentの長さを決める。
\r
112 int wkPanelSize = baseForm.getPanelSize();
\r
114 int wkContentAdditional = wkPanelSize - 825;
\r
115 if (wkContentAdditional < 0) wkContentAdditional = 0;
\r
116 //int wkContentSize = wkPanelSize - 689;
\r
117 int wkDelaySize = 395 + wkContentAdditional;
\r
119 sortID = data.SortID;
\r
120 //rowPanel.Controls.Add(new CustomLabel(data.Indicator, frColor, bgColor, FontStyle.Regular, 9F, 0, 21, rowsize,ContentAlignment.MiddleCenter));
\r
121 rowPanel.Controls.Add(new CustomLabel(data.SortID.ToString(), frColor, FontStyle.Regular, 9F, 0, 41, rowsize, ContentAlignment.MiddleRight));
\r
122 rowPanel.Controls.Add(new CustomLabel(data.DoDate.getDateString(), frColor, style, 9F, 40, 56, rowsize,ContentAlignment.MiddleCenter));
\r
123 rowPanel.Controls.Add(new CustomLabel(data.DoDate.getDowStr(), frColor, style, 9F, 95, 26, rowsize,ContentAlignment.MiddleCenter));
\r
124 rowPanel.Controls.Add(new CustomLabel(data.TimeArea, frColor, style, 9F, 120, 21, rowsize,ContentAlignment.MiddleCenter));
\r
125 rowPanel.Controls.Add(new CustomLabel(data.Category, ctgFrColor, style, 9F, 140, 81, rowsize));
\r
127 rowPanel.Controls.Add(new CustomLabel(data.Contents, frColor, style, contentFontSize, 220, 175 + wkContentAdditional, rowsize));
\r
129 rowPanel.Controls.Add(new CustomLabel(data.getForcastHourStr, frColor, timeStyle, fontsize, wkDelaySize, 51, rowsize, ContentAlignment.MiddleRight));
\r
130 rowPanel.Controls.Add(new CustomLabel(data.ForecastMin.ToString(), frColor, timeStyle, fontsize, wkDelaySize + 50, 51, rowsize, ContentAlignment.MiddleRight));
\r
131 rowPanel.Controls.Add(new CustomLabel(data.RealMin.ToString(), frColor, timeStyle, fontsize, wkDelaySize + 100, 51, rowsize, ContentAlignment.MiddleRight));
\r
132 rowPanel.Controls.Add(new CustomLabel(data.StartTime.ToString(), frColor, style, fontsize, wkDelaySize + 150, 61, rowsize, ContentAlignment.MiddleCenter));
\r
133 rowPanel.Controls.Add(new CustomLabel(data.EndTime.ToString(), frColor, style, fontsize, wkDelaySize + 210, 61, rowsize, ContentAlignment.MiddleCenter));
\r
135 rowPanel.Controls.Add(new CustomLabel(data.Project, frColor, style, 9F, wkDelaySize + 270, 81, rowsize));
\r
136 rowPanel.Controls.Add(new CustomLabel((data.IsRepeat > 0 ? "R" : ""), frColor, style, 9F, wkDelaySize + 350, 21, rowsize, ContentAlignment.MiddleCenter,data.IsRepeat.ToString() + "日おき"));
\r
137 rowPanel.Controls.Add(new CustomLabel((string.IsNullOrEmpty(data.Comment) ? "" : "*"), frColor, style, 9F, wkDelaySize + 370, 21, rowsize, ContentAlignment.MiddleCenter,data.Comment ));
\r
138 rowPanel.Controls.Add(new CustomLabel((string.IsNullOrEmpty(data.Tags) ? "" : "*"), frColor, style, 9F, wkDelaySize + 390, 21, rowsize, ContentAlignment.MiddleCenter, data.Tags));
\r
140 //rowPanel.Controls.Add(new CustomLabel(data.SortID.ToString(), frColor, bgColor, FontStyle.Regular, 9F, wkDelaySize + 410, 41, rowsize, ContentAlignment.MiddleRight));
\r
143 rowPanel.Location = new Point(0, point);
\r
144 rowPanel.Size = new Size(825 + wkContentAdditional, rowsize);
\r
145 //rowPanel.BorderStyle = BorderStyle.FixedSingle;
\r
148 rowPanel.TabStop = false;
\r
149 foreach (Control eachControls in rowPanel.Controls)
\r
151 eachControls.DoubleClick += new System.EventHandler(rowPanelDblClickAction);
\r
156 private int sortID;
\r
158 private void rowPanelDblClickAction(object sender, EventArgs args)
\r
160 baseForm.AddIDToText(sortID.ToString());
\r
165 public class CustomLabel:Label
\r
167 public CustomLabel(string text,Color FRColor,FontStyle style,float size,int location,int colsize,int rowSize)
\r
169 //innerLabel = new Label();
\r
172 this.BackColor = Color.Transparent;
\r
173 this.ForeColor = FRColor;
\r
174 this.Font = new Font("MS UI Gothic", size, style, GraphicsUnit.Point, 128);
\r
175 this.Location = new Point(location, 0);
\r
176 this.Size = new Size(colsize, rowSize);
\r
179 this.BorderStyle = System.Windows.Forms.BorderStyle.None;
\r
183 this.TextAlign = ContentAlignment.MiddleLeft;
\r
184 this.Anchor = (AnchorStyles.Left | AnchorStyles.Top);
\r
186 public CustomLabel(string text, Color FRColor, FontStyle style, float size, int location, int colsize, int rowSize, ContentAlignment align)
\r
187 :this(text,FRColor,style,size,location,colsize,rowSize)
\r
189 this.TextAlign = align;
\r
192 public CustomLabel(string text, Color FRColor, FontStyle style, float size, int location, int colsize, int rowSize, ContentAlignment align, string tooltipStr)
\r
193 : this(text, FRColor, style, size, location, colsize, rowSize,align)
\r
195 ToolTip pop = new ToolTip();
\r
197 //ToolTipが表示されるまでの時間
\r
198 pop.InitialDelay = 500;
\r
199 //ToolTipが表示されている時に、別のToolTipを表示するまでの時間
\r
200 pop.ReshowDelay = 100;
\r
202 pop.AutoPopDelay = 4000;
\r
203 //フォームがアクティブでない時でもToolTipを表示する
\r
204 pop.ShowAlways = false;
\r
206 //このオブジェクトにToolTipが表示されるようにする
\r
207 pop.SetToolTip(this, tooltipStr);
\r
212 public enum displayMode
\r