Jump to content

Send Pic control to background


JFee
 Share

Recommended Posts

Right now I have a bunch of labels that can be dragged around on top of an image (pic control).

The problem is that the labels are created first, then the user opens a bmp for the image, and the image is created, but on top of the labels. I have tried all sorts of styles but I cannot figure out how to get the labels to be on top. $WS_EX_TOPMOST and $GUI_ONTOP didn't work.

Any suggestions?

Regards,Josh

Link to comment
Share on other sites

Right now I have a bunch of labels that can be dragged around on top of an image (pic control).

The problem is that the labels are created first, then the user opens a bmp for the image, and the image is created, but on top of the labels. I have tried all sorts of styles but I cannot figure out how to get the labels to be on top. $WS_EX_TOPMOST and $GUI_ONTOP didn't work.

Any suggestions?

(Probably) the style of the picture control needs to be set to disabled after its created:

$MyBmpPicture = GUICtrlCreatePic("myBmp.bmp", 10, 10)
GUICtrlSetState($MybmpPicture, $GUI_DISABLE)
Link to comment
Share on other sites

I am doing that.

Right now it doesn't even matter what order the controls are created in, the image is always on top

Show us some code that reproduces the problem then 'cause I ain't polishin' my crystal ball for this one...
Link to comment
Share on other sites

Alright... Here is relevant code:

#Region - Includes and Defaults
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#Include <WinAPI.au3>
#include <WindowsConstants.au3>
#EndRegion

Opt("GUICoordMode", 1)
Dim $tScorebox[25]
Dim $lblScoreboard[25]
Dim $tPosX[25]
Dim $tPosY[25]
$move = 0
$noDrag = 0
$mainHeight = 325
$mainWidth = 800
; Parameters
$size = 25
$font = "Ariel"
$color = 0xffffff
$bgColor = 0x000000
$baseImagePath = "scoreboardMaster.bmp"

#Region - GUI Setup

$winMain = GUICreate("Main", $mainWidth, $mainHeight)
$mainHandle = WinGetHandle("Main")

$btnGetImage = GUICtrlCreateButton("Open Image", 10, 10, 80)
GUICtrlCreateLabel("Font Size:", 10, 40, -1, 15)
$inpFontSize = GUICtrlCreateInput("25", 60, 40, 30, 17)
GUICtrlCreateLabel("Color:", 10, 65, -1, 15)
$inpColor = GUICtrlCreateInput("FFFFFF", 60, 65, 45, 17)
GUICtrlCreateLabel("Font:", 10, 90, -1, 15)
$comboFont = GUICtrlCreateCombo("Ariel",60, 85, 120, 17)
GUICtrlSetData($comboFont, "Times New Roman|Trebuchet MS", "Ariel")
$btnUpdate = GUICtrlCreateButton("Update", 10, 115, 80, 40)
$btnSave = GUICtrlCreateButton("Save", 10, 165)
$btnLoad = GUICtrlCreateButton("Load", 50, 165)


$winSecondary= GUICreate("Image", 800, 200, 0, $mainHeight - 125, $WS_CHILD, -1, $mainHandle)
$bgPic = GUICtrlCreatePic($baseImagePath,0,0,0,0)
GUICtrlSetState($bgPic, $GUI_DISABLE)
GUISetState(@SW_SHOW, $winSecondary)

For $i = 1 to 12
    $tScoreBox[$i] = GUICtrlCreateLabel("A" & $i, 10 * $i + $size * ($i - 1), 0, $size, $size, $SS_CENTER)
    GUICtrlSetFont($tScorebox[$i], $size * 2 / 3, 8000, 0, $font)
    GUICtrlSetColor($tScorebox[$i], $color)
;GUICtrlSetBkColor($tScorebox[$i], $bgColor)
    GUICtrlSetCursor($tScorebox[$i], 0)
    GUICtrlSetState($tScoreBox[$i], $GUI_ONTOP)
    $tPosX[$i] = 10 * $i + $size * ($i - 1)
    $tPosY[$i] = 0
Next

for $i = 13 to 24
    $tScoreBox[$i] = GUICtrlCreateLabel("H" & ($i - 12), 10 * ($i - 12) + $size * ($i - 13), 10 + $size, $size, $size, $SS_CENTER)
    $tPosX[$i] = 10 * ($i-12) + $size * ($i - 13)
    $tPosY[$i] = 10 + $size
    GUICtrlSetFont($tScorebox[$i], $size *2 / 3, 8000, 0, $font)
    GUICtrlSetColor($tScorebox[$i], $color)
;GUICtrlSetBkColor($tScorebox[$i], $bgColor)
    GUICtrlSetCursor($tScorebox[$i], 0)
    GUICtrlSetState($tScoreBox[$i], $GUI_ONTOP)
Next

GUISetState(@SW_SHOW, $winMain)
Sleep(5000)

The labels should be on top of the image.... just throw any image in there and you will see what I mean.

Regards,Josh

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...