JackDinn Posted March 9, 2009 Share Posted March 9, 2009 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 More sharing options...
Moderators Melba23 Posted March 9, 2009 Moderators Share Posted March 9, 2009 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
JackDinn Posted March 9, 2009 Author Share Posted March 9, 2009 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 More sharing options...
ProgAndy Posted March 9, 2009 Share Posted March 9, 2009 (edited) You can create the GDI+-Graphics-Object from the GUICtrl #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 March 9, 2009 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 More sharing options...
JackDinn Posted March 9, 2009 Author Share Posted March 9, 2009 neat, that was what i was looking for , Cheers Thx that man. 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now