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 * * ...
随机推荐
- Ubuntu 升级VisualBox后无法启动 Kernel driver not installed (rc=-1908)
VisualBox之所以在Linux上比传统的VMware快得多,关键一点就是它和Linux内核的结合比较紧密,这也是开源的优点. 不过Linux内核更新很频繁,每次更新内核后启动VirtualBox ...
- Linux命令(1)-创建文件
版本:centos7 1.可以使用cat创建一个新的文件 命令:cat>>filename 使用cat创建文件时,以系统默认的文件属性作为新文件的属性,并接受键盘输入作为文件的内容.输入结 ...
- kali 2016的基础配置
1.Kali 2016的更新源 deb http://http.kali.org/kali kali-rolling main contrib non-free 2.安装虚拟机 apt-get upd ...
- JS-OC通信之Cordova简介
Cordova 是一个可以让 JS 与原生代码(包括 Android 的 java,iOS 的 Objective-C 等)互相通信的一个库,并且提供了一系列的插件类,比如 JS 直接操作本地数据库的 ...
- pscp使用详解 Windows与Linux文件互传工具
pscp使用详解 Windows与Linux文件互传工具 pscp使用方法详解:pscp是putty安装包所带的远程文件传输工具,是一款十分常见windows与linux系统之间文件互传的工具,使用方 ...
- Warning: Data truncated for column 'AirPress' at row 1
/************************************************************************ * Warning: Data truncated ...
- [转载]架构指南 : Java1.7+Eclipse luna + Maven 3.2.5 +spring 4.1.4
1. 环境配置 a) Java 1.7 b) Eclipse luna c) Maven3.2.5 d) spring 4.1.4 2. ...
- iOS学习笔记---c语言第六天
函数 function 命名规范:工程名第一个字母大写,变量函数名小写,不要用拼音和中文, eg:lessonFunction 一.函数声明定义 函数是具有特定功能的代码块 作用:模块 ...
- Notes of Principles of Parallel Programming: Peril-L Notation - TODO
Content 1 syntax and semantic 2 example set 1 syntax and semantic 1.1 extending C Peril-L notation s ...
- ANTLR3完全参考指南读书笔记[01]
引用 Terence Parr. The Definitive ANTLR Reference, Building Domain Specific Languages(antlr3 version). ...