Jump to content
Sign in to follow this  
Ascer

WIA.Vector resize image

Recommended Posts

Ascer

Hello,

Do you have any idea to resize Vector graphic using some maths trick?

It's example to create Vector image 10x10px and write A

Local $a10x10 = [ _
1,1,1,1,1,1,1,1,1,1, _
1,1,1,0,0,0,0,1,1,1, _
1,1,0,0,1,1,0,0,1,1, _
1,1,0,1,1,1,1,0,1,1, _
1,1,0,1,1,1,1,0,1,1, _
1,1,0,0,0,0,0,0,1,1, _
1,1,0,1,1,1,1,0,1,1, _
1,1,0,1,1,1,1,0,1,1, _
1,0,0,0,1,1,0,0,0,1, _
1,1,1,1,1,1,1,1,1,1 _
]

Local $oVector = ObjCreate("WIA.Vector.1")

If Not IsObj($oVector) Then
    ConsoleWrite("+++ Error " & @error & " durning create a Vector.object." & @CRLF)
    Exit
EndIf

Local $iBlue = 0xFF0000FF ; ARGB color
Local $iWhite = 0xFFFFFFFF

; adding pixels to vector
For $i = 0 To UBound($a10x10) - 1
    Local $iPixel = $a10x10[$i]
    Local $iColor = $iBlue
    If $iPixel = 0 Then $iColor = $iWhite
    $oVector.Add($iColor)
Next

; create a img 10x10 px
Local $oImg = $oVector.ImageFile(10, 10)

; path to file
Local $sPath = @ScriptDir & "\Vector.bmp"

; delete previous file if exits.
FileDelete($sPath)

; save img to script direction.
$oImg.SaveFile($sPath)

; show result, you have to use 800% size to see effects.
ShellExecute("Vector.bmp")

 

  • Like 1

Share this post


Link to post
Share on other sites
Ascer

Take a look into this image. Vector should change like this, now need to write maths algoritm.

                     2x2 px                                                                                           4x4 px

vector.png

Share this post


Link to post
Share on other sites
UEZ

You can scale (resize) the image but I assume you want the vector resized.

Local $a10x10 = [ _
1,1,1,1,1,1,1,1,1,1, _
1,1,1,0,0,0,0,1,1,1, _
1,1,0,0,1,1,0,0,1,1, _
1,1,0,1,1,1,1,0,1,1, _
1,1,0,1,1,1,1,0,1,1, _
1,1,0,0,0,0,0,0,1,1, _
1,1,0,1,1,1,1,0,1,1, _
1,1,0,1,1,1,1,0,1,1, _
1,0,0,0,1,1,0,0,0,1, _
1,1,1,1,1,1,1,1,1,1 _
]

Local $oVector = ObjCreate("WIA.Vector.1")
Local $oImageProcess = ObjCreate("WIA.ImageProcess")

If Not IsObj($oVector) Then
    ConsoleWrite("+++ Error " & @error & " durning create a Vector.object." & @CRLF)
    Exit
EndIf

If Not IsObj($oImageProcess) Then
    ConsoleWrite("+++ Error " & @error & " durning create a ImageProcess.object." & @CRLF)
    Exit
EndIf

Local $iBlue = 0xFF0000FF ; ARGB color
Local $iWhite = 0xFFFFFFFF

; adding pixels to vector
For $i = 0 To UBound($a10x10) - 1
    Local $iPixel = $a10x10[$i]
    Local $iColor = $iBlue
    If $iPixel = 0 Then $iColor = $iWhite
    $oVector.Add($iColor)
Next

; create a img 10x10 px
Local $oImg = $oVector.ImageFile(10, 10)

;scale image
$oImageProcess.Filters.Add($oImageProcess.FilterInfos("Scale").FilterID)
$oImageProcess.Filters(1).Properties("MaximumWidth") = 100
$oImageProcess.Filters(1).Properties("MaximumHeight") = 100
$oImg_Resized = $oImageProcess.Apply($oImg)

; path to file
Local $sPath = @ScriptDir & "\Vector.bmp"

; delete previous file if exits.
FileDelete($sPath)

; save img to script direction.
$oImg_Resized.SaveFile($sPath)

; show result, you have to use 800% size to see effects.
ShellExecute("Vector.bmp")

 


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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Ascer

@UEZ

Thanks for replay but result is horrible in this way. 

I try to spent more time on resize algorithm its only true way.

Share this post


Link to post
Share on other sites
UEZ

@Ascer is the vector array always quadratic?


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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Ascer

I think that not.

It's example of 20x10

Local $a20x10 = [ _
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, _
1,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1, _
1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,0,1, _
1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1,1, _
1,0,1,1,1,0,1,0,0,0,0,1,1,1,1,1,0,1,1,1, _
1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,0,1,1,1,1, _
1,0,1,1,1,0,1,0,1,1,1,1,1,1,0,1,1,1,1,1, _
1,0,1,1,1,0,1,0,1,1,1,1,1,0,1,1,1,1,1,1, _
1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1, _
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 _
]

Local $oVector = ObjCreate("WIA.Vector.1")

If Not IsObj($oVector) Then
    ConsoleWrite("+++ Error " & @error & " durning create a Vector.object." & @CRLF)
    Exit
EndIf

Local $iBlack = 0x00000000 ; ARGB color
Local $iWhite = 0xFFFFFFFF

; adding pixels to vector
For $i = 0 To UBound($a20x10) - 1
    Local $iPixel = $a20x10[$i]
    Local $iColor = $iBlack
    If $iPixel = 0 Then $iColor = $iWhite
    $oVector.Add($iColor)
Next

; create a img 10x10 px
Local $oImg = $oVector.ImageFile(20, 10)

; path to file
Local $sPath = @ScriptDir & "\Vector.bmp"

; delete previous file if exits.
FileDelete($sPath)

; save img to script direction.
$oImg.SaveFile($sPath)

; show result, you have to use 800% size to see effects.
ShellExecute("Vector.bmp")

 

Share this post


Link to post
Share on other sites
UEZ

How should I know the dimension of this vector which is only 1D?


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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Ascer

There is a way to get vector size.

Local $oVector = ObjCreate("WIA.Vector.1")

ConsoleWrite("The count of vector before adding is " & $oVector.Count & @CRLF)
ConsoleWrite("Adding 100 items to vector..." & @CRLF)

For $i = 1 To 100
    $oVector.Add($i)
Next

ConsoleWrite("Adding has end, current count of vector is " & $oVector.Count & @CRLF)

You can also find more vectors functions here: https://msdn.microsoft.com/pl-pl/library/windows/desktop/ms630513(v=vs.85).aspx

Share this post


Link to post
Share on other sites
SlackerAl

Convert the 1D vector into a 2D array, map it to a new 2D array based on scaled and rounded indexes (a nested loop for example) then convert the new 2D array back into a 1D array... Small changes in array size will still look ugly because of the rounding. On larger arrays you could introduce blurring based on the surrounding indexes....

 


Problem solving step 1: Write a simple, self-contained, running, replicator of your problem.

Share this post


Link to post
Share on other sites
UEZ

Well, for quadratic array this works but not for the other non quadratic one.

#include <Array.au3>
Local $a20x10 = [ _
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, _
1,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1, _
1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,0,1, _
1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1,1, _
1,0,1,1,1,0,1,0,0,0,0,1,1,1,1,1,0,1,1,1, _
1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,0,1,1,1,1, _
1,0,1,1,1,0,1,0,1,1,1,1,1,1,0,1,1,1,1,1, _
1,0,1,1,1,0,1,0,1,1,1,1,1,0,1,1,1,1,1,1, _
1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1, _
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 _
]

Local $a10x10 = [ _
1,1,1,1,1,1,1,1,1,1, _
1,1,1,0,0,0,0,1,1,1, _
1,1,0,0,1,1,0,0,1,1, _
1,1,0,1,1,1,1,0,1,1, _
1,1,0,1,1,1,1,0,1,1, _
1,1,0,0,0,0,0,0,1,1, _
1,1,0,1,1,1,1,0,1,1, _
1,1,0,1,1,1,1,0,1,1, _
1,0,0,0,1,1,0,0,0,1, _
1,1,1,1,1,1,1,1,1,1 _
]

Local $oVector = ObjCreate("WIA.Vector.1")
Local $oImageProcess = ObjCreate("WIA.ImageProcess")

If Not IsObj($oVector) Then
    ConsoleWrite("+++ Error " & @error & " durning create a Vector.object." & @CRLF)
    Exit
EndIf

If Not IsObj($oImageProcess) Then
    ConsoleWrite("+++ Error " & @error & " durning create a ImageProcess.object." & @CRLF)
    Exit
EndIf

Local $iBlue = 0x0000FF ; RGB color
Local $iWhite = 0xFFFFFF

Local $fScaleX = 20, $fScaleY = 20, $iUboundX = 20, $iUboundY = 10
Local $aVector_scaled = ScaleVectorArray1D($a20x10, $iUboundY, $iUboundX, $fScaleX, $fScaleY)

; adding pixels to vector
For $i = 0 To UBound($aVector_scaled) - 1
    Local $iPixel = $aVector_scaled[$i]
    Local $iColor = $iBlue
    If $iPixel = 0 Then $iColor = $iWhite
    $oVector.Add($iColor)
Next

; create a img 10x10 px
Local $oImg = $oVector.ImageFile($fScaleX * $iUboundX, $fScaleY * $iUboundY)

; path to file
Local $sPath = @ScriptDir & "\Vector.bmp"

; delete previous file if exits.
FileDelete($sPath)

; save img to script direction.
$oImg.SaveFile($sPath)

; show result, you have to use 800% size to see effects.
ShellExecute("Vector.bmp")


Func ScaleVectorArray1D($aVector1D, $iUboundY, $iUboundX, $iScaleX = 20, $iScaleY = 20)
    Local $aVector2D[$iUboundY][$iUboundX]
    Local $c = 0, $x, $y
    For $y = 0 To UBound($aVector2D) - 1
        For $x = 0 To UBound($aVector2D, 2) - 1
            $aVector2D[$y][$x] = $aVector1D[$c]
            $c += 1
        Next
    Next
    Local $iUB2x = UBound($aVector2D, 2) * $iScaleX, $iUB2y = UBound($aVector2D) * $iScaleY
    Local $aVector1D_new[$iUB2x * $iUB2y], $dx = UBound($aVector2D, 2) / $iUB2x, $dy = UBound($aVector2D) / $iUB2y
    $c = 0
    For $y = 0 To $iUB2y - 1
        For $x = 0 To $iUB2x - 1
            $aVector1D_new[$c] = $aVector2D[$y * $dy][$x * $dx]
            $c += 1
        Next
    Next
    Return $aVector1D_new
EndFunc

 

Working on it... fixed it.

Edited by UEZ
Issue fixed with non quadratic arrays
  • Like 1

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
UEZ

@Ascer I think I fixed it. Please test.


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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Ascer

@UEZ

You rock! works perfect.

Share this post


Link to post
Share on other sites
Ascer

@UEZ

Look this example below vectors seems to be amazing.. mmm...

Local $a10x10 = [ _
2,2,2,2,2,2,2,2,2,2, _
2,0,0,0,0,1,1,1,1,2, _
2,0,1,1,1,0,0,0,1,2, _
2,0,1,1,1,0,0,0,1,2, _
2,0,1,1,1,0,0,0,1,2, _
2,1,0,0,0,1,1,1,0,2, _
2,1,0,0,0,1,1,1,0,2, _
2,1,0,0,0,1,1,1,0,2, _
2,1,1,1,1,0,0,0,0,2, _
2,2,2,2,2,2,2,2,2,2 _
]

Local $oVector = ObjCreate("WIA.Vector.1")

If Not IsObj($oVector) Then
    ConsoleWrite("+++ Error " & @error & " durning create a Vector.object." & @CRLF)
    Exit
EndIf

Local $iRed = 0xFF0000 ; RGB color
Local $iWhite = 0xFFFFFF
Local $iBlack = 0xF0F0F0

; scale image from 10x10px to 400x400px
Local $fScaleX = 40, $fScaleY = 40, $iUboundX = 10, $iUboundY = 10

ConsoleWrite("Creating array for vector..." & @CRLF)

Local $aVector_scaled = ScaleVectorArray1D($a10x10, $iUboundY, $iUboundX, $fScaleX, $fScaleY)

ConsoleWrite("Array has done." & @CRLF)

ConsoleWrite("Creating a vector image..." & @CRLF)

; adding pixels to vector
For $i = 0 To UBound($aVector_scaled) - 1
    Local $iPixel = $aVector_scaled[$i]
    Local $iColor = $iPixel = 0 ? $iWhite : $iPixel = 1 ? $iRed : $iBlack
    $oVector.Add($iColor)
Next

ConsoleWrite("Image has done." & @CRLF)

; create a img
Local $oImg = $oVector.ImageFile($fScaleX * $iUboundX, $fScaleY * $iUboundY)

; path to file
Local $sPath = @ScriptDir & "\Vector.bmp"

; delete previous file if exits.
FileDelete($sPath)

; save img to script direction.
$oImg.SaveFile($sPath)

; show result.
ShellExecute("Vector.bmp")

Func ScaleVectorArray1D($aVector1D, $iUboundY, $iUboundX, $iScaleX = 20, $iScaleY = 20)
    Local $aVector2D[$iUboundY][$iUboundX]
    Local $c = 0, $x, $y
    For $y = 0 To UBound($aVector2D) - 1
        For $x = 0 To UBound($aVector2D, 2) - 1
            $aVector2D[$y][$x] = $aVector1D[$c]
            $c += 1
        Next
    Next
    Local $iUB2x = UBound($aVector2D, 2) * $iScaleX, $iUB2y = UBound($aVector2D) * $iScaleY
    Local $aVector1D_new[$iUB2x * $iUB2y], $dx = UBound($aVector2D, 2) / $iUB2x, $dy = UBound($aVector2D) / $iUB2y
    $c = 0
    For $y = 0 To $iUB2y - 1
        For $x = 0 To $iUB2x - 1
            $aVector1D_new[$c] = $aVector2D[$y * $dy][$x * $dx]
            $c += 1
        Next
    Next
    Return $aVector1D_new
EndFunc ;==>ScaleVectorArray1D by UEZ

 

Edited by Ascer

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  

  • Similar Content

    • RTFC
      By RTFC
      Eigen4AutoIt Features:
      free, fast matrix computing environment for Windows (runs under Wine on Linux and Mac) built upon the robust Eigen code base (open-source), with many enhancements simple, intuitive functions, with extensive online documentation supports integer, single, and double precision, in real and complex matrices Tutorials with scripts, plus Test scripts for each function section easily exchange data between native binary files (.mat) and ASCII, Excel, and Xbase files, or AutoIt arrays 32-bit (x86-mode) and 64-bit (x64-mode) support in x64-mode, matrices can be any size that fits into available virtual memory (>4GB), and can be shared between processes over one thousand alias wrappers for flexibility and ease-of-use  
      The Eigen4AutoIt thread is here:
      This computing environment allows you to do matrix I/O (memory & files), matrix arithmetic, transformation, reduction, and decomposition, solve systems of linear equations, and perform statistics. Most functions can act on integer, real, or complex matrices (or the latter's real/imaginary parts separately). Much of the actual complexity of using Eigen in its native C++ environment has been hidden for AutoIt users, through extensive bounds and error checks, an intuitive function-naming convention, a large help file, and detailed tutorials and test examples.
    • therks
      By therks
      I'm trying to create a simple clock widget that automatically scales the text to the size of the window. I came up with the following method, but it doesn't work as well as I'd like. It especially has trouble scaling to the width of the window for some reason (in the example, try resizing the window to be narrow and tall).
      Does anyone have a better method?
      #include <Misc.au3> #include <WinAPIConv.au3> #include <GUIConstants.au3> #include <GDIPlus.au3> Opt('MustDeclareVars', 1) Global $_FONT_FAMILY = 'Arial', $_LB_TEXT Main() Func Main() _GDIPlus_Startup() Local $hGUI GUIRegisterMsg($WM_SIZE, WM_SIZE) $hGUI = GUICreate('', 300, 100, Default, Default, $WS_OVERLAPPEDWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) $_LB_TEXT = GUICtrlCreateLabel('This is a string', 0, 0, 300, 100, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont($_LB_TEXT, _MeasureString($hGUI, GUICtrlRead($_LB_TEXT), $_FONT_FAMILY), 0, 0, $_FONT_FAMILY, 5) GUISetState() Local $iGM While 1 $iGM = GUIGetMsg() Switch $iGM Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _GDIPlus_Shutdown() EndFunc Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) GUICtrlSetFont($_LB_TEXT, _MeasureString($hWnd, GUICtrlRead($_LB_TEXT), $_FONT_FAMILY), 0, 0, $_FONT_FAMILY, 5) EndFunc Func _MeasureString($hWnd, $sString, $sFont = 'Arial') Local $iError, $aSize, $hGraphic, $hFormat, $hFamily, $tLayout, $iFontSize, $hFont, $aInfo If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) EndIf $aSize = WinGetClientSize($hWnd) $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate($sFont) $tLayout = _GDIPlus_RectFCreate(0, 0, $aSize[0], $aSize[1]) $iFontSize = 0 Do If Not $hFamily Then $iError = 1 $iFontSize = 10 ExitLoop EndIf $iFontSize += 1 $hFont = _GDIPlus_FontCreate($hFamily, $iFontSize, 0) $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat) _GDIPlus_FontDispose($hFont) If $aInfo[1] = 0 Then ExitLoop Until DllStructGetData($aInfo[0], 3) >= $aSize[0] Or DllStructGetData($aInfo[0], 4) >= $aSize[1] $iFontSize -= 1 _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hGraphic) Return SetError($iError, 0, $iFontSize) EndFunc
    • Ascer
      By Ascer
      1. Description
      Anti-bot system to avoid spam. Vector graphic style generates 4 random numbers from 0-9 and create a picture. 2. Requirements
      .NET Framework 1.1 - 4.5 (on this version Microsoft destroy old rules) 3. Possibilities.

      4. Downloads.
      Source package Capatcha.rar
    • CYCho
      By CYCho
       
      #include <GUIConstants.au3>
      #include <WindowsConstants.au3>

      Local $oPlayer, $gVideo, $width, $height
      $oPlayer = ObjCreate("WMPlayer.OCX.7")
      $oPlayer.URL = 'http://www.clubbalcony.com/upload/culture/yong(2).wmv'
      Local $srcFound = True
      Local $time1 = TimerInit()
      While 1
          If $oPlayer.playState() = 3 Then
              $width = $oPlayer.currentMedia.imageSourceWidth
              $height = $oPlayer.currentMedia.imageSourceHeight
              ExitLoop
          EndIf
          If TimerDiff($time1) > 5000 Then
              $srcFound = False
              ExitLoop
          EndIf
          Sleep(50)
      WEnd
      If Not $srcFound Or $width = 0 Then
          $oPlayer.Close()
          Exit
      Else
          $gVideo = GUICreate("Video Control", $width, $height+63, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX), $WS_EX_TOPMOST)
          GUICtrlCreateObj($oPlayer, 0, 0, $width, $height+63)
          $oPlayer.uiMode = "Full"
          $oPlayer.stretchToFit = True
          GUISetState(@SW_SHOW, $gVideo)
      EndIf

      While 1
          $Msg = GUIGetMsg(1)
          Switch $Msg[0]
              Case $GUI_EVENT_CLOSE
                  ExitLoop
              Case $GUI_EVENT_RESIZED
                  ;This is where I want to resize the video image to fit the new window size
          EndSwitch
      WEnd
      $oPlayer.Close()
         
      How should I code the $GUI_EVENT_RESIZED portion to resize the video to fit the resized window? Your help will be greatly appreciated.

       
    • Jcreator
      By Jcreator
      i used this code to take names for a text file called data and put the info of the image and it location from the data file into the gui interface but it only detect the lines with the info and it do not show the images . here is the code 
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> #include <GuiComboBox.au3> #include <GuiTab.au3> #include <file.au3> #include <array.au3> _Main() Func _Main() Local $idTab1 $Form1 = GUICreate("Form1", 500, 334, 240, 182) $Group1 = GUICtrlCreateGroup("Group1", 20, 12, 249, 314) $idButton6 = GUICtrlCreateButton("Info", 50, 270, 185, 49) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) Global $fileMPA = "C:\T-in\MPA\data.txt" FileOpen($fileMPA, 0)    Global $line1 = FileReadLine($fileMPA , 1) $imp = 0 $idTab1 = GUICtrlCreateTab(300, -3, 180, 330) GUICtrlCreateTabItem("imglist1") GUICtrlSetTip(-1, '#Region TAB1') GUICtrlSetTip(-1, '#Region LIST') Local $imglist1 = GUICtrlCreateList("", 307, 26, 164, 304) $cline =_FileCountLines($fileMPA)  While  $imp < $cline $line2 = FileReadLine($fileMPA , $imp + 2)  $imp = $imp + 7 if $line2 = ""  then     ExitLoop    else  GUICtrlSetData(-1, ""& $line2 &"", "")  endif WEnd GUICtrlCreateTabItem("imagelist2") GUICtrlSetTip(-1, '#Region TAB2') GUICtrlCreateTabItem("imagelist3") GUICtrlSetTip(-1, '#Region TAB3') While 1     $Msg = GUIGetMsg()     Select         Case $Msg = $GUI_EVENT_CLOSE             Exit             Global $whatnow = GUICtrlRead($imglist1) Case $Msg = $idButton6             $imp2 = 0              While  $imp2 < 30 $line2 = FileReadLine($fileMPA ,$imp2 + 2) $line3 = FileReadLine($fileMPA , $imp2 + 3) $line7 = FileReadLine($fileMPA , 7)  $imp2 = $imp2 + 7 if $line2 = ""  then  ExitLoop             If GUICtrlRead($imglist1) = ""& $line2 &""  Then MsgBox($MB_SYSTEMMODAL, "img info" , $line3)                WEnd             EndSelect $imp2 = 0              While  $imp2 < 30 $line2 = FileReadLine($fileMPA ,$imp2 + 2) $line3 = FileReadLine($fileMPA , $imp2 + 3) $line7 = FileReadLine($fileMPA , 7)  $imp2 = $imp2 + 7     Select Case GUICtrlRead($imglist1) = ""& $line2 &"" if $line2 = "" then ExitLoop     $Pic1 = GUICtrlCreatePic(""& $line7 &"", 185, 28, 233, 230) If GUICtrlRead($imglist1) then  ExitLoop EndSelect WEnd     WEnd  EndFunc   ;==>_Main the data.txt file content is 
      Hibiscus Hibiscus is a hardy perennial which grows in variety of colors, sizes and fragrances. Actually they are tropical flowers which require ample sunlight and moisture to grow well. These flowers start blooming in late spring and continuously bloom through July and August. C:\T-in\IMG\2.jpg Lilies There are different types of lily flowers which bloom in August including water lilies, tiger lilies and gold band lilies. Tiger lilies generate orange flowers having black spots. This lily blooms in delayed July and beginning of August. Gold band lily produce exotic white blooms. All varieties of lilies need enough space to grow and protection from summer sun. C:\T-in\IMG\1.jpg Turtlehead Growing in humid areas, turtleheads are small flowers which bloom from July to September. They mostly produce flowers of white and pink color. C:\T-in\IMG\3.jpg Hydrangea These are ever green bushes which produce flowers in different colors including white, purple, blue and pink. They are easy to grow bushes and can grow 3 to 10 feet tall. They require morning sun to grow but they should be protected from noon and afternoon sun. C:\T-in\IMG\4.jpg Dahlias August proves to be the peak blooming season for dahlias. Dahlias come in colors like white, orange, yellow, red and purple. They can tolerate all types of soil and require full sun to grow.
×