ChrisL Posted February 25, 2009 Share Posted February 25, 2009 I'm creating a EAN8 readable barcode and I want to put the human readable it in a block on the right. I'm using _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDrawString ($hGraphic, $BarCodeStr, 305, 110,"Arial",20,0x0002);vertical text To write the text vertically but it writes from top to bottom, how can I rotate the text 180 when writing it please? [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
Andreik Posted February 25, 2009 Share Posted February 25, 2009 (edited) Malkey wrote this nice function: http://www.autoitscript.com/forum/index.ph...st&p=584436Edit: an exampleexpandcollapse popup#include <GDIPlus.au3> $GUI = GUICreate("GDI+",400,400) $TEXT = GUICtrlCreateInput("02695",5,5,100,20) $DRAW = GUICtrlCreateButton("DRAW",5,30,50,20) _GDIPlus_Startup() $GRAPHIC = _GDIPlus_GraphicsCreateFromHWND($GUI) GUISetState() While 1 $MSG = GUIGetMsg() If $MSG = -3 Then _GDIPlus_GraphicsDispose($GRAPHIC) _GDIPlus_Shutdown() Exit ElseIf $MSG = $DRAW Then GDIPlus_SetAngledText($GRAPHIC,GUICtrlRead($TEXT),200,200,90,"Arial",12,0xFF000000) EndIf Sleep(20) WEnd Func GDIPlus_SetAngledText($hGraphic, $nText, $iCentreX = 0, $iCentreY = 0, $iAngle = 0, $nFontName = "Arial", _ $nFontSize = 12, $iARGB = 0xFFFF00FF, $iAnchor = 0) Local $iPI = 3.14159265358979 Local $x, $y, $iX, $iY, $iWidth, $iHeight Local $hMatrix, $iXt, $iYt, $hBrush, $hFormat, $hFamily, $hFont, $tLayout If $iAngle = "" Then $iAngle = 0 If $nFontName = "" Or $nFontName = -1 Then $nFontName = "Arial" If $nFontSize = "" Then $nFontSize = 12 If $iARGB = "" Then $iARGB = "0xFF" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) EndIf $hFormat = _GDIPlus_StringFormatCreate(0) $hFamily = _GDIPlus_FontFamilyCreate($nFontName) $hFont = _GDIPlus_FontCreate($hFamily, $nFontSize, 1, 3) $tLayout = _GDIPlus_RectFCreate($iCentreX, $iCentreY, 0, 0) $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $nText, $hFont, $tLayout, $hFormat) $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width")) $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height")) If $iAnchor = 0 Then $iX = $iCentreX $iY = $iCentreY Else $iX = $iCentreX + (($iWidth - Abs($iHeight * Sin($iAngle * $iPI / 180))) / 2) $iY = $iCentreY + (($iHeight + Abs($iWidth * Sin($iAngle * $iPI / 180))) / 2) EndIf $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixRotate($hMatrix, $iAngle, 1) _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix) $x = ($iWidth / 2) * Cos($iAngle * $iPI / 180) - ($iHeight / 2) * Sin($iAngle * $iPI / 180) $y = ($iWidth / 2) * Sin($iAngle * $iPI / 180) + ($iHeight / 2) * Cos($iAngle * $iPI / 180) $iXt = ($iX - $x) * Cos($iAngle * $iPI / 180) + ($iY - $y) * Sin($iAngle * $iPI / 180) $iYt = -($iX - $x) * Sin($iAngle * $iPI / 180) + ($iY - $y) * Cos($iAngle * $iPI / 180) $hBrush = _GDIPlus_BrushCreateSolid($iARGB) $tLayout = _GDIPlus_RectFCreate($iXt, $iYt, $iWidth, $iHeight) _GDIPlus_GraphicsDrawStringEx($hGraphic, $nText, $hFont, $tLayout, $hFormat, $hBrush) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) $tLayout = "" Return 1 EndFunc ;==>GDIPlus_SetAngledText Edited February 25, 2009 by Andreik Bitnugger 1 When the words fail... music speaks. Link to comment Share on other sites More sharing options...
ChrisL Posted February 25, 2009 Author Share Posted February 25, 2009 Wow, Cool thanks [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire 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