Right to left text in delphi trayicon BaloonHint - delphi

Is there a way to align text right in the delphi trayicon BaloonHint?

You would need to use your own hint window
type
TRTLHint = class(THintWindow)
protected
procedure CreateParams(var Params: TCreateParams); override;
end;
procedure TRTLHint.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.ExStyle := Params.ExStyle or WS_EX_LAYOUTRTL;
end;
You can then use this TRTLHint in this way.

Related

How prevent href title attribute show over transparent Form?

I have these two code that makes a Form transparent.
Form1.AlphaBlend := True;
SetWindowLong(Form1.Handle, GWL_EXSTYLE, GetWindowLong(Form1.Handle,GWL_EXSTYLE) or WS_EX_TRANSPARENT or WS_EX_LAYERED);
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
protected
procedure CreateParams(var Params: TCreateParams); override;
end;
// AlphaBlend := True;
procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_TOPMOST or WS_EX_TRANSPARENT;
Params.ExStyle := WS_EX_TRANSPARENT or WS_EX_TOPMOST;
end;
When mouse is over a link with a title attribute, this appear over transparent Form. How prevent this behavior?

Delphi 5 transparency breaks child draw

I have a control in Delphi 5 like this (following this post: https://tips.delphidabbler.com/tips/74.html):
type
TTransparentGroupbox = class(TGroupBox)
protected
procedure CreateParams(var params: TCreateParams); override;
procedure WMEraseBkGnd(var msg: TWMEraseBkGnd); message WM_ERASEBKGND;
end;
.....
procedure TTransparentGroupbox.CreateParams(var params: TCreateParams);
begin
inherited CreateParams(params);
params.ExStyle := params.ExStyle or WS_EX_TRANSPARENT;
end;
procedure TTransparentGroupbox.WMEraseBkGnd(var msg: TWMEraseBkGnd);
begin
SetBkMode(msg.DC, TRANSPARENT);
msg.result := 1;
end;
But I have trouble when it is redrawn. The portion not blurred should be listbox on such a TTransparentGroupbox, but it is not entirely redrawn, as if the background mode would have been propagated to the children but they are repainted on the TWinControl level. I have tried to set it back to OPAQUE at the only point I could override, but with no success:
procedure TTransparentGroupbox.PaintWindow(DC: HDC);
begin
SetBkMode(DC, OPAQUE);
inherited;
end;
The annoying part is, that I have other TTransparentGroupbox instances, with other TListBox instances that do not behave in this way.
The second problem I have is that whenever the visibility of a child control is changed to false, it is not "erased".

How to create transparent control with TCustomTransparentControl?

I want to create a transparent panel that holds an PNG image that has transparency in it. I want to put this panel on top of other panels and see trough.
I have the code below but it won't accept controls. If I uncomment the commented lines the IDE raises an exception when I put the controls on the form.
unit TransparentPanel5;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Vcl.Controls, ExtCtrls;
type
TTransparentPanel5 = class(TCustomTransparentControl)
private
public
constructor Create(AOwner: TComponent); override;
procedure CreateParams(var Params: TCreateParams); override;
end;
procedure Register;
implementation
constructor TTransparentPanel5.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
//ControlStyle := ControlStyle - [csSetCaption]+ [csAcceptsControls];
end;
procedure TTransparentPanel5.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
// Params.ExStyle := Params.ExStyle + WS_EX_Transparent;
// ControlStyle := ControlStyle - [csOpaque] + [csAcceptsControls]
end;
procedure Register;
begin
RegisterComponents('His', [TTransparentPanel5]);
end;
end.
You've got two unrelated questions. I chose to answer the second one.
The IDE raise an AV because you fail to apply extended styles properly. You have to use or operator to set a bit. When you use + you add up the value of the style bit and end up with an entirely different meaning, in this case with some WS_EX_MDICHILD which causes the CreateWindowEx call to fail.
Should be like this:
procedure TTransparentPanel5.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_Transparent;
// ControlStyle := ControlStyle - [csOpaque] + [csAcceptsControls]
end;
Note that it won't have any effect since the TCustomTransparentControl already sets that extended style.

Delphi resizable bsDialog Form?

How can I make a Form (ShowModal) with BorderStyle bsDialog. but one that could still be resized and have the close button (without the Icon,Minimize, Maximize)?
I do not need it to show the size grip.
Here is my solution which seems to work OK:
type
TForm2 = class(TForm)
procedure FormCreate(Sender: TObject);
private
protected
procedure CreateWnd; override;
procedure CreateParams(var Params: TCreateParams); override;
public
end;
var
Form2: TForm2;
implementation
{$R *.DFM}
procedure TForm2.FormCreate(Sender: TObject);
begin
BorderIcons := [biSystemMenu];
BorderStyle := bsSizeable;
AutoScroll := False;
end;
procedure TForm2.CreateWnd;
begin
inherited;
SendMessage(Handle, WM_SETICON, 1, 0);
end;
procedure TForm2.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_DLGMODALFRAME or WS_EX_WINDOWEDGE;
end;
IMO, This cant be done with bsDialog but the above feels and looks just like a "bsDialog" which could be resized.
Set the BorderStyle to bsSizeToolWin.

How to remove the title bar from a form

Does anyone know how to create a Delphi form without a title bar? I have seen some some links/tips but its not exactly what I want and I couldn't do it myself.
This is what I am trying to achieve:
First, set BorderStyle to bsNone at design-time. Then declare the procedure CreateParams like so:
type
TForm1 = class(TForm)
private
protected
procedure CreateParams(var Params: TCreateParams); override; // ADD THIS LINE!
{ Private declarations }
public
{ Public declarations }
end;
and implement it like
procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.Style := Params.Style or WS_THICKFRAME;
end;
Set BorderStyle to bsNone in Object Inspector
For better border style, you can add the WS_BORDER flag.
Like this:
procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.Style := Params.Style or WS_BORDER or WS_THICKFRAME;
end;
Note than a soft line is drawn inside the border frame.

Resources