Foxtable(狐表)用户栏目专家坐堂 → [求助]单元格描绘的内容怎样居中


  共有1575人关注过本帖树形打印复制链接

主题:[求助]单元格描绘的内容怎样居中

帅哥哟,离线,有人找我吗?
天一生水
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1140 积分:11255 威望:0 精华:0 注册:2017/9/26 16:30:00
[求助]单元格描绘的内容怎样居中  发帖心情 Post By:2018/5/30 14:50:00 [只看该作者]

 DrawCell  代码:

 

If e.Col.Name = "邮寄状态" Then
    e.StartDraw()
    Dim w As Integer = e.Width - 4
    Dim h As Integer = e.Height - 4
    Dim x As Integer = e.x + (e.Width - w)/2
    Dim n As Pen
    Dim fnt As New Font("黑体",9)
    Dim br As object
    Dim msg As String
    If e.Row("邮寄") = True Then
        n = New Pen(Color.Blue,2)
        br = New SolidBrush(color.Blue)
        msg = "已邮寄"
    Else
        n = New Pen(Color.Red,2)
        br = New SolidBrush(color.red)
        msg = "未邮寄"
    End If
   
    e.Graphics.DrawRectangle(n,x,e.y + 2,w,h)
    e.Graphics.DrawString(msg,fnt,br,x + 10,e.y + 15)
    e.Text = ""
    e.EndDraw()
End If


图片点击可在新窗口打开查看此主题相关图片如下:image 2.png
图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/5/30 14:56:00 [只看该作者]

    Dim sf As new StringFormat
    sf.Alignment = StringAlignment.Center
    sf.LineAlignment = StringAlignment.Center

    
    e.Graphics.DrawString(msg,fnt,br,  new Rectangle(e.x, e.y, e.width, e.height), sf)

[此贴子已经被作者于2018/5/30 14:56:19编辑过]

 回到顶部