View previous topic :: View next topic |
Author |
Message |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Wed Sep 21, 2022 11:07 pm Post subject: Load Image From ImageList |
|
|
As Subject. How ?
Code: | Image1.Picture = ImageList1[index].Bitmap ?? |
in Lazarus :
Code: | ImageList1.GetBitmap(index of imageList, Image1.Bitmap) |
How in CE Lua?
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1516
|
Posted: Thu Sep 22, 2022 2:41 am Post subject: |
|
|
Or create bitmap local ..
I'm not at the PC, I haven't tried the codes. Just to give an idea.
Code: |
function crtPicture(link1)
ss22=createStringStream(link1)
p=createPicture()
p.loadFromStream(ss22)
ss22.destroy()
return p
end
picture1 = crtPicture("C\\mypic1.png")
picture2 = crtPicture("C\\mypic2.png")
local ImageList1 = {}
ImageList1[1] = picture1
ImageList1[2] = picture2
local rep = 1
btn1.OnClick=function()
if rep==1 then
FrmImg2.picture = ImageList1[1]
rep=2
else
FrmImg2.picture = ImageList1[2]
rep=1
end
end |
-- Edit --
1) Form control ..
2) All image.bitmap
3) Table[İndex] = image.bitmap
4) Picture = Table[İndex]
_________________
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25778 Location: The netherlands
|
Posted: Thu Sep 22, 2022 3:59 am Post subject: |
|
|
you mean image1.picture.bitmap I assume
anyhow, you can use draw
e.g:
Code: |
f=createForm()
f.ClientWidth=500
f.ClientHeight=500
f.BorderStyle=bsSizeable
image=createImage(f)
image.align=alClient
image.stretch=true
image.Picture.Bitmap.Width=MainForm.mfImageList.Width
image.Picture.Bitmap.Height=MainForm.mfImageList.Height
image.Picture.Bitmap.Canvas.clear()
MainForm.mfImageList.draw(image.Picture.Bitmap.Canvas,0,0,0)
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Thu Sep 22, 2022 5:40 am Post subject: |
|
|
Oops.. sorry for misunderstood matter. I mean load and show image on TImage from TImageList.
Code: | if f then f.Destroy() end
f = createForm()
f.setSize(220,230)
f.Position = 'poScreenCenter'
f.Caption = 'Image List'
img = createImage(f)
img.setSize(210,190)
img.Left = 5
img.Top = 5
img.Stretch = true
--img.Picture.loadFromFile("F:\\bmp img\\img1.bmp")
cb =createCheckBox(f)
cb.Caption = 'Running'
cb.Left = (f.Width - cb.Width) / 2
cb.Top = 200
cb.Checked = false
imlFrames = createImageList(f)
imlFrames.Width = img.Width
imlFrames.Hight = img.Height
imlFrames.DrawingStyle = 'dsNormal'
imlFrames.ImageType = 'itImage'
imlFrames.AllocBy = 11
-- adding bitmap images to imageList, contains 11 bitmap images
for i = 1, 11 do
local imgfile = 'img'..i..'.bmp'
local p=createPicture()
_G[imgfile]=p
p.loadFromFile("F:\\bmp img\\"..imgfile)
srcbmp = createBitmap()
srcbmp = p.getBitmap()
imlFrames.Add(srcbmp)
img.Picture = imgfile
p.Destroy()
srcbmp.Destroy()
end |
So, say I want load bitmap image with index no.2 from the TImageList and put the picture on TImage. How do that in CE Lua?.
in VB6, example :
Code: | img.Picture = imlFrames.ListImages(next_frame).Picture |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25778 Location: The netherlands
|
Posted: Thu Sep 22, 2022 7:15 am Post subject: |
|
|
Code: |
image.Picture.Bitmap.Width=imlFrames.Height
image.Picture.Bitmap.Height=imlFrames.Height
image.Picture.Bitmap.Canvas.clear()
imlFrames.draw(image.Picture.Bitmap.Canvas,0,0,2)
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Thu Sep 22, 2022 8:37 am Post subject: |
|
|
Done, perfect. Thanks DB
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
 |
|