标签:log graph float box idt measure code style aws
/// <summary> /// 自定义ListBox的item的宽高, 字体居中 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lisB_DrawItem(object sender, DrawItemEventArgs e) { if (e.Index == -1) { return; } e.DrawBackground(); //绘制各项的背景色 e.DrawFocusRectangle(); //让文字位于Item的中间 float difH = (e.Bounds.Height - e.Font.Height) / 2; //指定绘制文本的位置 RectangleF rf = new RectangleF(e.Bounds.X, e.Bounds.Y + difH, e.Bounds.Width, e.Font.Height); //绘制指定的字符串 e.Graphics.DrawString(lisB.Items[e.Index].ToString(), e.Font, new SolidBrush(Color.Black), rf); } private void lisB_MeasureItem(object sender, MeasureItemEventArgs e) { //if(e.Index==1) 指定某一行的高度 e.ItemHeight = 22; }
标签:log graph float box idt measure code style aws
原文地址:http://www.cnblogs.com/wxylog/p/6085275.html