TMSFNCHTMLText Border?

The TMSFNCHTMLText control has a border and I need to get rid of it.  I've tried various properties but can't make it go away.  


Anyway to use this control and not have it render a border?

I have it parented in a TRectangle because I need to be able to have round corners to match the style of the app.

The image attached has 2 TMSFNCHTMLText controls stacked on top of each other.

hi,


Can you try calling DisableBackground programmatically?

That doesn't work because I need the color, just not the border.  Calling that method removes the background color.

Set the stroke color to the same color as the fill color to "disable" the border.


I've already tried that with variations on the Stroke.Kind, Stroke.Opacity, and Stroke.Width

That doesn't work.
We have tried with the following code and are not able to reproduce the border:



procedure TForm18.FormCreate(Sender: TObject);
var
  r: TRectangle;
  h: TTMSFNCHTMLText;
begin
  r := TRectangle.Create(Self);
  r.Parent := Self;
  r.Width := 200;
  r.Height := 200;
  r.Position.X := 100;
  r.Position.Y := 100;


  h := TTMSFNCHTMLText.Create(Self);
  h.Parent := r;
  h.Align := TAlignLayout.Top;
  h.EnableBackground;
  h.Fill.Color := gcRed;
  h.Stroke.Color := gcRed;
  h.Text := 'Text 1';


  h := TTMSFNCHTMLText.Create(Self);
  h.Parent := r;
  h.Align := TAlignLayout.Client;
  h.EnableBackground;
  h.Fill.Color := gcRed;
  h.Stroke.Color := gcRed;
  h.Text := 'Text 2';


end;


Adding the following code to the AfterDraw method it appears the Border is one pixel outside (lower) of the ARect : TRectF parameter being passed.


Did you try with the code in my previous post? We are not able to reproduce this issue out of the box.


I installed the latest and my version shows 1.1.0.0  What is yours?

The same, but have you tried? If you did and have the same results, please send us as sample that reproduces this.


Your code works when the controls are created at run time, but it still doesn't work when the components are dropped and properties manipulated at design time.

OK, will do.

Change your test to the following:

  h := TTMSFNCHTMLText.Create(Self);
  h.Parent := Rectangle33;
  h.Align := TAlignLayout.Top;
  h.EnableBackground;
  h.Fill.Color := gcRed;
  h.Stroke.Color := gcRed;
  h.Text := 'Text 1';

  h.WordWrapping := True;
  h.AutoSize := True;
  h.AutoHeight := True;
  h.AutoWidth := False;

  h := TTMSFNCHTMLText.Create(Self);
  h.Parent := Rectangle33;
  h.Align := TAlignLayout.Top;
  h.EnableBackground;
  h.Fill.Color := gcRed;
  h.Stroke.Color := gcRed;
  h.Text := 'Text 2';

With this code we were able to reproduce the issue. Next version will address this.


Know what would be cool to do while you are fixing this.  Add a property such that the Text being rendered respects the Padding property.  Just sayin'

Or is there a built in way to do this now, without having to owner draw stuff?

The Padding property is for child controls. The Text is part of the control, and is not a child control. If you want to use padding, please include the TTMSFNCHTMLText inside another container control, such as a TPanel, or a TRectangle.


I would, but having it inside of another control leads to more issues when you have AutoSize and WordWrap turned on because you have to then resize the parent control to adjust to the height if it changes.

Which is why I asked the question.

Perhaps you can use Margins on the child control instead?


The TMSFNCHTMLText  would be the child control so the fill color wouldn't work.