* * *

Author Topic: TComponent.Create  (Read 310 times)

osman.schltz

  • New member
  • *
  • Posts: 35
TComponent.Create
« on: October 07, 2017, 07:51:02 pm »
Hi Folks! I want to make an desktop-like application. I want to do this:
I have an "Add" button
Everytime i click on "Add" button new Image should created.
These images will be sorted consecutively and when there is no room in the first column, next image should add to new column. How can I do this? Thanks in advance  :)

jamie

  • Jr. Member
  • **
  • Posts: 99
Re: TComponent.Create
« Reply #1 on: October 07, 2017, 08:27:01 pm »
My favorite type of component for this would be a TDrawGrid.

 The DrawGrid has paint events that allow you to draw your images.. It has
columns and rows which you can maintain the count of.

 A TImageList is  a good start of storing Images in a indexed form. The issue with
Timagelist is that all images must be the same size.
 
 Using the Image list can be done for iconic displays, what you can do is load each
image using your "ADD" button into a Tbitmap, from there  you can resize it to the size
that is being used for the TimageList. This can be done using one of the canvas copy
functions to adjust the size for the destination.
 
 Experiment with the DrawGrid and Image list a little, check back to see what you think and
maybe some code can be supplied here..



osman.schltz

  • New member
  • *
  • Posts: 35
Re: TComponent.Create
« Reply #2 on: October 07, 2017, 09:41:03 pm »
My favorite type of component for this would be a TDrawGrid.

 The DrawGrid has paint events that allow you to draw your images.. It has
columns and rows which you can maintain the count of.

 A TImageList is  a good start of storing Images in a indexed form. The issue with
Timagelist is that all images must be the same size.
 
 Using the Image list can be done for iconic displays, what you can do is load each
image using your "ADD" button into a Tbitmap, from there  you can resize it to the size
that is being used for the TimageList. This can be done using one of the canvas copy
functions to adjust the size for the destination.
 
 Experiment with the DrawGrid and Image list a little, check back to see what you think and
maybe some code can be supplied here..
Thank you, here is my one desktop icon. Is it can be done with TImageList?

jamie

  • Jr. Member
  • **
  • Posts: 99
Re: TComponent.Create
« Reply #3 on: October 08, 2017, 01:40:27 am »
As I said, all images in the TimageList must be of the same size..

I am not sure how large of images you are using?

jamie

  • Jr. Member
  • **
  • Posts: 99
Re: TComponent.Create
« Reply #4 on: October 08, 2017, 02:36:36 am »
a 640x480 should be ok in the TimageList, but all images will have to be that size there
after and watch for memory use.
 
 you could make yourself a virtual TimageList, read them from file instead.

 TStringList could hold the file paths so all these images and you simply load then as
needed for display.  You can use the TDrawGrid and have iconic views of them.



 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus