zoukankan      html  css  js  c++  java
  • 控件重绘

    1. 设置控件DrawMode属性为OwnerDrawFixed,编辑控件DrawItem事件

    重绘tabControl——选项卡控件

        string text = ((TabControl)sender).TabPages[e.Index].Text;
        SolidBrush brush = new SolidBrush(Color.Black);
        StringFormat sf = new StringFormat(StringFormatFlags.DirectionRightToLeft);
        sf.LineAlignment = StringAlignment.Center;
        sf.Alignment = StringAlignment.Center;
        e.Graphics.DrawString(text, SystemInformation.MenuFont, brush, e.Bounds, sf);

    重绘listBox控件(注意修改涉及控件名的地方)

        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(listBox1.Items[e.Index].ToString(), e.Font, new SolidBrush(e.ForeColor), rf);

  • 相关阅读:
    HAVING 和 WHERE 的使用
    Input and Output
    python数据分析知识点
    正则化
    ol 接入百度地图
    高德室内地图解析
    mapbox 接入高德矢量地图实战
    4、微信小程序和weui
    3、YishaAdmin开源框架搭建
    2、微信小程序开发注册、配置介绍说明
  • 原文地址:https://www.cnblogs.com/zhangchaoran/p/6823274.html
Copyright © 2011-2022 走看看