Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Add Picture Background To Form

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
mikesdeman
How do I cheat?
Reputation: 0

Joined: 26 Feb 2016
Posts: 1

PostPosted: Fri Feb 26, 2016 5:06 pm    Post subject: Add Picture Background To Form Reply with quote

Hi All.

I am having trouble adding a picture to a lua created form. I am using the following code to create the form:

Code:

MainGUI     = {}
MainGUI[1]  = createForm(false)

setProperty(MainGUI[1] , "color", red2)
setProperty(MainGUI[1] , "ShowInTaskBar", 'stAlways')
setProperty(MainGUI[1] , "Position", "poScreenCenter")
setProperty(MainGUI[1] , "BiDiMode", "bdLeftToRight")

control_setSize(MainGUI[1], 425, 512)

form_show(MainGUI[1])


Following this code I have the following ImageAttach:

Code:

function attachBackground(wc,tblFile)
  local p = createPicture()
  p.loadFromStream(findTableFile(tblFile).Stream)
  wc.OnPaint = function(sender)
    local c = sender.getCanvas()
    local bitmap = p.getBitmap()
    c.draw(0,0,bitmap)
  end
end
attachBackground(MainGUI[1] ,[[bg1.png]])


Where bg1.png is a PNG file, of the same size as the form, attached via Table>Add File on CE.

I cannot seem to load up the picture, when the form loads it is always set to the colour defined by red2 variable. I am missing something so simple I know it!

EDIT

OK I've figured out why that code does sort of doesn't work. It works in principal but the trainer maker I used adds a panel on the form to which all of the other elements are added with the following code:

Code:

MainGUI[2]  = createPanel(MainGUI[1])

x,y = control_getSize(MainGUI[1])
control_setSize(MainGUI[2], x,y)


Substituting MainGUI[2] sending it to the function attachBackground does not work.

Thanks for any input.

EDIT:

I found a workaround by simply removing the panel and dumping the elements directly onto the form however it would still be nice to know how to change a panel picture background.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites