Jump to content

GUI Repeating Background Image


Spardacus
 Share

Recommended Posts

Hi there-

Forgive me if this has been addressed before. I did some searching and couldn't find a topic on it.

I have created a GUI that allows the user to choose between a right taskbar or a top taskbar "controller" (popups that do not allow user resizing once open). These taskbars resize according to the useable desktop space.

To style the right taskbar a little, I've created a background image set.

As I currently have it, I created a general background image that is absurdly tall to compensate for any very high screen resolutions set at (0,0).  I then added a top image at (0,0) and a bottom image at (0, (_GetworkingAreaHeight( )-$image_height)) that effectively lay on top, completing the look.

And it works. But I can't help but think that as taskbars, I could use a smaller image that repeats itself to create the main backgrounds.

Has anyone created any GUI backgrounds with 1px images that repeat and point me in the right direction?

Thanks so much.

Link to comment
Share on other sites

I would look at GDI+ for this. :)

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

 

_GUICtrlListView_SetBkImage

 

This function is for listviews and was a mistake on my part to recommend, the GDI+ library is what I do recommend though. :)

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

I got the repeating to work with _GUICtrlListView_SetBkImage, so thanks for that!

Now oddly I cannot seem to use $GUI_DISABLE to stop it from interfering with the controls on the rest of the GUI. I would typically use something like this to set the background image and disable it.

    GUICtrlCreatePic('C:Documents and SettingsAdminDesktopRightTaskbarBk.jpg', 0, 0, 0, 0)
    GUICtrlSetState(-1, $GUI_DISABLE)
 
Any ideas?
Link to comment
Share on other sites

Ah, I see that now. I suppose then that I shouldn't be using the list view for this.. ?

 

That is why it probably interfering with the other controls. I do not have extensive knowledge on GDI, so I cannot help you there.

I'm sure someone will pop in with more knowledge on the subject than me. :D

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Well, I looked around in the Help file regarding GDI+ and saw some pretty neat functions. I'm still pretty new to this and have picked up a lot in the last month, but I fear I'm not far enough in yet to know where to start. Same goes for what you sent Valuater - thanks so much for the example, just as of right now I'm still trying to dissect what I'm looking at so I can understand it.  :wacko:

I made a workaround for the time being. All I did was create a Do statement that repeats GUICtrlCreatePic with the same image and places it 20px below each consecutive placement (in this case the image is 20px tall) until it reaches or exceeds the working area height. Then I just included the $GUI_Disable inside to disable each placement. Looks like there is also a GDI+ function that can pull the image dimensions automatically rather than set a defined height, but I didn't want to bastardize this any more than it already is.  <_<

 

  $BkImage = filename  
  $BkHeight = 0
  $BkWorkingHeight = _GetworkingAreaHeight( )
 
  Do
       GUICtrlCreatePic ($BkImage, 0, $BkHeight, 0, 0)
       GUICtrlSetState(-1, $GUI_DISABLE)
       $BkHeight = $BkHeight + 20
  Until ($BkHeight >= $BkWorkingHeight)
 
 
1. Is this a totally horrible way to accomplish this for now i.e. cause any negative effects I haven't noticed yet?
 
2. I am still open to learning a better way to repeat images to create backgrounds if I can handle the learning curve - whether it be GDI+ or another method. Sifting through the help file and these forums got me started from nothing and I appreciate the help!
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...