Jump to content

My OwnTab-Control


funkey
 Share

Recommended Posts

Thanks a lot, RockemSockem and UEZ!!

I fixed one problem with the hover-effect, see post#1!

Do you have any ideas what's to do to improve it? Tell me.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

Tabulous! Great job!

Do you have any ideas what's to do to improve it? Tell me.

  • Icon/background image support.
  • I sometimes have a need to fire the tab event on hover, but that's probably an obscure request.

I might have a few more suggestions after I check it out a little more, thanks for sharing!

Link to comment
Share on other sites

Thank you all.

I added icon-support and hover-switch as you wanted. Looks great. See post#1.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

Welcome back autoitscript.com!!!

I improved my UDF! Now it works fine!

See post#1

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

Thanks a lot, RockemSockem and UEZ!!

I fixed one problem with the hover-effect, see post#1!

Do you have any ideas what's to do to improve it? Tell me.

Are You ask for idea to improve, I've a lot; but first let me thank you, a very good work,  I will learn from this.

1- Check SciTE tabs, can I move the tabs.

2- Could be a button to close the tab - same as Opera, FireFox.

I am working on a free project, for the Holy Bible in Arabic, which is 100% AutoIT.

this is the test version, working on Rev. 01

http://www.4shared.com/file/112953701/17b9f2a1/___-_.html

So I may use your work for  different Bible section, or different  search pages.

Edited by aymhenry
Link to comment
Share on other sites

Some ideas:

#include <WindowsConstants.au3>
#Include <WinAPI.au3>

$hGui = GUICreate("Overview OwnTab-Styles", 840, 400)
GUISetBkColor(0xFF080)

_OwnTab_Style1($hGui, 20, 20, 200, 45)
_OwnTab_Pic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg', 200, 45)
_OwnTab_Label("Style 1", 200, 45)
_OwnTab_Style1($hGui, 220, 20, 200, 45)
_OwnTab_Label("Style 1", 200, 45, 0x201, 0x1)
_OwnTab_Style1($hGui, 420, 20, 200, 45)
_OwnTab_Label("Style 1", 200, 45, 0x411201)
_OwnTab_Style1($hGui, 620, 20, 200, 45)
_OwnTab_Gradient(0xffff00, 0xFF080, 200, 45)
_OwnTab_Label("Style 1", 200, 45)

_OwnTab_Style2($hGui, 20, 80, 200, 45)
_OwnTab_Pic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg', 200, 45)
_OwnTab_Label("Style 2", 200, 45)
_OwnTab_Style2($hGui, 220, 80, 200, 45)
_OwnTab_Label("Style 2", 200, 45, 0x201, 0x1)
_OwnTab_Style2($hGui, 420, 80, 200, 45)
_OwnTab_Label("Style 2", 200, 45, 0x411201)
_OwnTab_Style2($hGui, 620, 80, 200, 45)
_OwnTab_Gradient(0xffff00, 0xff9090, 200, 45)
_OwnTab_Label("Style 2", 200, 45)

_OwnTab_Style3($hGui, 20, 140, 200, 45)
_OwnTab_Pic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg', 200, 45)
_OwnTab_Label("Style 3", 200, 45)
_OwnTab_Style3($hGui, 220, 140, 200, 45)
_OwnTab_Label("Style 3", 200, 45, 0x201, 0x1)
_OwnTab_Style3($hGui, 420, 140, 200, 45)
_OwnTab_Label("Style 3", 200, 45, 0x411201)
_OwnTab_Style3($hGui, 620, 140, 200, 45)
_OwnTab_Gradient(0xffff00, 0x10a0ff, 200, 45)
_OwnTab_Label("Style 3", 200, 45)

_OwnTab_Style4($hGui, 20, 200, 200, 45)
_OwnTab_Pic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg', 200, 45)
_OwnTab_Label("Style 4", 200, 45)
_OwnTab_Style4($hGui, 220, 200, 200, 45)
_OwnTab_Label("Style 4", 200, 45, 0x201, 0x1)
_OwnTab_Style4($hGui, 420, 200, 200, 45)
_OwnTab_Label("Style 4", 200, 45, 0x411201)
_OwnTab_Style4($hGui, 620, 200, 200, 45)
_OwnTab_Gradient(0xffff00, 0x90ff90, 200, 45)
_OwnTab_Label("Style 4", 200, 45)

_OwnTab_Style5($hGui, 20, 260, 200, 45)
_OwnTab_Pic(@DocumentsCommonDir & '\Eigene Bilder\Beispielbilder\Sonnenuntergang.jpg', 200, 45)
_OwnTab_Label("Style 5", 200, 45)
_OwnTab_Style5($hGui, 220, 260, 200, 45)
_OwnTab_Label("Style 5", 200, 45, 0x201, 0x1)
_OwnTab_Style5($hGui, 420, 260, 200, 45)
_OwnTab_Label("Style 5", 200, 45, 0x411201)
_OwnTab_Style5($hGui, 620, 260, 200, 45)
_OwnTab_Gradient(0xffff00, 0xffffff, 200, 45)
_OwnTab_Label("Style 5", 200, 45)

GUISwitch($hGui)
GUISetState()

Local $msg
Do
 $msg = GUIGetMsg()
 If $msg > 0 Then MsgBox(0, "OwnTab", "You pressed tab with ID " & $msg & ".")
Until $msg = -3

Func _OwnTab_Label($sText, $iWidth, $iHeight, $iStyle = 0x201, $iExStyle = 0x0)
 Local $Label = GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, $iStyle, $iExStyle)
 GUICtrlSetBkColor(-1, -2)
 Return $Label
EndFunc

Func _OwnTab_Pic($sFileName, $iWidth, $iHeight, $iStyle = 0x0, $iExStyle = 0x0)
 Local $Pic = GUICtrlCreatePic($sFileName, 0, 0, $iWidth, $iHeight, $iStyle, $iExStyle)
 GUICtrlSetState(-1, 128) ;$GUI_DISABLE
 Return $Pic
EndFunc   ;==>_OwnTab_Pic

Func _OwnTab_Gradient($nStartColor, $nEndColor, $iWidth, $iHeight)
    Local $colorR = Dec(StringLeft(Hex($nStartColor, 6), 2))
    Local $colorG = Dec(StringMid(Hex($nStartColor, 6), 3, 2))
    Local $colorB = Dec(StringMid(Hex($nStartColor, 6), 5, 2))
 
    Local $StepR = (Dec(StringLeft(Hex($nEndColor, 6), 2)) - $colorR) / ($iHeight - 1)
    Local $StepG = (Dec(StringMid(Hex($nEndColor, 6), 3, 2)) - $colorG) / ($iHeight - 1)
    Local $StepB = (Dec(StringMid(Hex($nEndColor, 6), 5, 2)) - $colorB) / ($iHeight - 1)
 
 Local $hGraph = GUICtrlCreateGraphic(0, 0, $iWidth, $iHeight)
 Local $sCol
    For $i = 0 To $iHeight - 1
  $sCol = StringFormat("0x%02X%02X%02X", $colorR + $StepR * $i, $colorG + $StepG * $i, $colorB + $StepB * $i)
  GUICtrlSetGraphic(-1, 8, $sCol) ;$GUI_GR_COLOR = 8
  GUICtrlSetGraphic(-1, 6, 0, $i) ;$GUI_GR_MOVE = 6
  GUICtrlSetGraphic(-1, 2, $iWidth, $i) ;$GUI_GR_LINE = 2
    Next
 Return $hGraph
EndFunc   ;==>_OwnTab_Gradient

Func _OwnTab_Style1($hWnd, $iX, $iY, $iWidth, $iHeight)
 Local $rgn, $rgn2, $rel = $iHeight/5
 Local $hGui = GUICreate("OwnTab", $iWidth, $iHeight, $iX, $iY, 0x40000000, 0, $hWnd)
 $rgn = _WinAPI_CreateRectRgn(0, $rel, $iX + $iWidth, $iY + $iHeight)
 For $i = 0 To $rel - 1
  $rgn2 = _WinAPI_CreateRectRgn($rel - $i, $i, $iWidth - $rel + $i + 1, $i + 1)
  _WinAPI_CombineRgn($rgn, $rgn, $rgn2, $RGN_OR)
  _WinAPI_DeleteObject($rgn2)
 Next
 _WinAPI_SetWindowRgn($hGui, $rgn)
 GUISetState()
 Return $hGui
EndFunc   ;==>_OwnTab_Style1

Func _OwnTab_Style2($hWnd, $iX, $iY, $iWidth, $iHeight)
 Local $rgn, $rgn2
 Local $hGui = GUICreate("OwnTab", $iWidth, $iHeight, $iX, $iY, 0x40000000, 0, $hWnd)
 GUISetState()
 Return $hGui
EndFunc   ;==>_OwnTab_Style2

Func _OwnTab_Style3($hWnd, $iX, $iY, $iWidth, $iHeight)
 Local $rgn, $rgn2, $diameter = $iWidth
 Local $hGui = GUICreate("OwnTab", $iWidth, $iHeight, $iX, $iY, 0x40000000, 0, $hWnd)
 $rgn = _WinAPI_CreateRectRgn(0, $iHeight/2, $iWidth, $iHeight)
 $rgn2 = _WinAPI_CreateRoundRectRgn(0, 0, $iWidth, $iHeight, $diameter, $diameter)
 _WinAPI_CombineRgn($rgn, $rgn, $rgn2, $RGN_OR)
 _WinAPI_DeleteObject($rgn2)
 _WinAPI_SetWindowRgn($hGui, $rgn)
 GUISetState()
 Return $hGui
EndFunc   ;==>_OwnTab_Style3

Func _OwnTab_Style4($hWnd, $iX, $iY, $iWidth, $iHeight)
 Local $rgn, $rgn2, $rel = $iHeight/5
 Local $hGui = GUICreate("OwnTab", $iWidth, $iHeight, $iX, $iY, 0x40000000, 0, $hWnd)
 $rgn = _WinAPI_CreateRectRgn($rel, 0, $iWidth - $rel, 1)
 For $i = 1 To $iHeight - 1
  $rgn2 = _WinAPI_CreateRectRgn($rel - ($rel / $iHeight * $i), $i, $iWidth - $rel + ($rel / $iHeight * $i) + 1, $i + 1)
  _WinAPI_CombineRgn($rgn, $rgn, $rgn2, $RGN_OR)
  _WinAPI_DeleteObject($rgn2)
 Next
 _WinAPI_SetWindowRgn($hGui, $rgn)
 GUISetState()
 Return $hGui
EndFunc   ;==>_OwnTab_Style4

Func _OwnTab_Style5($hWnd, $iX, $iY, $iWidth, $iHeight)
 Local $rgn, $rgn2, $diameter = $iHeight
 Local $hGui = GUICreate("OwnTab", $iWidth, $iHeight, $iX, $iY, 0x40000000, 0, $hWnd)
 $rgn = _WinAPI_CreateRoundRectRgn($iWidth+ 1, 0, 0, $iWidth, $diameter, $diameter)
 _WinAPI_SetWindowRgn($hGui, $rgn)
 GUISetState()
 Return $hGui
EndFunc   ;==>_OwnTab_Style5

Now you can make our own tabs. Just design them by yourself.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

Hi, this is getting to be very impressive. I added a border to the tab and rendered the gradient differently. I think it is an improvement, but then again I'm not much of an artist.

#include <WindowsConstants.au3>
#Include <WinAPI.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Global $hGui = GUICreate("Overview OwnTab-Styles", 840, 400)
GUISetBkColor(0xFF080)

_OwnTab_Style5($hGui, 620, 260, 200, 45)
    Global $bckpic= GUICtrlCreatePic("",0,0,0,0,$WS_CLIPSIBLINGS)
     GuiCtrlSetState(-1,$GUI_DISABLE)
    _GDIPlus_Startup()
    $guibitmap=startbmp($hGui,200, 45)
    $guibitmap= _drawborder($guibitmap,200, 45,"2","0x444444","0x999999","22") ;sets up the border on background
    finalizectrl($bckpic,$guibitmap)
    _GDIPlus_Shutdown()
_OwnTab_Label("Style 5", 200, 45)

GUISwitch($hGui)
GUISetState()

Local $msg
Do
 $msg = GUIGetMsg()
 If $msg > 0 Then MsgBox(0, "OwnTab", "You pressed tab with ID " & $msg & ".")
Until $msg = -3

Func _OwnTab_Label($sText, $iWidth, $iHeight, $iStyle = 0x201, $iExStyle = 0x0)
 Local $Label = GUICtrlCreateLabel($sText, 0, 0, $iWidth, $iHeight, $iStyle, $iExStyle)
 GUICtrlSetBkColor(-1, -2)
 Return $Label
EndFunc

Func _OwnTab_Pic($sFileName, $iWidth, $iHeight, $iStyle = 0x0, $iExStyle = 0x0)
 Local $Pic = GUICtrlCreatePic($sFileName, 0, 0, $iWidth, $iHeight, $iStyle, $iExStyle)
 GUICtrlSetState(-1, 128) ;$GUI_DISABLE
 Return $Pic
EndFunc   ;==>_OwnTab_Pic

Func _OwnTab_Gradient($nStartColor, $nEndColor, $iWidth, $iHeight)
    Local $colorR = Dec(StringLeft(Hex($nStartColor, 6), 2))
    Local $colorG = Dec(StringMid(Hex($nStartColor, 6), 3, 2))
    Local $colorB = Dec(StringMid(Hex($nStartColor, 6), 5, 2))
 
    Local $StepR = (Dec(StringLeft(Hex($nEndColor, 6), 2)) - $colorR) / ($iHeight - 1)
    Local $StepG = (Dec(StringMid(Hex($nEndColor, 6), 3, 2)) - $colorG) / ($iHeight - 1)
    Local $StepB = (Dec(StringMid(Hex($nEndColor, 6), 5, 2)) - $colorB) / ($iHeight - 1)
 
 Local $hGraph = GUICtrlCreateGraphic(0, 0, $iWidth, $iHeight)
 Local $sCol
    For $i = 0 To $iHeight - 1
  $sCol = StringFormat("0x%02X%02X%02X", $colorR + $StepR * $i, $colorG + $StepG * $i, $colorB + $StepB * $i)
  GUICtrlSetGraphic(-1, 8, $sCol) ;$GUI_GR_COLOR = 8
  GUICtrlSetGraphic(-1, 6, 0, $i) ;$GUI_GR_MOVE = 6
  GUICtrlSetGraphic(-1, 2, $iWidth, $i) ;$GUI_GR_LINE = 2
    Next
 Return $hGraph
EndFunc   ;==>_OwnTab_Gradient

Func _OwnTab_Style5($hWnd, $iX, $iY, $iWidth, $iHeight)
 Local $rgn, $rgn2, $diameter = $iHeight
 Local $hGui = GUICreate("OwnTab", $iWidth, $iHeight, $iX, $iY, 0x40000000, 0, $hWnd)
 $rgn = _WinAPI_CreateRoundRectRgn($iWidth+ 1, 0, 0, $iWidth, $diameter, $diameter)
 _WinAPI_SetWindowRgn($hGui, $rgn)
 GUISetState()
 Return $hGui
EndFunc   ;==>_OwnTab_Style5

Func startbmp($gui,$iWidth, $iHeight)
    ;Create a new bitmap, this way the original opened png is left unchanged
     $hBitmap = _GDIPlus_GraphicsCreateFromHWND(WinGetHandle($gui))
    $hImage =  _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hBitmap)
    _WinAPI_DeleteObject($hBitmap)
    Return $hImage
EndFunc
func _drawborder($hBitmap,$gwt,$ght,$depth,$colour1,$colour2,$corner)
    $iC1 = StringReplace($colour1, "0x", "0xFF")
    $iC2 = StringReplace($colour2, "0x", "0xFF")
    $hGraphics = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    Global $hBrush = _GDIPlus_BrushCreateSolid($iC1)
    Global $hBrush2 = _GDIPlus_BrushCreateSolid(0xFF7E3517)

    Local $aFactors[4] = [0.0, 0.6, 0.8, 1.0], $aPositions[4] = [0.0, 0.6, 0.8, 1.0]
    Local $bGammaCorrection = False
    $hBrush1 = _GDIPlus_CreateLineBrushFromRect(0, 0, $gwt,$ght, $aFactors, $aPositions, "0xFFBBBBBB",$iC1, 1)
    GDIPlus_SetLineGammaCorrection($hBrush1, $bGammaCorrection)
    $hBrush3 = _GDIPlus_CreateLineBrushFromRect(0, 0, $gwt,$ght, $aFactors, $aPositions, $iC1,$iC2,  3)
    GDIPlus_SetLineGammaCorrection($hBrush3, $bGammaCorrection)
;    Global $hBrush1 = _GDIPlus_BrushCreateSolid($iC2)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 4)
        _GDIPlus_GraphicsDrawRoundRect($hGraphics, 0, 0, $gwt,$ght, $corner, $hBrush3)
        _GDIPlus_GraphicsDrawRoundRect($hGraphics, $depth, $depth, $gwt-($depth*2)-2, $ght-($depth*2)-2, $corner,$hBrush1)

        _GDIPlus_BrushDispose($hBrush)
        _GDIPlus_BrushDispose($hBrush1)
        _GDIPlus_BrushDispose($hBrush2)
         _GDIPlus_GraphicsDispose($hGraphics)
return $hBitmap
EndFunc

Func finalizectrl($controlID,$hImage)
    $hWnd = GUICtrlGetHandle($controlID)
            $hbmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
     $aBmp = DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hWnd, "int", 0x0172, "int", 0, "int", $hbmp)
    If $aBmp[0] <> 0 Then _WinAPI_DeleteObject($aBmp[0])
    _WinAPI_DeleteObject($hbmp)
EndFunc

;==== GDIPlus_CreateLineBrushFromRect === Malkey's function
Func _GDIPlus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFactors, $aPositions, _
        $iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $LinearGradientMode = 0x00000001, $WrapMode = 0)

    Local $tRect, $pRect, $aRet, $tFactors, $pFactors, $tPositions, $pPositions, $iCount

    If $iArgb1 = Default Then $iArgb1 = 0xFF0000FF
    If $iArgb2 = Default Then $iArgb2 = 0xFFFF0000
    If $LinearGradientMode = -1 Or $LinearGradientMode = Default Then $LinearGradientMode = 0x00000001
    If $WrapMode = -1 Or $LinearGradientMode = Default Then $WrapMode = 1

    $tRect = DllStructCreate("float X;float Y;float Width;float Height")
    $pRect = DllStructGetPtr($tRect)
    DllStructSetData($tRect, "X", $iX)
    DllStructSetData($tRect, "Y", $iY)
    DllStructSetData($tRect, "Width", $iWidth)
    DllStructSetData($tRect, "Height", $iHeight)
    $aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, _
            "int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0)

    If IsArray($aFactors) = 0 Then Dim $aFactors[4] = [0.0, 0.4, 0.6, 1.0]
    If IsArray($aPositions) = 0 Then Dim $aPositions[4] = [0.0, 0.3, 0.7, 1.0]
    $iCount = UBound($aPositions)
    $tFactors = DllStructCreate("float[" & $iCount & "]")
    $pFactors = DllStructGetPtr($tFactors)
    For $iI = 0 To $iCount - 1
        DllStructSetData($tFactors, 1, $aFactors[$iI], $iI + 1)
    Next
    $tPositions = DllStructCreate("float[" & $iCount & "]")
    $pPositions = DllStructGetPtr($tPositions)
    For $iI = 0 To $iCount - 1
        DllStructSetData($tPositions, 1, $aPositions[$iI], $iI + 1)
    Next
    $hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineBlend", "hwnd", $aRet[6], _
            "ptr", $pFactors, "ptr", $pPositions, "int", $iCount)
    Return $aRet[6] ; Handle of Line Brush
EndFunc   ;==>_GDIPlus_CreateLineBrushFromRect

Func GDIPlus_SetLineGammaCorrection($hBrush, $useGammaCorrection = True)
    Local $aResult
    $aResult = DllCall($ghGDIPDll, "int", "GdipSetLineGammaCorrection", "hwnd", $hBrush, "int", $useGammaCorrection)
    Return $aResult[0]
EndFunc   ;==>GDIPlus_SetLineGammaCorrection

Func _GDIPlus_GraphicsDrawRoundRect($hGraphics, $iX, $iY, $iWidth, $iHeight, $iRadius, $hBrush = 0, $hPen = 0)
    _GDIPlus_PenCreate($hPen)
    Local $hPath = _GDIPlus_GraphicsPathCreate()
    _GDIPlus_GraphicsPathAddLine($hPath, $iX + $iRadius, $iY, $iX + $iWidth - ($iRadius * 2), $iY)
     _GDIPlus_GraphicsPathAddArc($hPath, $iX + $iWidth - ($iRadius * 2), $iY, $iRadius * 2, $iRadius * 2, 270, 90)
    _GDIPlus_GraphicsPathAddLine($hPath, $iX + $iWidth, $iY + $iRadius, $iX + $iWidth, $iY + $iHeight )
  ;  _GDIPlus_GraphicsPathAddArc($hPath, $iX + $iWidth - ($iRadius * 2), $iY + $iHeight - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 0, 90)
    _GDIPlus_GraphicsPathAddLine($hPath, $iX + $iWidth , $iY + $iHeight, $iX, $iY + $iHeight)
  ;  _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY + $iHeight - ($iRadius * 2), $iRadius * 2, $iRadius * 2, 90, 90)
        _GDIPlus_GraphicsPathAddLine($hPath, $iX, $iY + $iHeight - ($iRadius * 2), $iX, $iY + $iRadius)
    _GDIPlus_GraphicsPathAddArc($hPath, $iX, $iY, $iRadius * 2, $iRadius * 2, 180, 90)

    ;Draw the font onto the new bitmap
    _GDIPlus_GraphicsPathCloseFigure($hPath)
    If $hBrush <> 0 Then _GDIPlus_GraphicsFillPath($hGraphics, $hBrush, $hPath)
    _GDIPlus_GraphicsDrawPath($hGraphics, $hPen, $hPath)
    _GDIPlus_GraphicsPathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
EndFunc

Func _GDIPlus_GraphicsPathCreate($iFillMode = 0)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", $iFillMode, "int*", 0);
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[2])
EndFunc
Func _GDIPlus_GraphicsPathAddLine($hGraphicsPath, $iX1, $iY1, $iX2, $iY2)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathLine", "hwnd", $hGraphicsPath, "float", $iX1, "float", $iY1, _
                                "float", $iX2, "float", $iY2)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, 0)
EndFunc
Func _GDIPlus_GraphicsPathAddArc($hGraphicsPath, $iX, $iY, $iWidth, $iHeight, $iStartAngle, $iSweepAngle)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathArc", "hwnd", $hGraphicsPath, "float", $iX, "float", $iY, _
                                "float", $iWidth, "float", $iHeight, "float", $iStartAngle, "float", $iSweepAngle)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, 0)
EndFunc
Func _GDIPlus_GraphicsPathCloseFigure($hGraphicsPath)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "hwnd", $hGraphicsPath)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, 0)
EndFunc
Func _GDIPlus_GraphicsPathDispose($hGraphicsPath)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipDeletePath", "hwnd", $hGraphicsPath)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, 0)
EndFunc
Func _GDIPlus_GraphicsDrawPath($hGraphics, $hPen, $hGraphicsPath)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipDrawPath", "hwnd", $hGraphics, "hwnd", $hPen, "hwnd", $hGraphicsPath)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, 0)
EndFunc
Func _GDIPlus_GraphicsFillPath($hGraphics, $hBrush, $hGraphicsPath)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipFillPath", "hwnd", $hGraphics, "hwnd", $hBrush, "hwnd", $hGraphicsPath)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, 0)
EndFunc
Edited by picea892
Link to comment
Share on other sites

Wow, fantastic stuff picea892!!! Now I have a lot of work to let it be easy to use. I'm not sure about the hover-funktion with this user-drawn picture, but I will solve this hopefully!

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

Hi, this is getting to be very impressive. I added a border to the tab and rendered the gradient differently. I think it is an improvement, but then again I'm not much of an artist.

Very nice, picea! That's looking really good. I thought I'd attempt one myself but that plan fizzled when I saw your code. Man, that GDIPlus stuff is intimidating at first. Up until now I've done a fine job of avoiding it but after seeing your tab I guess its time for me to go lock horns with:

GDIPlus_GraphicsCreateFigureArcFillBrushLinePathSetGabbaGabba($tab)

Cover me, I'm going in!

Link to comment
Share on other sites

  • 1 month later...

@Funkey,

Thanks for this great udf.

I tried to hide the second and third tab, but it leave's an empty space..

Do you think this can be fixed ?!

Futher the behavior of a label over an image which is disabled erases parts of the background image.

The background image is a transparant gif

Best regards,

Emiel

Edited by Emiel Wieldraaijer

Best regards,Emiel Wieldraaijer

Link to comment
Share on other sites

  • 4 weeks later...

I have got crash in _HoverCheck() function.

The error is:

C:\All\B_QA\QA\MyTools\Astetaine\examples\OwnTab\OwnTab.au3 (443) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$szTemp_Array[1] = $HoverArray[$Global_I]

$szTemp_Array[1] = ^ ERROR

BTW: I like the idea

Func _HoverCheck()
    $HoverData = GUIGetCursorInfo()
    If Not IsArray($HoverData) Then Return
    $Temp_Found = 0
    For $i = 1 To UBound($HoverArray) - 1
        If $HoverData[4] = $HoverArray[$i] Or $HoverData[4] = $HoverArray[$i] + 1 Then
            $Temp_Found = $i
        EndIf
    Next
    Select
        Case $Temp_Found = 0 And $HoverActive = 1 Or $Temp_Found <> 0 And $Temp_Found <> $Global_I And $HoverActive = 1
            $HoverActive = 0
            $Temp_Found = 0
            $szTemp_Array[0] = "LostHover"
            $szTemp_Array[1] = $HoverArray[$Global_I]
            Return $szTemp_Array
        Case $Temp_Found > 0 And $HoverActive = 0
            $Global_I = $Temp_Found
            $HoverActive = 1
            $Temp_Found = 0
            $szTemp_Array[0] = "AcquiredHover"
            $szTemp_Array[1] = $HoverArray[$Global_I]
            Return $szTemp_Array
    EndSelect
EndFunc   ;==>_HoverCheck

Be Green Now or Never (BGNN)!

Link to comment
Share on other sites

Hi,

after updating to the latest stabil and beta I tested coincidentally OwnTab_example.

After replacing AdlibEnable with AdlibRegister (see help) it works fine.

If you have problems it may help if you state your version.

best regards, Reinhard

Link to comment
Share on other sites

Hi,

after updating to the latest stabil and beta I tested coincidentally OwnTab_example.

After replacing AdlibEnable with AdlibRegister (see help) it works fine.

If you have problems it may help if you state your version.

best regards, Reinhard

I am not sure. There are still problems with the latest UDF as for today.

1. The icons disapears at some point when clicking many times on the tabs. i do not have the use case..

2. A memory problems occurs after many clicks. Sometimes getting crash or the client is not responding.

I suspects the problem related to the icons.I removed all icons and no problem occurs.! :D

I like it and want to use it in my project. hope I will get help and the UDF will be fixed.

Thanks for sharing it.

Edited by lsakizada

Be Green Now or Never (BGNN)!

Link to comment
Share on other sites

  • 3 weeks later...

Tank you very much for your UDF! I search half an hour for setting the bgColor of a tab.....than I found your UDF, and this saved a lot of time.

Currently I face a small problem with the hover in my app, but in the example its working. It is highlighting but not changing (in my app).

Thank you very much !

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...