We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


Urgent: Page Turning Code!

divnet asked
Medium Priority
Last Modified: 2010-05-18
I need source code to do a "page turning" like "flip album" does.
Watch Question

If You could explain more presice.
What is "page" here and what do You mean by page turning.
OK, im not exactly sure what you mean, by flip album.

However, if you want to add page control to your app, you can do the following:

 Drop a Tpanel on your form, set its

 align= alBottom.
 caption = ''   (NONE)
 name = pnlButtons

 Place two buttons on the right size of the panel.

 Set the first ones Caption = 'Next' and the second one's caption = 'Prev'

 Name them btnNext, & btnPrev respectively

 Now drop a TPageControl on the form and set its

  align = alClient
  name = pgeMain

Right click on it and create as many pages as you need.
Then, set each of the tabsheets "Tab Visible" property = False

 add a TActionList component to the form

 double click it, and create two new actions

 name the first 'actNext' and the second 'actPrev'

Set the caption's = 'Next' and 'Prev' respectively

 set the actNext's OnUpdate event to the following code

procedure TfrmMain.actNextUpdate(Sender: TObject);
 actNext.Enabled:= pgeMain.ActivePageIndex <> pgeMain.PageCount - 1;

 set the actPrev OnUpdate event to the following code

procedure TfrmMain.actPrevUpdate(Sender: TObject);
 actPrev.Enabled:= pgeMain.ActivePageIndex <> 0;

Now go back to the two buttons and set their action property in the obbject inspector = to the matching action

 btnNext :

action = actNext

btnPrev :

 action = actPrev


Hi Shane
And I imagine that he wants some kind of animation, graphic rotation or something like that. Sometimes its really difficult to guess asker intnsions, isn't it.
Sorry, i forgot the actual page turning.

You will need to set the OnExecute event of each of the two actions

actNext & actPrev

procedure TfrmMain.actNextExecute(Sender: TObject);
 pgeMain.ActivePageIndex:=  pgeMain.ActivePageIndex + 1;

procedure TfrmMain.actPrevExecute(Sender: TObject);
 pgeMain.ActivePageIndex:=  pgeMain.ActivePageIndex - 1;
Yes, it is!

However, if he want's that look as well, he can load a background image that looks like a sheet of notebook paper


It all really depends on what type of effect he is looking for, so i guess i will leave it at this - until he explains more




it is an animation effect that appears like the page is turning (like a book page). example is like www.flipalbum.com
Unlock this solution and get a sample of our free trial.
(No credit card required)


Mokule you have the points. I will give you more if you could show me how to curve the image, more like a book page being turned over.
ok, but my solution would habe been much less coding involved.

4 - 6 lines of code, and i bet i could have implemeted the solution

Never mind, i miss understood, i just tested mokules code, i see what type of effect you wanted.
Sorry, I misunderstood the question.



The principle on which was based my program was as follows.
The source image rectangle was transfered into destination image parallelogram.

Src image                Dest image
                                    /  |
                                  /    |
A----------B                D     |
|             |                |      |
|             |                |      |
|             |                |    /
|             |                |  /
|             |                |/
C-----------                F

PlgBlt ( PaintBox1.Canvas.Handle,          // Dest image
              tp,                                        // array of points D, E, F
              Image2.Canvas.Handle,          // Src image
              0,                                         // x coordinate of point A
              0,                                         // y coordinate of point A
              FOTWIDTH,                           // width of src rectangle
              FOTHEIGHT,                          // height of src rectangle
              hb, 0, 0);

  If You "divide" Src image into a couple of vertical rectangles and each will be transferred independently it will be possible to more or less simulate curve. This is theory. You must apologize me but because of my "real" duties I can't try to code it yet. If You'll have some patiance may be I'll try to code it in the near future. In kind of good results I'll let You know.
  Besides for achieving curve effect probably better way is use OpenGL or DirectX but I've got too little practice in that area (And lack of time at the moment).


Should be of course: I must apologize You.
 It's my poor English.

Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.