I just tried some things in Delphi to see if I could get it to work where it didn't have a titlebar and could be resizable...and at first I couldn't do it either.
The problem I had is that there is no way to get rid of the titlebar unless I set the form's border style to 'none'...which isn't resizable. Only 'sizable' & 'sizable tool window' can be resized by dragging the edge...and they both have titlebars.
Then I remembered a custom form I was working on awhile back...some really flashy looking thing...and remembered I was able to make it resizable. So I looked at how I did it and was able to create a transparent window with a border that was resizable.
The trick here is in procedure TForm1.CreateParams. It overrides the borderstyle of 'none' to give it a border and it's resizable.
Anything you may have had in your OnCreate procedure that resembled this, won't be needed...just remove or comment it out:
procedure TForm1.FormCreate(Sender: TObject);
begin
SetWindowLong( Handle, GWL_STYLE,
GetWindowLong( Handle, GWL_STYLE )
and not WS_CAPTION ) ;
ClientHeight := Height;
end;
form properties & settings:
Spoiler
object Form1: TForm1
Left = 210
Top = 157
HorzScrollBar.Visible = False
VertScrollBar.Visible = False
BorderStyle = bsNone
BorderWidth = 1
ClientHeight = 449
ClientWidth = 681
Color = clBtnFace
TransparentColor = True
TransparentColorValue = clLime
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
FormStyle = fsStayOnTop
OldCreateOrder = False
OnCreate = FormCreate
DesignSize = (
681
449)
PixelsPerInch = 96
TextHeight = 13
object Panel1: TPanel
Left = 0
Top = 0
Width = 681
Height = 449
Anchors = [akLeft, akTop, akRight, akBottom]
BevelInner = bvLowered
BevelOuter = bvLowered
Color = clLime
TabOrder = 0
object Panel2: TPanel
Left = 1
Top = 1
Width = 185
Height = 41
BevelInner = bvRaised
Caption = 'drag me'
TabOrder = 0
OnMouseDown = Panel2MouseDown
object Button1: TButton
Left = 152
Top = 8
Width = 27
Height = 25
Caption = 'X'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
TabOrder = 0
OnClick = Button1Click
end
end
end
end
Form code:
Spoiler
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Button1: TButton;
procedure Panel2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure WMNCHitTest(var Msg: TWMNCHitTest);
message wm_NCHitTest;
public
{ Public declarations }
procedure CreateParams(var Params: TCreateParams); override;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.Style := (Params.Style or WS_THICKFRAME);
end;
procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest);
begin
inherited;
if Msg.Result = htClient then
Msg.Result := htCaption;
end;
procedure TForm1.Panel2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
SendMessage(Form1.Handle, WM_SYSCOMMAND, 61458, 0);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
//prevents flickering when resizing
Form1.DoubleBuffered := true;
Panel1.DoubleBuffered := true;
Panel2.DoubleBuffered := true;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Application.Terminate;
end;
end.
I am not sure if the Delphi code will be any help to you, but I have been told that Delphi & C# are similar enough to be almost considered close cousins.
The full Delphi source and .exe file are attached if you need it or want to try out the form to see how it works.