Metro style

Metro  style

I have been styling FireMonkey controls, but there is one issue that I have been having some real issues with, and that is how to incorporate bitmaps into FireMonkey styles using the FireMonkey Style Designer (and specifically not the Bitmap Style Designer). Certain styled objects (TButtonStyleObject, for example), have BitmapLink properties, but I cannot see how they are working in the new custom styles that are generated for a FireMonkey control.

Let me try to make the problem as transparent as possible. I add a StyleBook and set its Resource to the MetropolisUIGreen.Style in Delphi‘s Style directory (in XE7 this is located in C:\Users\Public\Documents\Embarcadero\Studio\16.0\Styles). I then open the FireMonkey Style Designer and locate the buttonstyle style, which consists of a TButtonStyleObject and a TButtonStyleTextObject, both parented to a TLayout. The TButtonStyleObject has a SourceLookup property value of MetroGreenstyle.png, which is a StyleName assoiated with a TImage into which the MetropolisUIGreen.png image has been loaded.

With the TButtonStyleObject (whose StyleName is background) selected, I examine the NormalLink property, which is a collection of TBitmapLinks. It is my understanding that the one BitmapLink that I see defined in NormalLink contains information about the bitmap that should be used for the button, including the coordinates (SourceRect) corresponding to a rectangular region of the MetroGreenstyle.png file.

My assumptions appear to be wrong, because when I examine MetroGreenstyle.png using a graphics program, there is nothing interesting at these coordinates. I have examined the BitmapLinks of many other styles, and there too I find that the SourceRect coordinates do not seem to actually define a meaningful region of the stylelookup png file.

I obviously have this wrong. How does the SourceRect coordinates of a BitmapLink define the bitmap that FireMonkey should use when rendering a control.

-- Edit I actually asked four question. I have updated this question to include just one question. I will include the other questions in another post。

solution 1:

I think there is a difference between the bitmap embedded in the .style file (embedded as a resource) and the one stored in the file (C:\Users\Public\Documents\Embarcadero\Studio\15.0\Styles\MetropolisUIGreen.png, that is 519x760).

The embedded bitmap seems to be different in size than the external file (you can check that by looking in the Style Editor, selecting the metrogreenstyle.png node, opening the property editor for MultiResBitmap and looking at the image size provided for Scale 1.00: 750x850.

This explains why coordinates seems all wrong. I don‘t know if it is the external file to be out of date or the opposite.

HTH!

Update: I managed to extract the bitmap stored in the .style file and I can confirm the coordinates are relative to that bitmap!

Update(2): .Style files and .fmx file are very similar so you can do:

1) open MetropolisUIGreen.Style with a text editor and locate the embedded bitmap (line 18), you can see:

object TImage
    StyleName = ‘MetroGreenstyle.png‘
    MultiResBitmap = <
      item
        Width = 0
        Height = 0
        PNG = {...}

2) create a new FMX application, add a TImage on the form and load a bitmap (any picture you want)

3) copy the PNG value from the .Style file into the XFM file. Beware to also fix the Width and Height properties:

MultiResBitmap = <
  item
    Width = 750
    Height = 850
    PNG = {...}

4) you should be able to see the picture at design time;

5) add a button with Image1.Bitmap.SaveToFile(‘C:\temp\new_file.png‘); run the program and save the file to your disk. :-)

http://stackoverflow.com/questions/27111639/using-tbitmaplinks-with-the-firemonkey-style-designer

时间: 2024-10-12 13:36:47

Metro style的相关文章

WPF 自定义Metro Style窗体

为了使WPF程序在不同版本的操作系统上保持一致的显示效果,我们需要重写WPF控件样式.这篇博客将展示如何创建一个Metro Style的WPF窗体. 首先先看一下最终窗体的效果图, 通过截图我们可以看出来这个窗体由两部分组成,顶部为最小化和关闭按钮,其他区域为窗体的显示区域.请看下面的具体实现代码, MetroWindow样式: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentat

漂亮的win8风格网页(Metro Style web)

漂亮的win8风格网页(Metro Style web)

【今日推荐】10大流行的 Metro UI 风格的 Bootstrap 主题和模板

http://www.cnblogs.com/lhb25/archive/2013/04/11/10-metro-bootstraps-ui-templates.html Metro UI 是一种界面展示技术,是 Windows 8 的主要界面显示风格.Metro 界面和 iOS.Android 界面最大的区别在于:后两种都是以应用为主要呈现对象,而 Metro 界面强调的是信息本身,而不是冗余的界面元素.同时在视觉效果方面,这有助于形成一种身临其境的感觉. 如果你的下一个网站项目或 Web 应

WPF 使用MahApps.Metro UI库

在WPF中要想使用Metro风格是很简单的,可以自己画嘛.. 但是为了节省时间,哈,今天给大家推荐一款国外Metro风格的控件库. 本文只起到抛砖引玉的作用,有兴趣还是推荐大家上官网,Thanks,官网地址 我会在底部发出. 实现效果 其实下面仅仅是对窗体的一个简单设置,以及放了些简单的按钮,这是本文抛砖引玉的示例程序,其实还有非常多的好玩的样式,包括动画效果. 安装 MahApps.Metro 这里依然推荐使用NuGet来进行安装,如下图所示. 然后在NuGet中搜索 MahApps.Metr

【推介】TMS的控件之“TMS Unicode Component Pack”和“TMS Advanced Toolbars &amp; Menus”

TMS Unicode Component Pack是一款支持多语言的界面控件包,提供超过60种控件来为你的Delphi和C++Builder应用程序添加Unicode支持. 介绍: TMS Unicode Component Pack控制组件能让你在不终止Delphi.C++Builder或Windows 95/98/ME的情况下利用Windows NT/2000/XP/2003/Vista的Unicode功能开发应用程序.  注意:这些控制组件不会将Unicode功能添加到Windows 9

WPF 创建自定义窗体

在前面的一篇博客"WPF 自定义Metro Style窗体",展示了如何创建一个类似于Metro Style的Window,并在程序中使用.但是这个窗体不能够自由的改变大小.今天的博客中将展示如何创建一个可以通过拖拽来改变大小的Metro Style窗体. 实现思路,在Windows ControlTemplate中增加8个背景透明Rectangle,分别放置于Left, Right, Top, TopLeft, TopRight, Bottom, BottomLeft, Bottom

YY语言

YY语音,又名"歪歪语音",由广州多玩信息技术有限公司(NASDAQ:YY)研发,是一款基于网络团队语音的通信平台的计算机程式,主要功能是进行在线多人语音聊天,也有截图等一些辅助功能. 该款软件的用户群主要集中在中国大陆,大多都用于网络游戏中的团队交流. 是魔兽世界.cf等网络游戏玩家经常使用的软件. ?基本信息 公司名称:   广州多玩信息技术有限公司    总部地点:   广州市 成立时间:   2005年11月 经营范围:   科技公司 公司性质:   民营企业 最新版本:   

免费素材:25套免费的 Web UI 设计的界面元素(转)

Web 元素是任何网站相关项目都需要的,质量和良好设计的元素对于设计师来说就像宝贝一样.如果您正在为您的网站,博客,Web 应用程序或移动应用程序寻找完美设计的网页元素,那么下面这个列表会是你需要的. 今天这里收集的免费资源是25套免费的 Web UI 设计的界面元素,用于和Mobile App设计.它包括所有的设计元素的 PSD 格式,某些元素提供矢量格式,可以缩放到任意大小. UI Kit – Free PSD Download Ui Kit [Free PSD] Download Free

关于Store Apps

因为时代在变迁,Store Apps这个概念很容易引起混淆 在过去,windows phone 8.0时代 windows store apps指的是windows metro style 的应用, 这些应用主要是运行在 以下两个OS windows rt 8/8.1 硬件载体是平板,如:sureface rt,surface (rt) 2 windows 8/8.1    硬件载体是PC,包括笔记本和台式机上 而windows phone 的app仅仅是建立在wp手机平台上 然而,随着Wind