Jump to content

Pic position in form


Recommended Posts

how to make a algorithm to show my pictures framed Form, one under another 5 per on line?

Thank you!

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <TabConstants.au3>
#include <GDIPlus.au3>
#Include <Memory.au3>
#include <File.au3>
#include <Array.au3>
#include "GUICtrlPic.au3"
#NoTrayIcon
$Form1 = GUICreate("", 1006, 695, -1, -1, -1, BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
$Tab1 = GUICtrlCreateTab(3, 3, 1001, 689)

$all_dir = _FileListToArray(@ScriptDir, "*", 2)
   If IsArray($all_dir) Then
    For $i = 1 To $all_dir[0]
     Global $TabSheet1 = GUICtrlCreateTabItem($all_dir[$i])
      $all_dir2 = _FileListToArray(@ScriptDir&"\"&$all_dir[$i], "*", 2)
      If IsArray($all_dir2) Then
       For $ii = 1 To $all_dir2[0]
        $Button1 = GUICtrlCreateButton($all_dir2[$ii], 24, 30*$ii+7, 171, 22, $WS_BORDER)
        GUICtrlSetCursor (-1, 0)
        _GUICtrlPic_Create(@ScriptDir&"\"&$all_dir[$i]&"\"&$all_dir2[$ii]&"\"&"template_thumbnail.png" , 200, 60*$ii-30, 176, 113, BitOR($SS_CENTERIMAGE,$SS_SUNKEN, $SS_NOTIFY), Default)
        GUICtrlSetTip(-1, $all_dir2[$ii])
       Next
      EndIf
    Next
   EndIf
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
EndSwitch
WEnd

GUICtrlPic.au3

Link to comment
Share on other sites

yes ... it makes sense as you say, only in the context of my script does not work

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <TabConstants.au3>
#include <GDIPlus.au3>
#Include <Memory.au3>
#include <File.au3>
#include <Array.au3>
#include "GUICtrlPic.au3"
#NoTrayIcon
$Form1 = GUICreate("", 1006, 695, -1, -1, -1, BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
$Tab1 = GUICtrlCreateTab(3, 3, 1001, 689)
$all_dir = _FileListToArray(@ScriptDir, "*", 2)
   If IsArray($all_dir) Then
    For $i = 1 To $all_dir[0]
     Global $TabSheet1 = GUICtrlCreateTabItem($all_dir[$i])
      $all_dir2 = _FileListToArray(@ScriptDir&"\"&$all_dir[$i], "*", 2)
      If IsArray($all_dir2) Then
       For $ii = 1 To $all_dir2[0]
        $Button1 = GUICtrlCreateButton($all_dir2[$ii], 24, 30*$ii+7, 171, 22, $WS_BORDER)
        GUICtrlSetCursor (-1, 0)
   For $iRow = 1 To 4
   For $iColumn = 1 To 5
    _GUICtrlPic_Create(@ScriptDir&"\"&$all_dir[$i]&"\"&$all_dir2[$ii]&"\"&"template_thumbnail.jpg" , $iColumn*200, $iRow*120, 176, 113)
   Next
   Next
       Next
      EndIf
    Next
   EndIf
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
EndSwitch
WEnd

appear exactly images ...

not use $all_dir2[$ii] :(

post-75717-0-35054600-1350558224_thumb.j

Link to comment
Share on other sites

Maybe this : (not tested)

...
Local $iRow = 1, $iColumn = 1

If IsArray($all_dir2) Then
For $ii = 1 To $all_dir2[0]
$Button1 = GUICtrlCreateButton($all_dir2[$ii], 24, 30 * $ii + 7, 171, 22, $WS_BORDER)
GUICtrlSetCursor(-1, 0)
_GUICtrlPic_Create(@ScriptDir & "" & $all_dir[$i] & "" & $all_dir2[$ii] & "" & "template_thumbnail.jpg", $iColumn * 200, $iRow * 120, 176, 113)

$iColumn += 1

If Not Mod($ii, 4) Then ;or $iColumn = 5
$iRow += 1
$iColumn = 1
EndIf
Next
EndIf
...

Edit : Added Not operator.

Br, FireFox.

Edited by FireFox
Link to comment
Share on other sites

If I linked the UDF it's because I meant this :

#include "onEventFunc.au3"
...
Local $aPic[UBound($all_dir2)]

$aPic[$ii] = _GUICtrlPic_Create(@ScriptDir & "" & $all_dir[$i] & "" & $all_dir2[$ii] & "" & "template_thumbnail.jpg", $iColumn * 200, $iRow * 120, 176, 113)
SetOnEventA($aPic[$ii], "_picevent", $paramByVal, $ii)
...

Func _picevent($iPicture)
ConsoleWrite($iPicture & @CrLf)
EndFunc

I have set as parameter the picture index, you can set what you want and more parameters.

Br, FireFox.

Edited by FireFox
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...