Difference between revisions of "Reference: MSEgui/TFace"
MichaelEbner (talk | contribs) |
MichaelEbner (talk | contribs) |
||
Line 212: | Line 212: | ||
* bmo_masked, mbo_graymasked, mbo_colormasked, bmo_storeorigformat, bmo_runtimeformatdate | * bmo_masked, mbo_graymasked, mbo_colormasked, bmo_storeorigformat, bmo_runtimeformatdate | ||
* origformat | * origformat | ||
− | |||
[[Category:MSEide+MSEgui]] | [[Category:MSEide+MSEgui]] |
Revision as of 13:32, 29 December 2015
TFace
The visual appearance of a widget is specified by the properties Face and Frame. Face concerns the widget itself, Frame the appearance around it.
Reference
Hierarchy
- TObject
- TPersistent
- TVirtualPersistent
- TNullInterfacesPersistent
- TOptionalPersistent
- TCustomFace
- TFace
Properties
Fade
You can specify a color fade with two or more colors. (You can specify with one color too, but that's no fade...)
The picture was generated with the following code. Please not, that green is not exactly in the middle, but moved to the left - the position isn't 0.5, it's 0.3.
procedure tmainfo.Button3Execute(const sender: TObject);
begin
if Button3.Face = nil then
Button3.Face := TFace.Create;
Button3.Face.Fade_color.Count := 3;
Button3.Face.Fade_color.Items[0] := cl_red;
Button3.Face.Fade_color.Items[1] := cl_green;
Button3.Face.Fade_color.Items[2] := cl_blue;
Button3.Face.Fade_pos.Count := 3;
Button3.Face.Fade_pos.Items[0] := 0;
Button3.Face.Fade_pos.Items[1] := 0.3;
Button3.Face.Fade_pos.Items[2] := 1;
end;
With the Fade_direction you specify the direction:
property fade_direction: graphicdirectionty default gd_right;
You can also specify a opacity and a fade of it. In the following the left picture is without opacity, the middle is with a opacity fade from cl_white to cl_black from 0.7 to 1, and the right picture is a opacity fade from cl_white to cl_black from 0 to 1 and a underlying picture and options = [fao_fadeoverlay].
With the property Fade_opacity you can specify a opacity for the whole face without any fade. Typical opacity colors are cl_black and cl_white, but you can use every other color.
property Fade_opacity: colorty default cl_none;
property Fade_opapos: trealarrayprop;
property fade_opacolor: tfadeopacolorarrayprop;
FrameImage
With the property FrameImage you can paint individual frames by using a TImageList. In the imalge list their are used 8 consecutive images. The images for the edges will be stretched as needed - this will look very strange, if this images are not suitable (look the followong picture).
For a "good loking example" see TFrame.FrameImage.
property FrameImage_list: timagelist;
// imagenr 0 = topleft, 1 = left, 2 = bottomleft, 3 = bottom,
// 4 = bottomright 5 = right, 6 = topright, 7 = top
property FrameImage_offset: integer default 0;
Framei
You can specify spacings to the borders of the widget:
procedure tmainfo.Button3Execute(const sender: TObject);
begin
if Button3.Face = nil then
Button3.Face := TFace.Create;
Button3.Face.Fade_color.Count := 1;
Button3.Face.Fade_color.Items[0] := cl_blue;
Button3.Face.Framei_left := 4;
Button3.Face.Framei_bottom := 6;
Button3.Face.Framei_right := 8;
Button3.Face.Framei_top := 10;
end;
Image
With the property Image you can assign a pixel graphic to the face. Use Face.Image.Mask_Source for masking this pixel grahic. Meanwhile there is no difference between assigning a picture or using Face.Image.Source at use of masking.
procedure tmainfo.ButtonClick(const Sender: TObject);
var
LRoot: string;
begin
LRoot := ExtractFilePath(Application.ApplicationName);
BitmapComp1.Bitmap.LoadFromFile(LRoot + 'FuBK.jpg');
BitmapComp2.Bitmap.LoadFromFile(LRoot + '112_linien_1.jpg');
Button1.CreateFace;
Button1.Face.Image.Source := BitmapComp1;
Button1.Face.Image.Alignment := [al_fit];
Button2.CreateFace;
Button2.Face.Image.Source := BitmapComp2;
Button2.Face.Image.Alignment := [al_fit];
Button3.CreateFace;
Button3.Face.Image.Source := BitmapComp1; // no masking at earlier versions, works now
Button3.Face.Image.Alignment := [al_fit];
Button3.Face.Image.Mask_Source := BitmapComp2;
Button4.CreateFace;
Button4.Face.Image.Assign(BitmapComp1.Bitmap); // masking
Button4.Face.Image.Alignment := [al_fit];
Button4.Face.Image.Mask_Source := BitmapComp2;
end;
Use the property Face.Image.Alignment to align, stretch or tile the image:
Use [al_NoMaskScale], if you want to scale the picture, but not the mask:
If you have a 2-Color-Bitmap, you can specify with ColorForeground and ColorBackground it's colors:
If you are downsizing pictures with small lines, the al_interpol, al_and and al_or will make a difference (al_and and al_or only with Windows):
Template and LocalProps
You can assign Template to a TFaceComp-instance to take the face settings of this non-visual component.
If a special property of TFace should not specified by Template but the local TFace-settings, use LocalProps to except this property of template settings for this widget.
facelocalpropty = (fal_options,fal_framei_left,fal_framei_top,
fal_framei_right,fal_framei_bottom,
fal_fadirection,fal_image,
fal_fapos,fal_facolor,fal_faopapos,fal_faopacolor,
fal_fatransparency,
fal_faopacity,fal_frameimagelist,fal_frameimageoffset);
facelocalpropsty = set of facelocalpropty;
property LocalProps: facelocalpropsty;
property Template: TFaceComp;
Options
faceoptionty = (fao_alphafadeimage,fao_alphafadenochildren,fao_alphafadeall,
fao_alphaimage,
fao_fadeoverlay,fao_overlay);
faceoptionsty = set of faceoptionty;
property options: faceoptionsty default [];
TransparentColor
If bmo_masked is set, one color get transparent and you the instead of it the background. If TransparentColor is cl_default, the color of the pixel in the left bottom corner is used as TransparentColor, otherwise you can specify it with this property.
Methods
Events
known issues
issues of the class
issues of this documentation
Feel free to add your points here.
What do the following at Image:
- bmo_masked, mbo_graymasked, mbo_colormasked, bmo_storeorigformat, bmo_runtimeformatdate
- origformat