monoceres Posted July 5, 2008 Share Posted July 5, 2008 (edited) Hi!Stumpled across a quite interesting function on msdn today and decided to make a little UDF of it muttley It fills a gradient triangle or a rect on a device context.Here's the msdn link: msdnThis is how it looks:Pretty sweet eh?Here's the UDF and the above example:http://monoceres.se/Uploads/_FillGradientTriangleRect.au3http://monoceres.se/Uploads/Example.au3I found some parts of the function quite confusing so the function is not anywhere near perfect, but hey! It works Happy Coding! Edited July 5, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Andreik Posted July 5, 2008 Share Posted July 5, 2008 @monoceres Fantastic script. Just tested and work fine. Nice work. muttley When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Valuater Posted July 5, 2008 Share Posted July 5, 2008 Nice one monoceres! ... just the gui doesn't re-paint when taken off-screen or a gui is place on top of it 8) Link to comment Share on other sites More sharing options...
martin Posted July 5, 2008 Share Posted July 5, 2008 It's great monoceres.It needs some way to set the number of vertices in the dll call. If you change your example to have_FillGradientTriangleRect($dc,$array,$GRADIENT_FILL_RECT_V)then it draws 2 rectangles. 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. Link to comment Share on other sites More sharing options...
monoceres Posted July 5, 2008 Author Share Posted July 5, 2008 (edited) Thanks everyone for your comments, really appreciate it Maybe you should rename it to something like: _GUIPlus_FillGradTriangle() And see if it can be added to: _GUIPlus.au3 Good job! It's GDIPlus And yeah, maybe if I make this more structured I try to get it included. Nice one monoceres! ... just the gui doesn't re-paint when taken off-screen or a gui is place on top of it 8) Of course not, I didn't handle the WM_PAINT message Easy enough to add: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ;.... GUIRegisterMsg($WM_PAINT,"_ReDraw") ;.... Func _ReDraw() _GDIPlus_GraphicsClear($graphics, 0xFF000000) _FillGradientTriangleRect($dc, $array, $GRADIENT_FILL_TRIANGLE) Return $GUI_RUNDEFMSG EndFunc It's great monoceres. It needs some way to set the number of vertices in the dll call. If you change your example to have _FillGradientTriangleRect($dc,$array,$GRADIENT_FILL_RECT_V) then it draws 2 rectangles. I think it's because I was lazy and always passed a GRADIENT_TRIANGLE structure to the dll. muttley Fixing it later Edited July 5, 2008 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
martin Posted July 5, 2008 Share Posted July 5, 2008 (edited) Of course not, I didn't handle the WM_PAINT message muttley Easy enough to add: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ;.... GUIRegisterMsg($WM_PAINT,"_ReDraw") ;.... Func _ReDraw() _GDIPlus_GraphicsClear($graphics, 0xFF000000) _FillGradientTriangleRect($dc, $array, $GRADIENT_FILL_TRIANGLE) Return $GUI_RUNDEFMSG EndFuncWell that will draw a triangle which is not so good if you want to redraw a rectangle, and if you've changed to array to get ready for a later draw then it would be even worse. Maybe there should be something in the function _FillGradientTriangleRect to set some global varaibles with the parameters, and have the redraw function use those. Func _ReDraw() _GDIPlus_GraphicsClear($graphics, 0xFF000000) _FillGradientTriangleRect($lastdc, $lastarray, $LAST_GRADIENT_TYPE) Return $GUI_RUNDEFMSG EndFunc Edited July 5, 2008 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. Link to comment Share on other sites More sharing options...
monoceres Posted July 5, 2008 Author Share Posted July 5, 2008 Well that will draw a triangle which is not so good if you want to redraw a rectangle, and if you've changed to array to get ready for a later draw then it would be even worse. Maybe there should be something in the function _FillGradientTriangleRect to set some global varaibles with the parameters, and have the redraw function use those. Func _ReDraw() _GDIPlus_GraphicsClear($graphics, 0xFF000000) _FillGradientTriangleRect($lastdc, $lastarray, $LAST_GRADIENT_TYPE) Return $GUI_RUNDEFMSG EndFunc You're right, but I will not implement any redrawing into the UDF, because I think it's up to the user to redraw the contents of his device. I for one would not want a UDF to draw anything into my device when I don't call the function directly. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
martin Posted July 5, 2008 Share Posted July 5, 2008 You're right, but I will not implement any redrawing into the UDF, because I think it's up to the user to redraw the contents of his device.I for one would not want a UDF to draw anything into my device when I don't call the function directly.Yes, I agree with you. 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. Link to comment Share on other sites More sharing options...
monoceres Posted July 5, 2008 Author Share Posted July 5, 2008 Updated! The script now uses the correct struct when drawing a Rect muttley Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Ibrahim Posted July 5, 2008 Share Posted July 5, 2008 Nice Looking maybe will do fine if used in a progressBar. [font="Arial Black"]My Stuff[/font]UPnP Port Forwarding Final.GateWay InformationThe GateWay Watcher(detect speeofing)Rightclick Any file --->Hide/UnhideThe Tip WatcherA PanelShare WatcherThe Arp WatcherThe Online License Checker Link to comment Share on other sites More sharing options...
martin Posted July 5, 2008 Share Posted July 5, 2008 Updated!The script now uses the correct struct when drawing a Rect muttleyThanks.There's a typo/error. GUI appears on about line 7. 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. Link to comment Share on other sites More sharing options...
monoceres Posted July 5, 2008 Author Share Posted July 5, 2008 Thanks.There's a typo/error. GUI appears on about line 7.Argh, fixed. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
cekot Posted November 1, 2008 Share Posted November 1, 2008 Fantastic script. Just tested and work fine. Nice work. Link to comment Share on other sites More sharing options...
TehWhale Posted November 1, 2008 Share Posted November 1, 2008 Monoceres is an MVP! Woot! Nice script too. Link to comment Share on other sites More sharing options...
DexterMorgan Posted November 1, 2008 Share Posted November 1, 2008 SHOW OFF!!!! lol, jk Good job code 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