/// <summary> /// 描画 /// </summary> /// <param name="rp"></param> /// <returns></returns> public override bool Draw(IRichPane rp) { if (Visible) { var sr = rp.GetPaneRect(); sr.LT.X += _margin.LT.X; sr.RB.X -= _margin.RB.X; sr.RB.Y -= _margin.RB.Y; if (Rect.Height < 1) { return(true); } #region 領域の矩形 var lgb = createLogPanelBG(sr); sr.LT.Y = sr.RB.Y - Rect.Height; rp.Graphics.DrawLine(_pRegionShadow, sr.RB.X, sr.LT.Y, sr.RB.X, sr.RB.Y); rp.Graphics.DrawLine(_pRegionShadow, sr.LT.X, sr.RB.Y, sr.RB.X, sr.RB.Y); rp.Graphics.FillRectangle(lgb, sr); lgb.Dispose(); #endregion #region タイトルボーダー Brush _bd = new SolidBrush(Color.FromArgb(64, 0, 0, 0)); var b = 8; var w3 = sr.Width / 4; var pst = new Point[] { new Point(sr.LT.X, sr.LT.Y + b + 16), new Point(sr.LT.X, sr.LT.Y), new Point(sr.RB.X, sr.LT.Y), }; var psb = new Point[] { new Point(sr.RB.X, sr.LT.Y + b), new Point(sr.RB.X - w3, sr.LT.Y + b + 2), new Point(sr.RB.X - w3 * 2, sr.LT.Y + b + 8), new Point(sr.RB.X - w3 * 3, sr.LT.Y + b + 16), new Point(sr.LT.X, sr.LT.Y + b + 16), }; var ps = new Point[pst.Length + psb.Length]; int i; for (i = 0; i < pst.Length; i++) { ps[i] = pst[i]; } for (var j = 0; j < psb.Length; j++) { ps[i++] = psb[j]; } rp.Graphics.FillPolygon(_bd, ps); _bd.Dispose(); // ハイライト using (var p = new Pen(Color.FromArgb(96, 255, 255, 255))) { rp.Graphics.DrawLines(p, pst); } // シャドウ using (var p = new Pen(Color.FromArgb(96, 0, 0, 0))) { rp.Graphics.DrawLines(p, psb); } #endregion // タイトルメッセージ var btr = sr.Clone() as ScreenRect; btr.RB.X = btr.LT.X + 24; btr.RB.Y = btr.LT.Y + 12; btr += XyBase.FromInt(4, 4); var titlestr = Mes.Current["LogGroupPanel", "Title"]; rp.Graphics.DrawString(titlestr, _fontTitle, new SolidBrush(Color.FromArgb(192, 192, 255)), btr.LT.X, btr.LT.Y); btr += XyBase.FromInt((int)rp.Graphics.MeasureString(titlestr, _fontTitle).Width + 8, 0); // 表示レベルボタン _clickArea.Clear(); ScreenPos pos; pos = savePos(LLV.ERR, btr.LT + XyBase.FromInt(0 - (int)(LOG.JumpErr.R / 2), LOG.JumpErr.Y)); rp.Graphics.DrawImage(LOG.ErrSw ? Properties.Resources.lp_Err_on : Properties.Resources.lp_Err_off, pos.X, pos.Y, (float)(LOG.JumpErr.R + Properties.Resources.lp_Err_on.Width), (float)(LOG.JumpErr.R + Properties.Resources.lp_Err_on.Height)); pos = savePos(LLV.WAR, btr.LT + XyBase.FromInt(22 - (int)(LOG.JumpWar.R / 2), LOG.JumpWar.Y)); rp.Graphics.DrawImage(LOG.WarSw ? Properties.Resources.lp_War_on : Properties.Resources.lp_War_off, pos.X, pos.Y, (float)(LOG.JumpWar.R + Properties.Resources.lp_War_on.Width), (float)(LOG.JumpWar.R + Properties.Resources.lp_War_on.Height)); pos = savePos(LLV.INF, btr.LT + XyBase.FromInt(44 - (int)(LOG.JumpInf.R / 2), LOG.JumpInf.Y)); rp.Graphics.DrawImage(LOG.InfSw ? Properties.Resources.lp_Inf_on : Properties.Resources.lp_Inf_off, pos.X, pos.Y, (float)(LOG.JumpInf.R + Properties.Resources.lp_Inf_on.Width), (float)(LOG.JumpInf.R + Properties.Resources.lp_Inf_on.Height)); pos = savePos(LLV.DEV, btr.LT + XyBase.FromInt(66 - (int)(LOG.JumpDev.R / 2), LOG.JumpDev.Y)); rp.Graphics.DrawImage(LOG.DevSw ? Properties.Resources.lp_Dev_on : Properties.Resources.lp_Dev_off, pos.X, pos.Y, (float)(LOG.JumpDev.R + Properties.Resources.lp_Dev_on.Width), (float)(LOG.JumpDev.R + Properties.Resources.lp_Dev_on.Height)); // クローズボタン pos = savePos(0, btr.LT + XyBase.FromInt(100 - (int)(LOG.JumpDev.R / 2), LOG.JumpDev.Y)); rp.Graphics.DrawImage(LOG.DevSw ? Properties.Resources.Cancel : Properties.Resources.Cancel, (float)pos.X, pos.Y, 16, 16); // テキスト表示領域のみ sr.Deflate(2); sr.LT.X += 16; sr.LT.Y += b + 16; // for test rp.Graphics.DrawLine(Pens.White, sr.LT, sr.RB); // メッセージ表示 var ms = rp.Graphics.MeasureString("AX08iIay", _font); float lm = 2; // 行間 var y1 = ms.Height + lm; var dispLineN = (int)(sr.Height / y1); float curN = LOG.GetCurrentCount(); float btY; if (curN < dispLineN) { btY = sr.RB.Y - (int)(dispLineN - curN + 1) * y1; } else { btY = sr.RB.Y - y1; } var lu = LOG.GetCurrentLast(); for (; ;) { if (btY < sr.LT.Y - 2 || lu == null) { break; } var br = _bInf; switch (lu.Value.Level) { case LLV.WAR: br = _bWar; break; case LLV.ERR: br = _bErr; break; case LLV.DEV: br = _bDev; break; case LLV.INF: br = _bInf; break; case LLV.TODO: br = _bTodo; break; } rp.Graphics.DrawString(lu.Value.Mes, _font, br, new PointF(sr.LT.X, btY)); rp.Graphics.DrawLine(_pLine, sr.LT.X, btY + y1 - 3, sr.RB.X, btY + y1 - 3); if (lu.Value.Icon != null) { rp.Graphics.DrawImageUnscaled(lu.Value.Icon, sr.LT.X - 17, (int)(btY - 1)); } btY -= y1; lu = lu.Previous; } } return(true); }