Sign in to follow this  
Followers 0
simpleinventor

Display part of a picture?

7 posts in this topic

I have a toolbar bitmap that I would like to display only part of the bitmap. I know I could technically cover the undesired parts with other objects, but the bitmap moves and would get ugly to work with. Does anyone know of how to get this done? Thanks, Simple Inventor.

Share this post


Link to post
Share on other sites



You could try using a bitmap that only has that one section in it.

You would otherwise have to use drawing functions which can be complicated.

Share this post


Link to post
Share on other sites

HI,

maybe this helps, too?!

http://www.autoitscript.com/forum/index.ph...amp;hl=cropping

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

th.meger, that link kinda of worked, but I'm having trouble understanding it. What I figure is that each image is on it's own gui, but is a child of the main. Anyone know how to do that? I can easily do that in java, don't know too much about autoit.

Share this post


Link to post
Share on other sites

So I got it to sort-of work. I have a cropped image and I want it to move with the main GUI. The thing is, with the code I have now, if I drag the GUI around, the cropped image only moves when I let go of the mouse (it's pretty obvious to see why.) Is there a way so the pic moves with the GUI no matter what.

Here's the code:

#include "GUIConstants.au3"
#include <Math.au3>

$gui=GUICreate("test", 500, 500, 300, 300)

$guiPOS = WinGetPos($gui,"")

$pic=GUICreate("", 24, 24, $guiPOS[0]+5, $guiPOS[1]+30,$WS_POPUP,$WS_EX_LAYERED,$gui)
GUICtrlCreatePic(@ProgramFilesDir & "\K-Meleon\skins\Phoenity(Large)\zoomcold.bmp",0,0, 0,0)

GUISetState(@SW_SHOW,$pic)
GUISetState(@SW_SHOW,$gui)

Do
    Sleep(10)
    
    $guiPOS = WinGetPos($gui,"")
    
    WinMove($pic,"", $guiPOS[0] + 5, $guiPOS[1] + 30)
    
until GUIGetMsg() = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Have a look at example 2 for GUICtrlCreatePic in the help file. The transparent window moves with the parent window when it's dragged.

Instead of

$pic=GUICreate("", 24, 24, $guiPOS[0]+5, $guiPOS[1]+30,$WS_POPUP,$WS_EX_LAYERED,$gui)

you need

$pic=GUICreate("", 24, 24, $guiPOS[0]+5, $guiPOS[1]+30,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)

(Hope this is what you mean you want.)

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

That went over my head. Can you explain why? Thanks!

Have a look at example 2 for GUICtrlCreatePic in the help file. The transparent window moves with the parent window when it's dragged.

Instead of

$pic=GUICreate("", 24, 24, $guiPOS[0]+5, $guiPOS[1]+30,$WS_POPUP,$WS_EX_LAYERED,$gui)

you need

$pic=GUICreate("", 24, 24, $guiPOS[0]+5, $guiPOS[1]+30,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)

(Hope this is what you mean you want.)

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  
Followers 0