/// <summary> /// 获取指定的CloudLabel的左上角坐标 /// </summary> /// <param name="sf">已计算出的Label的大小</param> /// <param name="label">指定的CloudLabel</param> /// <returns></returns> protected virtual PointF GetPointF(SizeF sf, CloudLabel label) { PointF pf = _currPoint; if ((pf.X + sf.Width) > this.Width - 20) { pf = new PointF(RowSpace, pf.Y + sf.Height + RowSpace); _lines.Add(_lineNum++, label.Number); } _currPoint = new PointF(pf.X + sf.Width + ColumnSpace, pf.Y); return pf; }
/// <summary> /// Adds the specified cloud. /// </summary> /// <param name="cloud">The cloud.</param> public void Add(IGenerator cloud) { SizeF stringSize; using (Graphics g = this.CreateGraphics()) { string text = cloud.Generator(); stringSize = g.MeasureString(text, Font); } CloudLabel cloudLabel = new CloudLabel(cloud, this.CloudItems.Count, stringSize); this.CloudItems.Add(cloudLabel); }