Renderer Posted August 3, 2015 Share Posted August 3, 2015 Hi Guys! How can i create a vertical label ? I'm waiting for your answers. Thanks in advance! Link to comment Share on other sites More sharing options...
mikell Posted August 3, 2015 Share Posted August 3, 2015 #include <GuiConstantsEx.au3> $gui = GUICreate("Tchuss") GuiSetFont(12, 600, 0, "Arial Unicode MS") $str = StringRegExpReplace("vertical label", '(?=.)', @crlf) $label = GuiCtrlCreateLabel($str, 20, 10, 15, 350, 1) GUISetState() Msgbox(0,"", "pause") Link to comment Share on other sites More sharing options...
UEZ Posted August 3, 2015 Share Posted August 3, 2015 (edited) Here a "real" vertical label:expandcollapse popup;build 2015-08-03 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> Global Const $STM_SETIMAGE = 0x0172 Global $aRet1 = _GDIPlus_BitmapCreateVerticalText("Vertical Label1", 40) Global $aRet2 = _GDIPlus_BitmapCreateVerticalText("Vertical Label2", 40, "Arial", 0xFF000000, 0xFFF0F0F0, 1) Global Const $hGUI = GUICreate("Vertical Label", 300, 400) Global Const $iPic_Label1 = GUICtrlCreatePic("", 10, 0, $aRet1[1], $aRet1[2]) Global Const $iPic_Label2 = GUICtrlCreatePic("", 290 - $aRet1[1], 20, $aRet2[1], $aRet2[2]) _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_Label1, $STM_SETIMAGE, $IMAGE_BITMAP, $aRet1[0])) _WinAPI_DeleteObject(GUICtrlSendMsg($iPic_Label2, $STM_SETIMAGE, $IMAGE_BITMAP, $aRet2[0])) GUISetState() Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _WinAPI_DeleteObject($aRet1[0]) _WinAPI_DeleteObject($aRet2[0]) GUIDelete() Exit Case $iPic_Label1, $iPic_Label2 MsgBox(0, "Test", "Label was clicked") EndSwitch Until False Func _GDIPlus_BitmapCreateVerticalText($sString, $fFontSize = 10, $sFont = "Arial", $iColor_Text = 0xFF000000, $iColor_Bg = 0xFFF0F0F0, $iFlip = 3) $iFlip = $iFlip <> 3 Or $iFlip <> 1 ? 3 : $iFlip _GDIPlus_Startup() Local Const $hDC = _WinAPI_GetWindowDC(0) Local Const $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC) Local Const $hBrush = _GDIPlus_BrushCreateSolid($iColor_Text) Local Const $hFormat = _GDIPlus_StringFormatCreate() Local Const $hFamily = _GDIPlus_FontFamilyCreate($sFont) Local Const $hFont = _GDIPlus_FontCreate($hFamily, $fFontSize) Local $tLayout = _GDIPlus_RectFCreate() Local Const $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat) Local $iError = 1 If Not @error Then Local Const $iW = Ceiling($aInfo[0].Width), $iH = Ceiling($aInfo[0].Height) Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH), $hCanvas = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetTextRenderingHint($hCanvas, $GDIP_TEXTRENDERINGHINT_ANTIALIASGRIDFIT) $tLayout.X = 0 $tLayout.Y = 0 $tLayout.Width = $iW $tLayout.Height = $iH _GDIPlus_GraphicsDrawStringEx($hCanvas, $sString, $hFont, $tLayout, $hFormat, $hBrush) _GDIPlus_ImageRotateFlip($hBitmap, $iFlip) Local Const $hBitmap_GDI = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_GraphicsDispose($hCanvas) _GDIPlus_BitmapDispose($hBitmap) $iError = 0 EndIf _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _WinAPI_ReleaseDC(0, $hDC) _GDIPlus_Shutdown() If $iError Then Return SetError(1, 0, 0) Local $aResult[3] = [$hBitmap_GDI, $iH, $iW] Return $aResult EndFunc Edited August 3, 2015 by UEZ Added some checks but still not fully tested! Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
mikell Posted August 3, 2015 Share Posted August 3, 2015 Obviously it was a question for UEZ, the GDI+ local reference Link to comment Share on other sites More sharing options...
UEZ Posted August 3, 2015 Share Posted August 3, 2015 Obviously it was a question for UEZ, the GDI+ local reference There is also a GDI version flying around made by BugFix... Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Renderer Posted August 5, 2015 Author Share Posted August 5, 2015 thanks GUYS! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now