Loading...
  所在位置:论坛首页 -> ┈┋电脑网络技术区┋┈ -> Asp/Asp.Net技术 -> 如何设置tabcontrol控件的tabPage的text内容显示成竖着的字体
标题:如何设置tabcontrol控件的tabPage的text内容显示成竖着的字体收藏 编辑 删除 楼主 | 上一篇 下一篇
有时也很傻
等级:社区游侠
权限:普通用户
积分:47
金钱:6304
声望:74
经验:74
发帖数:1524
注册:2007年10月26日
资料 短消息2008-5-18 10:23:57

Private tabArea As Rectangle
 Private tabTextArea As RectangleF

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.TabControl1.DrawMode = TabDrawMode.OwnerDrawFixed '设置用户绘制方式
        Me.TabControl1.Alignment = TabAlignment.Right '设置TAB项右对齐布局
        'TabControl1.SizeMode = TabSizeMode.Fixed ‘设置TAB项大小的方式(全都一样大小)
        'TabControl1.ItemSize = New Size(150, 20) '设置大小
    End Sub

    Private Sub TabControl1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles TabControl1.DrawItem
        tabArea = TabControl1.GetTabRect(e.Index) '主要是做个转换来获得TAB项的RECTANGELF
        tabTextArea = RectangleF.op_Implicit(TabControl1.GetTabRect(e.Index))
        Dim g As Graphics = e.Graphics
        Dim sf As New StringFormat() '封装文本布局信息

        sf.LineAlignment = StringAlignment.Center
        sf.Alignment = StringAlignment.Center

        Dim p As New Pen(Color.Blue) '绘制边框的画笔
        Dim font As New Font("Arial", 10.0F)
        Dim brush As New SolidBrush(Color.Red)

        g.DrawRectangle(p, tabArea) '绘制边框
        '绘制文字
        g.DrawString(CType(sender, TabControl).TabPages(e.Index).Text, font, brush, tabTextArea, sf)
    End Sub

2008-5-18 10:23:57 顶部
第1页 共页 共0个回复     <<    >>    
 快速回复
  • 支持UBB,HTML标签

  • 高级回复

  • 操作选项:评分 加精 解精 奖惩 设专题 设公告 解公告 固顶 总固顶 解固顶 结帖 解结帖 锁帖 解锁 移帖 删帖
      首页 | 购买指南 | 商业版本 | 虚拟主机 | 特色介绍 | 下载中心 | 支付方式
    Copyright 2004-2008 BBSGood.com Powered By: BBSGood.Speed Version 5.0
      咨询电话:0575-85513832、0575-85513825(传真)、7*24小时咨询服务:13606552007 不良信息举报中心 浙ICP备05029817号
      业务QQ:38958768、客服QQ1:415896239、客服QQ2:343896043、MSN:jccsxx@hotmail.com