找回密码
 加入
搜索
查看: 5863|回复: 10

[网络通信] [解决]关于TAB下的ITEM的字体问题?

  [复制链接]
发表于 2010-9-1 10:37:12 | 显示全部楼层 |阅读模式
本帖最后由 newuser 于 2010-9-3 09:54 编辑

如何让代码中的TABItem字体这么显示:




#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=d:\zgk_2010\autoit\autoit_zgk_works\chengpin\auto_instsoft\form1.kxf
$Form1_1 = GUICreate("Form1", 633, 454, 253, 118)
$Group1 = GUICtrlCreateGroup("", 72, 0, 449, 449, -1, $WS_EX_TRANSPARENT)
$Tab1 = GUICtrlCreateTab(72, 16, 449, 433,$TCS_VERTICAL)
$TabSheet1 = GUICtrlCreateTabItem("安全工具")
$Label1 = GUICtrlCreateLabel("Label1", 152, 88, 36, 17)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 208, 88, 17, 17)
$Label2 = GUICtrlCreateLabel("Label2", 152, 120, 36, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 208, 120, 17, 17)
$Label3 = GUICtrlCreateLabel("Label3", 152, 152, 36, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 208, 152, 17, 17)
$Label4 = GUICtrlCreateLabel("Label4", 152, 184, 36, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 208, 184, 17, 17)
$Label5 = GUICtrlCreateLabel("Label5", 152, 216, 36, 17)
$Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 208, 216, 17, 17)
$Label6 = GUICtrlCreateLabel("Label6", 152, 248, 36, 17)
$Checkbox6 = GUICtrlCreateCheckbox("Checkbox6", 208, 248, 17, 17)
$TabSheet2 = GUICtrlCreateTabItem("常用工具")
$Label7 = GUICtrlCreateLabel("Label7", 168, 96, 36, 17)
$Checkbox7 = GUICtrlCreateCheckbox("Checkbox7", 248, 96, 17, 17)
$Label8 = GUICtrlCreateLabel("Label8", 168, 144, 36, 17)
$Checkbox8 = GUICtrlCreateCheckbox("Checkbox8", 248, 136, 17, 17)
$Label9 = GUICtrlCreateLabel("Label9", 168, 184, 36, 17)
$Checkbox9 = GUICtrlCreateCheckbox("Checkbox9", 256, 176, 17, 17)
$Label10 = GUICtrlCreateLabel("Label10", 168, 224, 42, 17)
$Checkbox10 = GUICtrlCreateCheckbox("Checkbox10", 256, 224, 17, 17)
$Label11 = GUICtrlCreateLabel("Label11", 168, 264, 42, 17)
$Checkbox11 = GUICtrlCreateCheckbox("Checkbox11", 256, 264, 17, 17)
$TabSheet3 = GUICtrlCreateTabItem(" 自编工具")
GUICtrlSetState(-1,$GUI_SHOW)
$Label12 = GUICtrlCreateLabel("Label12", 160, 96, 42, 17)
$Checkbox12 = GUICtrlCreateCheckbox("Checkbox12", 264, 88, 17, 25)
$Label13 = GUICtrlCreateLabel("Label13", 168, 160, 42, 17)
$Checkbox13 = GUICtrlCreateCheckbox("Checkbox13", 264, 152, 17, 17)
GUICtrlCreateTabItem("")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Button1", 536, 72, 81, 33)
$Button2 = GUICtrlCreateButton("Button2", 536, 112, 81, 33)
$Button3 = GUICtrlCreateButton("Button3", 536, 152, 81, 33)
$Button4 = GUICtrlCreateButton("Button4", 536, 192, 81, 33)
$Button5 = GUICtrlCreateButton("Button5", 536, 232, 81, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        Sleep(100)
WEnd
发表于 2010-9-1 10:52:43 | 显示全部楼层
很深奥的问题,小菜不懂。
 楼主| 发表于 2010-9-1 14:01:36 | 显示全部楼层
回复 1# newuser
等待中,别沉了...
发表于 2010-9-1 16:51:56 | 显示全部楼层
回复 1# newuser
应该是ComCtl32.dll版本的原因。
msdn描述:
TCS_RIGHT : ... This style is not supported if you use visual styles
TCS_VERTICAL: ... This style is not supported if you use ComCtl32.dll version 6... -

You can use a tool like "Process Explorer" from "Sysinternals" to see that the application uses version 6 under XP not matter that version 5.8 is under "System32"-dir.

看来可以使用如下语句使其工作。
DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=d:\zgk_2010\autoit\autoit_zgk_works\chengpin\auto_instsoft\form1.kxf
DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
$Form1_1 = GUICreate("Form1", 633, 454, 253, 118)
$Group1 = GUICtrlCreateGroup("", 72, 0, 449, 449, -1, $WS_EX_TRANSPARENT)
$Tab1 = GUICtrlCreateTab(72, 16, 449, 433,$TCS_VERTICAL)
$TabSheet1 = GUICtrlCreateTabItem("安全工具")
$Label1 = GUICtrlCreateLabel("Label1", 152, 88, 36, 17)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 208, 88, 17, 17)
$Label2 = GUICtrlCreateLabel("Label2", 152, 120, 36, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 208, 120, 17, 17)
$Label3 = GUICtrlCreateLabel("Label3", 152, 152, 36, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 208, 152, 17, 17)
$Label4 = GUICtrlCreateLabel("Label4", 152, 184, 36, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 208, 184, 17, 17)
$Label5 = GUICtrlCreateLabel("Label5", 152, 216, 36, 17)
$Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 208, 216, 17, 17)
$Label6 = GUICtrlCreateLabel("Label6", 152, 248, 36, 17)
$Checkbox6 = GUICtrlCreateCheckbox("Checkbox6", 208, 248, 17, 17)
$TabSheet2 = GUICtrlCreateTabItem("常用工具")
$Label7 = GUICtrlCreateLabel("Label7", 168, 96, 36, 17)
$Checkbox7 = GUICtrlCreateCheckbox("Checkbox7", 248, 96, 17, 17)
$Label8 = GUICtrlCreateLabel("Label8", 168, 144, 36, 17)
$Checkbox8 = GUICtrlCreateCheckbox("Checkbox8", 248, 136, 17, 17)
$Label9 = GUICtrlCreateLabel("Label9", 168, 184, 36, 17)
$Checkbox9 = GUICtrlCreateCheckbox("Checkbox9", 256, 176, 17, 17)
$Label10 = GUICtrlCreateLabel("Label10", 168, 224, 42, 17)
$Checkbox10 = GUICtrlCreateCheckbox("Checkbox10", 256, 224, 17, 17)
$Label11 = GUICtrlCreateLabel("Label11", 168, 264, 42, 17)
$Checkbox11 = GUICtrlCreateCheckbox("Checkbox11", 256, 264, 17, 17)
$TabSheet3 = GUICtrlCreateTabItem(" 自编工具")
GUICtrlSetState(-1,$GUI_SHOW)
$Label12 = GUICtrlCreateLabel("Label12", 160, 96, 42, 17)
$Checkbox12 = GUICtrlCreateCheckbox("Checkbox12", 264, 88, 17, 25)
$Label13 = GUICtrlCreateLabel("Label13", 168, 160, 42, 17)
$Checkbox13 = GUICtrlCreateCheckbox("Checkbox13", 264, 152, 17, 17)
GUICtrlCreateTabItem("")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Button1", 536, 72, 81, 33)
$Button2 = GUICtrlCreateButton("Button2", 536, 112, 81, 33)
$Button3 = GUICtrlCreateButton("Button3", 536, 152, 81, 33)
$Button4 = GUICtrlCreateButton("Button4", 536, 192, 81, 33)
$Button5 = GUICtrlCreateButton("Button5", 536, 232, 81, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        Sleep(100)
WEnd
发表于 2010-9-1 17:06:55 | 显示全部楼层
回复 4# 3mile


    这样貌似只是TAB改变了方向,文字貌似没达到楼主说的要求。。
 楼主| 发表于 2010-9-1 17:24:48 | 显示全部楼层
回复 5# zcx880517

回3mile,确实没达到我想要的效果!
发表于 2010-9-1 17:27:11 | 显示全部楼层
回复 6# newuser


  呵呵,,那样好像挺难实现的。。反正我到现在没见过。。
发表于 2010-9-1 17:47:11 | 显示全部楼层
官网找了个,不知道合不合要求。
#include <GDIPlus.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
_GDIPlus_Startup()

Global Const $ODT_TAB           = 101
Global Const $ODA_DRAWENTIRE    = 1
Global Const $ODA_SELECT        = 2
Global Const $ODA_FOCUS         = 4
Global Const $ODS_SELECTED      = 1
Global Const $ODS_GRAYED        = 2
Global Const $ODS_DISABLED      = 4
Global Const $ODS_CHECKED       = 8
Global Const $ODS_FOCUS         = 16
Global Const $ODS_DEFAULT       = 32
Global Const $ODS_HOTLIGHT      = 64
Global Const $ODS_INACTIVE      = 128
Global Const $ODS_NOACCEL       = 256
Global Const $ODS_NOFOCUSRECT   = 512
Global Const $ODS_COMBOBOXEDIT  = 4096
Global Const $iAngle = 270
Global Const $iPI = 4 * ATan(1)

Global Const $tagDRAWITEMSTRUCT = _
    'uint CtlType;' & _
    'uint CtlID;' & _
    'uint itemID;' & _
    'uint itemAction;' & _
    'uint itemState;' & _
    'hwnd hwndItem;' & _
    'hwnd hDC;' & _
    $tagRECT & _
    ';ulong_ptr itemData;'

    
Global $hGUI, $TabCtrl, $aTabItems[5], $sItems[10]

$hGUI = GUICreate('Test', 400, 400)
$TabCtrl = GUICtrlCreateTab(0, 0, 400, 400, BitOR($WS_CHILD, $TCS_FORCEICONLEFT, $TCS_VERTICAL, $TCS_MULTILINE, $TCS_OWNERDRAWFIXED))
GUICtrlSendMsg($TabCtrl, $TCM_SETITEMSIZE, 0, BitOR(50, BitShift(50, -16)))

For $i = 0 To UBound($aTabItems) -1
    $sItems[$i] = 'Tab'& $i+1
;~         MsgBox(0,0,$sItems[$i])
    $aTabItems[$i] = GUICtrlCreateTabItem($sItems[$i])
    GUICtrlCreateButton('Button of Tab '  & $i+1, 150, 20, 100, 23)
Next

GUIRegisterMsg($WM_DRAWITEM, '_WM_DRAWITEM')
GUISetState()

Do
Until GUIGetMsg() = -3

GUIDelete()
_GDIPlus_Shutdown()
Exit

Func _WM_DRAWITEM($hWnd, $iMsg, $iwParam, $ilparam)
    Local $tDIS = DllStructCreate($tagDRAWITEMSTRUCT, $ilparam)
    Local $tRect = DllStructCreate($tagRECT)
    Local $hDC, $hGraphics, $hMatrix
    Local $iItem
    
    If DllStructGetData($tDIS, 'CtlType') = $ODT_TAB And DllStructGetData($tDIS, 'itemAction') = $ODA_DRAWENTIRE Then
        $hDC = DllStructGetData($tDIS, 'hDC')
        $iItem = DllStructGetData($tDIS, 'itemID')

        For $i = 8 To 11
            DllStructSetData($tRect, $i-7, DllStructGetData($tDIS, $i))
        Next
        DllStructSetData($tRect, 'Top', DllStructGetData($tRect, 'Top') + 30)
        DllStructSetData($tRect, 'Left', DllStructGetData($tRect, 'Left') + 5)
        
        $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC)
        $hMatrix = _GDIPlus_MatrixCreate()
        _GDIPlus_MatrixRotate($hMatrix, $iAngle)
        _GDIPlus_GraphicsSetTransform($hGraphics, $hMatrix)
        
        VString($sItems[$iItem], DllStructGetData($tRect, 'Left'), DllStructGetData($tRect, 'Top'), 10, $iAngle, $hGraphics)
        
        _GDIPlus_MatrixDispose($hMatrix)
        _GDIPlus_GraphicsDispose($hGraphics)
    EndIf
    Return 'GUI_RUNDEFMSG'
EndFunc




; http://www.autoitscript.com/foru ... p;st=0&p=670844
; Malkey and the crowd.
Func VString($txt, $nx, $ny, $size, $iAngle, $hGraph)
    ;draw string with x,y = upper left corner
    ;Rotation of Coordinate Axes formulae
    $nXt = $nx * Cos($iAngle * $iPI / 180) + $ny * Sin($iAngle * $iPI / 180) ; $nXt - X coordinate before translation
    $nYt = -$nx * Sin($iAngle * $iPI / 180) + $ny * Cos($iAngle * $iPI / 180) ; $nYt - Y coordinate before translation
    _GDIPlus_GraphicsDrawString($hGraph, $txt, $nXt, $nYt, "Arial", $size, 0x0002)
EndFunc   ;==>VString
 

发表于 2010-9-1 17:55:04 | 显示全部楼层
把要显示的标题反着写不就可以了吗
 楼主| 发表于 2010-9-1 18:54:03 | 显示全部楼层
回复 9# liufenglg
请看清我的题目,可以吗?呵呵!
 楼主| 发表于 2010-9-1 18:58:38 | 显示全部楼层
本帖最后由 newuser 于 2010-9-1 19:02 编辑

回复 8# 3mile
有点意思,但他的TAB项好象是批量建的,我不知道该如何修改成我要得汉字题目,题目没有TAB1\TAB2那样规则啊?主要是程序代码还没搞懂,非常感谢!

不行,这样该: $sItems[$i] = '安全'& $i+1,还是不符合我将文字顺时针90度的要求,估计是行不通了,不过还是非常感谢!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-19 06:16 , Processed in 0.085008 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表