Sign in to follow this  
Followers 0
Burgs

Plotting up/down using GUICtrlCreateGraphic?

4 posts in this topic

$graph2[$x] = GUICtrlCreateGraphic($X_PLOT, $Y_PLOT, 10, $AMT, $SS_BLACKFRAME)

Greetings,

I think my question is fairly uncomplicated...using the above example code is there a way to change the "direction" of the plotted rectangle in the "height" parameter (the value for $AMT in my example)? In other words I would simply like to plot the graphic to be "up" or "down" from the X, Y position, using the $AMT as the desired plot size...is that possible? I thank you in advance. Regards.

Share this post


Link to post
Share on other sites



I'm not sure that I entirely understand your question, but I think you're asking how to place a Graphic control relative to some point (...call it X0,Y0).

As I understand it, the width and height of your graphic control are predefined, and you want to place that rectangle above or below a certain point.

If this is correct, then the code below might help. Else, please clarify your question... I didn't know that rectangles had a "direction."

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Up/Down", 400, 400)
$X0 = 200
$Y0 = 200
$WIDTH = 10
$HEIGHT = 100
$GraphicDOWN = GUICtrlCreateGraphic($X0, $Y0, $WIDTH, $HEIGHT, $SS_BLACKFRAME)
GUICtrlSetBkColor(-1,0x99ffff)
$GraphicUP = GUICtrlCreateGraphic($X0, $Y0-$HEIGHT, $WIDTH, $HEIGHT, $SS_BLACKFRAME)
GUICtrlSetBkColor(-1,0xffff99)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
EndSwitch
WEnd

Share this post


Link to post
Share on other sites

I think they mean that the image's top-left point is it's base point, and they want to place the image so that the base point is the bottom left. If that is the case, I dont think that this may be done, however, have you tried using a negative value? I doubt it will work, but it is worth a try.

Share this post


Link to post
Share on other sites

That's kinda what I understood. I think the answer is to place the top left point of the Graphic Control in the right spot to make the bottom left point end up where you want, which is what my code (in earlier post) illustrates.

If you want to change the coordinate system of the graphic to more of a "math" type coordinate system (+x to the right, and +y is up) then I think you'll need to do a little arithmetic on all of your "GUICtrlSetGraphic" function calls (or create a wrapper that modifies the arguments before passing them to the real GUICtrlSetGraphic function).

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