delphi xe10 FMX设计一个选项卡 ___delphi___
delphi xe10 FMX设计一个选项卡 代码
unit TabbedTemplate;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.TabControl,
FMX.StdCtrls, FMX.Gestures, FMX.Controls.Presentation, FMX.Objects, FMX.Ani;
type
TTabbedForm = class(TForm)
HeaderToolBar: TToolBar;
ToolBarLabel: TLabel;
TabControl1: TTabControl;
TabItem1: TTabItem;
TabItem2: TTabItem;
TabItem3: TTabItem;
GestureManager1: TGestureManager;
Label2: TLabel;
Label3: TLabel;
Rectangle1: TRectangle;
TabPanel: TPanel;
Line1: TLine;
RoundRect1: TRoundRect;
RoundRect2: TRoundRect;
Label5: TLabel;
Label6: TLabel;
RoundRect3: TRoundRect;
Label7: TLabel;
Rectangle2: TRectangle;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure FormGesture(Sender: TObject; const EventInfo: TGestureEventInfo;
var Handled: Boolean);
procedure TabControl1Gesture(Sender: TObject;
const EventInfo: TGestureEventInfo; var Handled: Boolean);
procedure TabHeadrOnClick(Sender: TObject);
private
{ Private declarations }
CurTabIndex:integer;
public
{ Public declarations }
end;
var
TabbedForm: TTabbedForm;
implementation
{$R *.fmx}
procedure TTabbedForm.TabHeadrOnClick(Sender: TObject);
var
ClickTag:integer;
i:integer;
begin
if (Sender is TLabel) then
begin
ClickTag:=Tlabel(sender).Tag
end
else
if (Sender is TRoundRect) then
begin
ClickTag:=TRoundRect(Sender).Tag;
end;
if ClickTag<>CurTabIndex then
begin
do
begin
if (self.Components[i] is TRoundRect) then
begin
TRoundRect(self.Components[i]).Fill.Kind:=TBrushKind.Gradient;
TRoundRect(self.Components[i]).Fill.Gradient.Color:= TAlphaColor($FFE2E4E4);
TRoundRect(self.Components[i]).Fill.Gradient.Color1:=TAlphaColor($FFFFFFFF);
TRoundRect(self.Components[i]).Fill.Gradient.Style:=TGradientStyle.Linear;
TRoundRect(self.Components[i]).Stroke.Kind:=TBrushKind.None;
end;
end;
TabControl1.ActiveTab:=TabControl1.Tabs[ClickTag-];;
CurTabIndex:=ClickTag;
TRoundRect(sender).Fill.Kind:=TBrushKind.Solid;
TRoundRect(Sender).Fill.Color:= TAlphaColorRec.Lightskyblue;
TRoundRect(Sender).Stroke.Kind:=TBrushKind.Solid;
TRoundRect(sender).stroke.Color:=TAlphaColorRec.Lightblue;
end;
end;
procedure TTabbedForm.FormCreate(Sender: TObject);
begin
{ This defines the default active tab at runtime }
TabControl1.ActiveTab := TabItem1;
CurTabIndex:=;
end;
procedure TTabbedForm.FormGesture(Sender: TObject;
const EventInfo: TGestureEventInfo; var Handled: Boolean);
begin
{$IFDEF ANDROID}
case EventInfo.GestureID of
sgiLeft:
begin
] then
begin
TabControl1.ActiveTab := TabControl1.Tabs[TabControl1.TabIndex+];
Handled := True;
end;
end;
sgiRight:
begin
] then
begin
TabControl1.ActiveTab := TabControl1.Tabs[TabControl1.TabIndex-];
Handled := True;
end;
end;
end;
{$ENDIF}
end;
procedure TTabbedForm.TabControl1Gesture(Sender: TObject;
const EventInfo: TGestureEventInfo; var Handled: Boolean);
begin
case EventInfo.GestureID of
sgiRight:
begin
TabControl1.Previous();
Handled:=True;
end;
sgiLeft:
begin
TabControl1.Next();
Handled:=True;
end;
end;
end;
end.
查看评论 回复
"delphi xe10 FMX设计一个选项卡 ___delphi___"的相关文章
热门文章
- 空格后面的作为标题 ___delphi___
- 要处理的文件总行数 ___delphi___
- function TrimString(str:string):string; ___delphi_
- 把要处理的文件装入到memo1_test中,启动处理定时器ti
- 读入的内容写到Memo1_Test显示出来,测试用 ___delphi_
- textarea不能使用以下方式 ___delphi___
- 随机发布文章到栏目类别 ___delphi___
- 用pos函数来判断,在下面这一行怎么会出错呢? ___del
- delphi什么函数能判断一个字符串包含在另一字符串 ___
- delphi怎样判断字符串包含指定字符 ___delphi___