Delphi XE TabControl使用

一、界面

tabcontrol1 GestureManager1 各tab页添加一些控件

技术分享技术分享

二、属性设置

tabcontrol1: GestureManage选GestureManager1, Gestures.Standard设置手势,这里只用了左滑和右滑,

技术分享

三、代码:

函数:设置活动页面及过度效果,看帮助吧,呵呵!

tabControl1.SetActiveTabWithTransition(TabItem2,TTabTransition.None,TTabTransitionDirection.Normal)

 

procedure TForm3.TabControl1Gesture(Sender: TObject;
  const EventInfo: TGestureEventInfo; var Handled: Boolean);
begin
   case EventInfo.GestureID of
      sgiRight:
      begin
        if TabControl1.ActiveTab=TabItem1 then
           TabControl1.SetActiveTabWithTransition(TabItem2,TTabTransition.None,TTabTransitionDirection.Normal)
        else if TabControl1.ActiveTab=TabItem2 then
           TabControl1.SetActiveTabWithTransition(TabItem3,TTabTransition.None,TTabTransitionDirection.Normal)
        else if TabControl1.ActiveTab=TabItem3 then
           TabControl1.SetActiveTabWithTransition(TabItem4,TTabTransition.None,TTabTransitionDirection.Normal);
        Handled:=true;
      end;

      sgiLeft:
      begin
        if TabControl1.ActiveTab=TabItem2 then
           TabControl1.SetActiveTabWithTransition(TabItem1,TTabTransition.None,TTabTransitionDirection.Normal)
        else if TabControl1.ActiveTab=TabItem3 then
           TabControl1.SetActiveTabWithTransition(TabItem2,TTabTransition.None,TTabTransitionDirection.Normal)
        else if TabControl1.ActiveTab=TabItem4 then
           TabControl1.SetActiveTabWithTransition(TabItem3,TTabTransition.None,TTabTransitionDirection.Normal);
        Handled:=true;
      end;

   end;
end;

刚开始接触Delphi,学习书籍较少且讲解不细致,网上看了很多资料才有点心得,希与同道们相互学习。

QQ:498822722

文章来自:http://www.cnblogs.com/mqx365/p/4603922.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3