Sign in to follow this  
Followers 0

3D text

25 posts in this topic

Posted (edited)

Modify by your taste:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#Include <File.au3>
;written by taietel

;Example - modify to fit >>YOUR<< needs
GUICreate("3D Text", 650, 550)
GUISetBkColor(0x996600)

$arStyle=StringSplit("u|i|n|u|i|n","|",2)
For $i=0 To 5
    _3DText("AutoIt - 3D Text", 10, 20+80*$i, -1, -1, 14 + $i*10, "b", $arStyle[$i])
Next

GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _3DText($sText,$iX, $iY, $iW=-1, $iH=-1, $iFontSize = 14, $sWeight="b", $sStyle = "n", $sFont="Arial")
    If $iW = -1 Or $iW = Default Then $iW = Int(StringLen($sText)*$iFontSize/1.2)
    If $iH = -1 Or $iH = Default Then $iH = Int(1.5*$iFontSize)
    If $iFontSize = -1 Or $iFontSize = Default Then $iFontSize = 14
    If $sWeight = -1 Or $sWeight = Default Then $sWeight = "b"
    If $sStyle = -1 Or $sStyle = Default Then $sStyle = "n"
    If $sFont = -1 Or $sFont = Default Then $sFont = "Arial"
    Local $f = 0x111111
    Switch $sWeight
        Case "b"
            $iWeight = 800
        Case "n"
            $iWeight = 400
    EndSwitch
    Switch $sStyle
        Case "n"
            $iStyle = 0
        Case "i"
            $iStyle = 2
        Case "u"
            $iStyle = 4
    EndSwitch
    Local $iZ = $iFontSize/10
    For $i=0 To $iZ Step 0.5
        GUICtrlCreateLabel($sText, $iX-$i, $iY+$i, $iW, $iH)
        GUICtrlSetColor(-1,$f*($i+1)/0.5)
        GUICtrlSetFont(-1, $iFontSize, $iWeight, $iStyle, $sFont)
        GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
    Next
EndFunc
 

[edit] forgot to clean...

Edited by taietel

Share this post


Link to post
Share on other sites



Posted

Pretty neat effect, and in a nice small package. Good job:)

Share this post


Link to post
Share on other sites

Posted

@taietel

A real show; code simple and efficient!

Congratulations...

Share this post


Link to post
Share on other sites

Posted

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#Include <File.au3>
;written by taietel

;Example - modify to fit >>YOUR<< needs
GUICreate("3D Text", 650, 550)
GUISetBkColor(0x996600)

$arStyle=StringSplit("u|i|n|u|i|n","|",2)
For $i=0 To 5
    _3DText("AutoIt - 3D Text", 10, 20+80*$i, -1, -1, 14 + $i*10, "b", $arStyle[$i])
Next

GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _3DText($sText,$iX, $iY, $iW=-1, $iH=-1, $iFontSize = 14, $sWeight="b", $sStyle = "n", $sFont="Garamond")
    If $iW = -1 Or $iW = Default Then $iW = Int(StringLen($sText)*$iFontSize/1.2)
    If $iH = -1 Or $iH = Default Then $iH = Int(1.5*$iFontSize)
    If $iFontSize = -1 Or $iFontSize = Default Then $iFontSize = 14
    If $sWeight = -1 Or $sWeight = Default Then $sWeight = "b"
    If $sStyle = -1 Or $sStyle = Default Then $sStyle = "n"
    If $sFont = -1 Or $sFont = Default Then $sFont = "Garamond"
    Local $f = StringSplit('0xffffff|0xdddddd|0xbbbbbb|0x999999|0x777777|0x555555|0x333333|0x111111', '|')
    Switch $sWeight
        Case "b"
            $iWeight = 800
        Case "n"
            $iWeight = 400
    EndSwitch
    Switch $sStyle
        Case "n"
            $iStyle = 0
        Case "i"
            $iStyle = 2
        Case "u"
            $iStyle = 4
    EndSwitch
    Local $iZ = Int($iFontSize/10)
    For $i=0 To $iZ
        GUICtrlCreateLabel($sText, $iX-$i, $iY+$i, $iW, $iH)
        ; GUICtrlSetColor(-1,$f[$i+1])
        ; GUICtrlSetColor(-1,$f[$f[0]-$i])
        GUICtrlSetColor(-1,$f[$iZ-$i+1])
        ; GUICtrlSetColor(-1,Dec(Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2)))
        GUICtrlSetFont(-1, $iFontSize, $iWeight, $iStyle, $sFont)
        GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
    Next
EndFunc

Share this post


Link to post
Share on other sites

Posted

Thanks!

AZJIO,  :graduated:

Share this post


Link to post
Share on other sites

Posted

Cool effect :graduated:.

Nicely done.

Share this post


Link to post
Share on other sites

Posted

Nice!

Maybe just

GUICtrlCreateLabel($sText, $iX-$i, $iY-$i, $iW, $iH)

Sun is shining...

:graduated:

Share this post


Link to post
Share on other sites

Posted

Great effects taietel !

Thanks to share ! Posted Image

Share this post


Link to post
Share on other sites

Posted (edited)

I played with your script ! Posted Image

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
;written by taietel
HotKeySet ( "{ESC}", "_Exit" )
$_TimerInit = TimerInit ( )
$_Invert=True
Global $_Label
;Example - modify to fit >>YOUR<< needs
GUICreate ( "", 630, 150, -1, -1, BitOR ( $WS_POPUP, $WS_BORDER ), $WS_EX_TOPMOST, WinGetHandle ( AutoItWinGetTitle ( ) ) ) 
GUISetBkColor ( 0xA093FF  )
$arStyle=StringSplit("u|i|n|u|i|n","|",2)
_3DText ( "Alert Intrusion", 30, 20, -1, -1, 14 + 5*10, "b", $arStyle[5] )
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    If _EachXseconds ( 1.5 ) Then _InvertColor ( )
WEnd

Func _3DText($sText,$iX, $iY, $iW=-1, $iH=-1, $iFontSize = 14, $sWeight="b", $sStyle = "n", $sFont="Garamond")
    If $iW = -1 Or $iW = Default Then $iW = Int(StringLen($sText)*$iFontSize/1.2)
    If $iH = -1 Or $iH = Default Then $iH = Int(1.5*$iFontSize)
    If $iFontSize = -1 Or $iFontSize = Default Then $iFontSize = 14
    If $sWeight = -1 Or $sWeight = Default Then $sWeight = "b"
    If $sStyle = -1 Or $sStyle = Default Then $sStyle = "n"
    If $sFont = -1 Or $sFont = Default Then $sFont = "Garamond"
    Local $f = StringSplit('0xffffff|0xdddddd|0xbbbbbb|0x999999|0x777777|0x555555|0x333333|0x111111', '|')
    Switch $sWeight
        Case "b"
            $iWeight = 800
        Case "n"
            $iWeight = 400
    EndSwitch
    Switch $sStyle
        Case "n"
            $iStyle = 0
        Case "i"
            $iStyle = 2
        Case "u"
            $iStyle = 4
    EndSwitch
    Local $iZ = Int($iFontSize/10)
    For $i=0 To $iZ
        $_Label = GUICtrlCreateLabel($sText, $iX-$i, $iY+$i, $iW, $iH)
        GUICtrlSetColor(-1,$f[$iZ-$i+1])
        GUICtrlSetFont(-1, $iFontSize, $iWeight, $iStyle, $sFont)
        GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
    Next
EndFunc

Func _InvertColor ( )
    If $_Invert Then
        GUISetBkColor ( 0xFF0000 )
        GUICtrlSetColor ( $_Label, 0x111111 )
        $_Invert=False
    Else
        GUISetBkColor ( 0xA093FF )  
        GUICtrlSetColor ( $_Label, 0xffffff )
        $_Invert=True
    EndIf
EndFunc ;==> _InvertColor ( )

Func _EachXseconds ( $_Interval )
    $_TimerDiff = Round ( TimerDiff ( $_TimerInit )/ 1000 )
    If $_TimerDiff >= $_Interval Then
        $_TimerInit = TimerInit ( )
        Return 1
    Else
        Return 0
    EndIf
EndFunc ;==> _EachXseconds ( )

Func _Exit ( )
    Exit
EndFunc ;==> _Exit ( )
Edited by wakillon

Share this post


Link to post
Share on other sites

Posted

Well done, wakillon! :graduated:

Share this post


Link to post
Share on other sites

Posted (edited)

Hi there

Excellent script.

I made a change. Instead of making 6 controls to display one title you can make it as one control using GDI. The added benefit of this is then you can more easily receive a click as my version returns the control id. Click a label to see that it works.

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#Include <File.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <Constants.au3>
#include <Color.au3>
;written by taietel

;Example - modify to fit >>YOUR<< needs
GUICreate("3D Text", 650, 550)
GUISetBkColor(0x996600)
dim $controls[6]

For $i=0 To 5
    $controls[$i]=_3DText("AutoIt - 3D Text", 10, 20+80*$i, 14 + $i*10, 800, 2)
Next

GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        EndSwitch
        $a = GUIGetCursorInfo()
        For $i=0 To 5
            if $a[2]=1 and $a[4]=$controls[$i] then
                ToolTip("title "&$i&" was pressed")
                sleep(2000)
                ToolTip("")
            EndIf
                
        Next

WEnd

Func _3DText($sText,$iX, $iY, $iFontSize = 24, $iWeight=400, $iStyle = 0, $sFont="Arial")
    local $iZ = Int($iFontSize/10)
    $aLabelTextSize = _StringSize($sText, $iFontSize, $iWeight, $iStyle, $sFont)
   Global $3dtext = GUICtrlCreatePic("", $iX, $iY,$aLabelTextSize[0]+20, $aLabelTextSize[1])
        letterbutton_1($3dtext, $sText, $sFont, $iFontSize, $iStyle, $iZ,$iX, $iY)
        Return $3dtext
EndFunc


; Created by Trancexx
Func _StringSize($sText, $iSize = 8.5, $iWeight = 400, $iAttrib = 0, $sName = "", $iQuality = 2)
    Local Const $LOGPIXELSY = 90
    Local $fItalic = BitAND($iAttrib, 2)
    Local $hDC = _WinAPI_GetDC(0)
    Local $hFont = _WinAPI_CreateFont(-_WinAPI_GetDeviceCaps($hDC, $LOGPIXELSY) * $iSize / 72, 0, 0, 0, $iWeight, $fItalic, BitAND($iAttrib, 4), BitAND($iAttrib, 8), 0, 0, 0, $iQuality, 0, $sName)
    Local $hOldFont = _WinAPI_SelectObject($hDC, $hFont)
    Local $tSIZE
    If $fItalic Then $sText &= " "
    Local $iWidth, $iHeight
    Local $aArrayOfStrings = StringSplit($sText, @LF, 2)
    For $sString In $aArrayOfStrings
        $tSIZE = _WinAPI_GetTextExtentPoint32($hDC, $sString)
        If DllStructGetData($tSIZE, "X") > $iWidth Then $iWidth = DllStructGetData($tSIZE, "X")
        $iHeight += DllStructGetData($tSIZE, "Y")
    Next
    _WinAPI_SelectObject($hDC, $hOldFont)
    _WinAPI_DeleteObject($hFont)
    _WinAPI_ReleaseDC(0, $hDC)
    Local $aOut[2] = [$iWidth, $iHeight]
    Return $aOut
EndFunc   ;==>_StringSize

Func letterbutton_1($control, $text = "", $font = "Arial", $size = 12, $style = 2, $fontcol = "0x000000",$pos1="1",$pos2="2")
    Local $f = StringSplit('0xffffff|0xdddddd|0xbbbbbb|0x999999|0x777777|0x555555|0x333333|0x111111', '|')
    _GDIPlus_Startup()
    $hwd = GUICtrlGetHandle($control)
    ;$guiname=_WinAPI_GetParent($hwd)
    $width = _WinAPI_GetClientWidth($hwd)
    $height = _WinAPI_GetClientHeight($hwd)
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwd)
    $hBitmap1 = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphic)
    ;$hBitmap1=_drawborder($hBitmap1,$col1,$col2,$col3,"2","14")
        For $i=0 To $fontcol
            If Not $text = "" Then $hBitmap1 = _drawtext($hBitmap1, $width, $height, $text, $font, $size, $style, $f[$fontcol-$i+1],$pos1-$i,$i)
        Next
    $hImage1 = _GDIPlus_ImageGetGraphicsContext($hBitmap1)
    _GDIPlus_GraphicsSetSmoothingMode($hImage1, 2)
    $hBMP1 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1)
    _WinAPI_DeleteObject(GUICtrlSendMsg($control, 0x0172, 0, $hBMP1))
    _GDIPlus_GraphicsDispose($hImage1)
    _WinAPI_DeleteObject($hBMP1)
    _GDIPlus_BitmapDispose($hBitmap1)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc ;==>letterbutton_1


Func _drawtext($hBitmap1, $leftpos, $toppos, $text, $font, $size, $style, $fontcol,$lef1=0,$lef2=0) ; left justify $align=0; right justify $align=1 ;center $align=2
    $hImage1 = _GDIPlus_ImageGetGraphicsContext($hBitmap1)
    $fcol = StringReplace($fontcol, "0x", "0xFF")
    $hBrushed = _GDIPlus_BrushCreateSolid($fcol)
    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate($font)
    $hFont = _GDIPlus_FontCreate($hFamily, $size, $style)
    $tLayout = _GDIPlus_RectFCreate($lef1, $lef2,$leftpos, $toppos)
    $aInfo = _GDIPlus_GraphicsMeasureString($hImage1, $text, $hFont, $tLayout, $hFormat)
    _GDIPlus_GraphicsDrawStringEx($hImage1, $text, $hFont, $aInfo[0], $hFormat, $hBrushed)
    _GDIPlus_GraphicsDispose($hImage1)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrushed)
    Return $hBitmap1
EndFunc ;==>_drawtext
Edited by picea892

Share this post


Link to post
Share on other sites

Posted

Hi there

Excellent script.

I made a change. Instead of making 6 controls to display one title you can make it as one control using GDI. The added benefit of this is then you can more easily receive a click as my version returns the control id. Click a label to see that it works.

I see a brown gui but no labels Posted Image

Share this post


Link to post
Share on other sites

Posted

I see a brown gui but no labels Posted Image

Hmm. Works on Windows XP but doesn't work on my Windows 7. Don't know why. Anyways sorry if I've only served to muddle your post.

Share this post


Link to post
Share on other sites

Posted (edited)

Hmm. Works on Windows XP but doesn't work on my Windows 7. Don't know why. Anyways sorry if I've only served to muddle your post.

I thinked it was only for seven !

I'm on xpsp3 ! Posted Image

( there are so many script who are only working with seven now )

Edited by wakillon

Share this post


Link to post
Share on other sites

Posted

Okay, I had a moment to troubleshoot this. The font Garamond is not present on all computers natively. I changed the font to arial and all worked well.

A slightly shorter version using arial is now displayed in my above post #11

Share this post


Link to post
Share on other sites

Posted

If MsOffice is installed, doesn't matter if OS is WinXP or Win7 (x86). I use Garamond a lot in my documents and that's the reason it's in the script as the default.

Anyway, I will change the first post (Arial instead Garamond).

picea892,  :graduated:. I have tried to do it BUT without GDI,

Share this post


Link to post
Share on other sites

Posted

Okay, I had a moment to troubleshoot this. The font Garamond is not present on all computers natively. I changed the font to arial and all worked well.

A slightly shorter version using arial is now displayed in my above post #11

Well done !

now it works fine !

Share this post


Link to post
Share on other sites

Posted

nice, following code patch on line 47 does nice effect Local $iZ = 30.

Share this post


Link to post
Share on other sites

Posted

I've played with gradients and came up with this splash screen:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

_SplashScreen("Prelucrare grafica a testelor", "Prelucrare Teste", "v1.0", "Copyright 2010 © Mihai Iancu")
_Exit()

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case -3
            _Exit()
    EndSwitch
WEnd

; #FUNCTION# ====================================================================================================
; Name...........:  _SplashScreen
; Description....:  Create SplashScreen
; Syntax.........:  _SplashScreen($sText1="Text Description", $sText2="Text Application",$sText3="Text Version", $sTextCopyright = "Text © Copyright", $iTime=3, $iW=400,$iH=200,$Color = 0xABCDEF)
; Parameters.....:  $sText1 - top-left text
;                   $sText2 - app title (center) text
;                   $sText3 - subtitle (center) text
;                   $sTextCopyright - bottom-right text
;                   $iTime - time (in seconds), [Optional]
;                   $iW - width of the splash, [Optional]
;                   $iH - height of the splash, [Optional]
;                   $Color - the color of the splash, [Optional]
;
; Return values..:  one cup of coffee (big one!)
; Author.........:  Mihai Iancu (taietel at yahoo dot com)
; ===============================================================================================================
Func _SplashScreen($sText1="DEMO Description", $sText2="DEMO Application",$sText3="DEMO Version", $sTextCopyright = "DEMO © Copyright", $iTime=3, $iW=400,$iH=200,$Color = 0x00AA00)
    If $iW = -1 Or $iW = Default Then $iW = 400
    If $iH = -1 Or $iH = Default Then $iH = 200
    If $iTime = -1 Or $iTime = Default Then $iTime = 3
    If $Color = -1 Or $Color = Default Then $Color = 0xABCDEF
    Local $hGui = GUICreate("Splash", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
    _Gradient(0x000001, $Color, $iW, $iH,0,0,1)
    _RoundCorners($hGui)
    Local $lblSus = GUICtrlCreateLabel($sText1,20,10,$iW/2-40,20)
    GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
    GUICtrlSetColor(-1, 0xDDDDDD)
    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)

    _3DText($sText2, 10, 60, 380, 52, 34, "b", "n",-1,0x442200)
    _3DText($sText3, 10, 115, 380, 22, 16, "b", "n","Arial")

    _Gradient(0xFF0000, 0xFFFF00,($iW-40)/2, 2,20,$iH-40,0)
    _Gradient(0xFFFF00, 0xFF0000,($iW-40)/2, 2,20++($iW-40)/2,$iH-40,0)

    GUICtrlCreateLabel($sTextCopyright,20,$iH-30,$iW-40,20,$SS_RIGHT)
    GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
    GUICtrlSetColor(-1, 0xeeee00)
    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)

    GUICtrlCreatePic("", 2, 2, $iW-4, $iH-4)
    WinSetTrans($hGui,"",0)
    GUISetState(@SW_SHOW)

    For $i=0 To 250 Step 10
        Sleep(30)
        WinSetTrans($hGui,"",$i)
    Next
    Sleep($iTime*1000)
    For $i=250 To 0 Step -10
        Sleep(30)
        WinSetTrans($hGui,"",$i)
    Next
    GUIDelete($hGui)
EndFunc

Func _Exit()
    Exit
EndFunc

; #FUNCTION# ====================================================================================================
; Name...........:  _RoundCorners
; Description....:  Create GUI with rounded corners
; Syntax.........:  _RoundCorners($hWnd,$iR)
; Parameters.....:  $hWnd - window handle
;                   $iR - corner radius, [Optional]
;
; Return values..:  Success: Nonzero
;                   Failure: 0
;
; Author.........:  Mihai Iancu (taietel at yahoo dot com)
; ===============================================================================================================
Func _RoundCorners($hWnd,$iR=10)
    Local $x
    Local $pos = WinGetPos($hWnd)
    If $pos[2]>$pos[3] Then
        $x = $pos[2]/$pos[3]
    Else
        $x = $pos[3]/$pos[2]
    EndIf
    Local $aResult = DllCall("gdi32.dll", "handle", "CreateRoundRectRgn", "int", 0, "int", 0, "int", $pos[2], "int", $pos[3], _
            "int", $iR*$x, "int", $iR*$x)
    Local $aRet = DllCall("user32.dll", "int", "SetWindowRgn", "hwnd", $hWnd, "handle", $aResult[0], "bool", False)
    If @error Then Return SetError(@error, @extended, False)
    Return $aRet[0]
EndFunc   ;==>_RoundCorners

; #FUNCTION# ====================================================================================================
; Name...........:  _Gradient
; Description....:  Create gradient between two colors
; Syntax.........:  _Gradient($lColor1, $lColor2, $iW=100, $iH=20, $iX=0, $iY=0, $iDirection=0)
; Parameters.....:  $lColor1 - First color to begin with
;                   $lColor2 - Second color
;                   $iW - width of the area, [Optional]
;                   $iH - height of the area, [Optional]
;                   $iX - position from left, [Optional]
;                   $iY - position from top, [Optional]
;                   $iY - direction to fill the gradient, [Optional]
;                           0 - vertical fill
;                           1 - horizontal fill
;
; Return values..:  none
;
; Author.........:  Mihai Iancu (taietel at yahoo dot com)
; ===============================================================================================================
Func _Gradient($lColor1, $lColor2, $iW=100, $iH=20, $iX=0, $iY=0, $iDirection=0)
    Local $m, $Ri,$Rf,$Rs,$Gi,$Gf,$Gs,$Bi,$Bf,$Bs
    Switch $iDirection
        Case 0
            $m = $iW
        Case 1
            $m = $iH
    EndSwitch
    $Ri = Mod($lColor1,256)
    $Gi = BitAND($lColor1/256,255)
    $Bi = BitAND($lColor1/65536,255)

    $Rf = Mod($lColor2,256)
    $Gf = BitAND($lColor2/256,255)
    $Bf = BitAND($lColor2/65536,255)

    $Rs = Abs($Ri - $Rf)/$m
    $Gs = Abs($Gi - $Gf)/$m
    $Bs = Abs($Bi - $Bf)/$m

    If $Rf < $Ri Then $Rs = -$Rs
    If $Gf < $Gi Then $Gs = -$Gs
    If $Bf < $Bi Then $Bs = -$Bs

    For $i = 0 To $m
        $Rf = $Ri + $Rs * $i
        $Gf = $Gi + $Gs * $i
        $Bf = $Bi + $Bs * $i
        GUICtrlCreateLabel(" ", $iX+$i-$i*$iDirection, $iY + $i*$iDirection, 2+$iDirection*$iW, 2+(1-$iDirection)*$iH)
        GUICtrlSetBkColor(-1, "0x"&Hex($Bf,2) & Hex($Gf,2) & Hex($Rf,2))
        GUICtrlSetState(-1,$GUI_DISABLE)
    Next
EndFunc

; #FUNCTION# ====================================================================================================
; Name...........:  _3DText
; Description....:  Create 3D White Text
; Syntax.........:  _3DText($sText,$iX, $iY, $iW=-1, $iH=-1, $iFontSize = 14, $sWeight="b", $sStyle = "n", $sFont="Times New Roman")
; Parameters.....:  $sText - Text string
;                   $iX - position from left, [Optional]
;                   $iY - position from top, [Optional]
;                   $iW - width of the area, [Optional]
;                   $iH - height of the area, [Optional]
;                   $iFontSize - size of the font, [Optional]
;                   $sWeight - weight of the font, [Optional]
;                   |b - bold [Default]
;                   |n - normal
;                   $sStyle - style of the font, [Optional]
;                   |n - normal [Default]
;                   |i - italic
;                   |u - underline
;                   $sFont - font used [Optional]
;                   $lColor - color of text [Optional]
; Return values..:  none
;
; Author.........:  Mihai Iancu (taietel at yahoo dot com)
; ===============================================================================================================
Func _3DText($sText,$iX, $iY, $iW=-1, $iH=-1, $iFontSize = 14, $sWeight="b", $sStyle = "n", $sFont="Times New Roman",$lColor=0xffffff)
    If $iW = -1 Or $iW = Default Then $iW = Int(StringLen($sText)*$iFontSize/1.2)
    If $iH = -1 Or $iH = Default Then $iH = Int(1.5*$iFontSize)
    If $iFontSize = -1 Or $iFontSize = Default Then $iFontSize = 14
    If $sWeight = -1 Or $sWeight = Default Then $sWeight = "b"
    If $sStyle = -1 Or $sStyle = Default Then $sStyle = "n"
    If $sFont = -1 Or $sFont = Default Then $sFont = "Garamond"
    Switch $sWeight
        Case "b"
            $iWeight = 800
        Case "n"
            $iWeight = 400
    EndSwitch
    Switch $sStyle
        Case "n"
            $iStyle = 0
        Case "i"
            $iStyle = 2
        Case "u"
            $iStyle = 4
    EndSwitch
    Local $Ri,$Rf,$Gi,$Gf,$Bi,$Bf
    $Ri = Mod($lColor,256)
    $Gi = BitAND($lColor/256,255)
    $Bi = BitAND($lColor/65536,255)

    Local $iZ = Int($iFontSize/10)
    For $i=0 To $iZ Step 0.5
        $Rf = $Ri*$i
        $Gf = $Gi*$i
        $Bf = $Bi*$i
        GUICtrlCreateLabel($sText, $iX-$i, $iY+$i, $iW, $iH, $SS_CENTER)
        GUICtrlSetColor(-1,"0x"&Hex($Bf,2) & Hex($Gf,2) & Hex($Rf,2))
        GUICtrlSetFont(-1, $iFontSize, $iWeight, $iStyle, $sFont)
        GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
    Next
EndFunc

Share this post


Link to post
Share on other sites

Posted

nice

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0