public override void Draw(Graphics g, int x, int y, bool tinydraw, bool selected) { // NewHeightで求めたサイズで文字列を描画する GraphicExtentions.DrawText(g, _text, _font, Color.Black, new Rectangle(x + _padding, y + _padding, (int)_textDrawSize.Width, (int)_textDrawSize.Height)); // 行を分ける線 g.DrawLine(new Pen(Parent.LineColor), 0, y + _height - 1, _width, y + _height - 1); }
private void NewHeight() { int textwidth = base.Width - _padding * 2; // 幅指定で文字の描画サイズを求める _textDrawSize = GraphicExtentions.MeasureString(_text, _font, new Rectangle(0, 0, textwidth, 1)); _textDrawSize.Width = textwidth; int newHeight = (int)_textDrawSize.Height + _padding * 2; // 名前と時間の行分 base.Height = newHeight; }