Jump to content

Graphical area help pls


Recommended Posts

i,v been searching and i cant find an answer so i`ll ask.

how do i create a GUI that is my main window and then i want to set a part of it to be a graphical object (not the whole window)

ie im trying to do a graph with toolbar at the top and a listview down the side but i just cant figure out how to do it. if i could do something like

but i can`t use $graphic1=GUICtrlCreateGraphic (500,300) to set the graphical area because autoit crashes if i then try to use it with any _GDIPlus commands, iv tryied:-

$form1 = GUICreate("JackDinn`s Auto Speed Tester", 1008, 700, 0, 0)

$graphic1=GUICtrlCreateGraphic (500,300,300,300)

AND THEN

$brush = _GDIPlus_BrushCreateSolid(0xffffffff)

_GDIPlus_GraphicsFillRect($graphic1, 0, 0, 977, 565, $brush)

but it crashes

also tried to do this:

$Graphic2 = _GDIPlus_GraphicsCreateFromHWND($graphic1) ; even though it`s not a hWnd its a control

but still crash, so i dunno im stumped, i can do my graph on a whole GUI but not on a portion of one?

any suggestions would be great, thx all.

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Link to comment
Share on other sites

  • Moderators

JackDinn,

This looks pretty much like the image you posted. The GDI+ part is almost verbatim from that ever useful Help file: :-)

#Include <GDIPlus.au3>

$hGUI1 = GUICreate("JackDinn`s Auto Speed Tester", 1000, 700)
$hWnd = WinGetHandle($hGUI1)

GUICtrlCreateGroup("Buttons and things", 10, 10, 980, 130)
GUICtrlCreateListView("List View", 10, 150, 200, 540)

GUISetState()

 _GDIPlus_Startup ()

$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd)
$hBrush = _GDIPlus_BrushCreateSolid(0xFFFF0000)
_GDIPlus_GraphicsFillRect($hGraphic, 220, 150, 770, 540, $hBrush)

; Loop until user exits
Do
Until GUIGetMsg() = -3

; Clean up resources
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

I hope this gets you started.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

thx for the response, yea i had already started out using that method of just drawing in the area i wanted but thinking about it a bit more it was when i started to sort out the resizing of the main window that i started to have problems. i was having real trouble getting the smaller graphic area to shrink in sync with the main window. i know it should just be a case of percentages but i was having problems with the graph sliding up into the toolbar so i just used the whole window and made another GUI for the controls.

however i recently started thinking about it again and was kind hoping that there might be a way to make a graphical area out of a control like a edit control or something rather than having the whole window area as graphical which would force the graphics to stay within the control area.

i shall have a poke about and if i have a problem again with the scaling again i`ll ask.

Thx.

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

Link to comment
Share on other sites

You can create the GDI+-Graphics-Object from the GUICtrl :P

#include <GDIplus.au3>
#include <WindowsConstants.au3>

GUICreate("Test",500,500)
$CtrlGraph = GUICtrlCreateGraphic(100,100,300,300)
GUIRegisterMsg($WM_PAINT,"MY_PAINT")
GUISetState()
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND(GUICtrlGetHandle($CtrlGraph))

_GDIPlus_GraphicsClear($hGraphic,0xFFFF0000)

While GUIGetMsg()<>-3
    
WEnd

_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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