007. 自定义ListBox的item的宽高, 字体居中
/// <summary>
/// 自定义ListBox的item的宽高, 字体居中
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void lisB_DrawItem(object sender, DrawItemEventArgs e)
{
if (e.Index == -)
{
return;
}
e.DrawBackground(); //绘制各项的背景色
e.DrawFocusRectangle();
//让文字位于Item的中间
float difH = (e.Bounds.Height - e.Font.Height) / ;
//指定绘制文本的位置
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 = ;
}
007. 自定义ListBox的item的宽高, 字体居中的更多相关文章
- 鼠标hover某个元素时其属性表现Css transition 过渡效果(以宽高属性居中放大为例)
<!DOCTYPE html> <html> <head> </head> <body id="body"> <! ...
- css 未知子元素宽高的居中
.parent{ position:relative; } .child{ position:absolute; left:50%; top:50%; transform:translate(-50% ...
- table-cell设置宽高、居中
table-cell默认宽高由内容决定 <style type="text/css" rel="stylesheet"> .content { co ...
- 【Android疑难杂症】GridView动态设置Item的宽高导致第一个Item不响应或显示不正常的问题
前言 这个问题在之前做一个盒子项目时遇到过,最近又遇到了,使用GridView遇到的非常奇葩的问题,这里记录分享一下. 声明 欢迎转载,但请保留文章原始出处:) 博客园:http://www.cnb ...
- 关于百分比宽高div居中并垂直居中问题
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- js实现字体和容器宽高随窗口改变
用于字体大小和容器的宽高字体和宽高设为rem就可以了 var html = document.documentElement; function fonts(){ var hW = html.offs ...
- 【Android 应用开发】 自定义组件 宽高适配方法, 手势监听器操作组件, 回调接口维护策略, 绘制方法分析 -- 基于 WheelView 组件分析自定义组件
博客地址 : http://blog.csdn.net/shulianghan/article/details/41520569 代码下载 : -- GitHub : https://github.c ...
- 让自定义view宽高成比例显示
有时候我们自定义一个View,比如ImageView,我们需要让它宽高按照一定的比例显示,例如在ImageView在GridView中显示,GridView设置了3列,由于ImageVIew的宽度会根 ...
- js自定义获取浏览器宽高
/** * @description js自定义获取浏览器宽高 * * IE8 和 IE8 以下的浏览器不兼容 * window.innerWidth * window.innerHeight * * ...
随机推荐
- 大型HashMap
看到一篇评估大型HashMap的文章,备份几个Collections库. 原文:Large HashMap overview: JDK, FastUtil, Goldman Sachs, HPPC, ...
- LeetCode----3 Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all un ...
- ModelFirst的CRUD
创建实体:
- iOS开发:集成支付宝(遇见的坑和便捷撸代码)
开发iOS最重要的就是支付了,天朝之内最常用的就是支付宝了,下面就以自己的经历说明如何集成支付宝+遇见的坑. 首先,集成支付宝最好别使用Cocoapods,很多人都说使用起来很方便,可是我每次只要使用 ...
- iOS字体设置
label.font = [UIFont fontWithName:@"Arial-BoldItalicMT" size:24]; 字体名如下: Font Family: Amer ...
- Smart210学习-----lcd驱动
帧缓冲设备 1.1帧缓冲设备:帧缓冲(framebuffer)是 Linux 系统为显示设备提供的一个接口,它将显示缓冲区抽象,屏蔽图像硬件的底层差异,允许上层应用程序在图形模式下直接对显示缓冲区进行 ...
- 一秒钟Win7笔记本变无线路由器
开启windows 7的隐藏功能:虚拟WiFi和SoftAP(即虚拟无线AP),就可以让电脑变成无线路由器,实现共享上网,节省网费和路由器购买费.亲测通过,比conncetify方便,稳定,网速好! ...
- CentOS 6.6 中设置Terminal快捷键
排版比较乱,参见 https://www.zybuluo.com/Jpz/note/144583 CentOS 6.6 中设置Terminal快捷键 Linux开发环境配置 Terminal是Cent ...
- 279. Perfect Squares
Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 1 ...
- windows下apache及mysql定时自动重启设置
有时候觉得,服务器运行时间过长,造成服务器内存等压力过大.因此,不用重新启动服务器的情况下,完成apache和mysql的内存释放,是非常有益处的(把重启时间设置在访问量最低的).首先,apache的 ...