티스토리 뷰

Programming/Delphi - FireMonkey

FireMonkey - style

파란크리스마스 2013. 11. 16. 22:00
728x90

출처 : Firemonkey Styles - Felix John COLIBRI.
Working with Native and Custom FireMonkey Styles
Step 3 - Add Style-Resources as RCDATA (Delphi)
동영상 - FireMonkey - Style lookup& costom listbox item

style

  object TLayout
    StyleName = 'Layout1'
    DesignVisible = False
    Height = 32.000000000000000000
    Position.X = 499.000000000000000000
    Position.Y = 196.000000000000000000
    Width = 155.000000000000000000
    object TButton
      StyleName = 'Button1'
      Align = alRight
      Height = 32.000000000000000000
      Position.X = 75.000000000000000000
      TabOrder = 1
      Width = 80.000000000000000000
    end
    object TActiveStyleTextObject
      StyleName = 'text'
      Align = alClient
      Color = claBlack
      Height = 17.000000000000000000
      HorzTextAlign = taLeading
      Margins.Left = 3.000000000000000000
      Margins.Top = 1.000000000000000000
      Margins.Right = 3.000000000000000000
      Margins.Bottom = 1.000000000000000000
      Width = 190.000000000000000000
      WordWrap = False
      Shadow.Color = claNull
      ShadowVisible = False
      ActiveTrigger = stSelected
      ActiveColor = claBlack
      ActiveShadow.Color = claNull
    end
  end

예제

procedure TForm1.FormCreate(Sender: TObject);
var
  _Item : TListBoxItem;
begin
  Self.OnGetMoveControl := GetMoveControl;

  _Item := TListBoxItem.Create(nil);
  _Item.Parent := ListBox1;
  _Item.StyleLookup := 'layout1';
  _Item.Text := 'a';
  (_Item.FindStyleResource('button1') as TButton).Text := 'test';
  (_Item.FindStyleResource('button1') as TButton).OnClick := ItemButtonClick;
end;

procedure TForm1.ItemButtonClick(Sender: TObject);
var
  VP: TPointF;
begin
  VP := (Sender as TButton).LocalToAbsolute((Sender as TButton).Position.Point);
  VP := (Sender as TButton).Scene.LocalToScreen(VP);
  {
  VP := (Sender as TButton).Position.Point;
  VP := (Sender as TButton).Scene.LocalToScreen(VP);
  }
  PopupMenu1.Popup(50, 50); // 모바일에서는 동작하지 않음

  ComboBox1.DropDown;
end;
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함