Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6369657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:49:59+00:00 2026-05-25T00:49:59+00:00

I’d like to have a TForm with BorderStyle = bsNone (no borders, no caption),

  • 0

I’d like to have a TForm with BorderStyle = bsNone (no borders, no caption), which is nevertheless resizable and movable. I already figured out how to do the resizable part, but I’m stuck with getting it movable.

/**
*   Overrides standard CreateParams method to create a TForm with BorderStyle
*    bsNone but is nevertheless movable and resizable
**/
void __fastcall CreateParams(TCreateParams &Params)
{
    BorderStyle = bsNone;
    TForm::CreateParams(Params);
    //set flag WS_EX_STATICEDGE
    //for more details on this flag, see http://msdn.microsoft.com/en-us/library/ms632680(v=vs.85).aspx
    Params.ExStyle = Params.ExStyle ^ 0x00020000L;
    //set flag WS_SIZEBOX
    //for more details on this flag, see http://msdn.microsoft.com/en-us/library/ff700543(v=VS.85).aspx
    Params.Style = Params.Style ^ 0x00040000L;
}

It’s probably only a matter of finding the correct flags. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:50:00+00:00Added an answer on May 25, 2026 at 12:50 am

    The best way to allow a form to move is to mimic how a form moves when you click and drag the title bar. Since your window doesn’t have a title bar, when Windows needs to know what part of your form the mouse cursor is over you lie and tell Windows that it is indeed over the title bar. After that, moving works normally since the default behaviour kicks in.

    To do this, you respond to the WM_NCHITTEST message, which is easily done by overriding the form’s WndProc method. This message is sent in several situations (not just mouse clicks or movement) so don’t assume anything about what the user’s doing when you get this message. Handle it by setting the message result to HTCAPTION, a value indicating the position is over the title bar.

    Important things to note are:

    • This method will be called for every message the form gets; don’t do anything slow or complex here.
    • Always let the default inherited implementation of WndProc handle the message. This is essential for most messages, since you only want to change the behaviour for this one and if you don’t call the inherited implantation nothing will happen for the messages at all, but it’s important for this one too since you don’t know what code needs to be sent this message. I.e., you want to add to how your program responds to this, not replace it. This is a general good guideline for all message processing you intercept / add. The WndProc documentation mentions this too.
    • You can set a region of the form to be the draggable bit by checking the mouse coordinates. In the below code, only the top 100 pixels of the form will be draggable.

    Sample code:

    void __fastcall TForm1::WndProc(Messages::TMessage& Message) {
        TForm::WndProc(Message); // Inherited implementation
        if (Message.Msg == WM_NCHITTEST) {
            TWMNCHitTest& oMsg = reinterpret_cast<TWMNCHitTest&>(Message);
            TPoint oPoint(oMsg.XPos, oMsg.YPos); // Screen coordinates
            oPoint = ScreenToClient(oPoint); // Now in form-local coordinates
            // It's in the title bar (caption) if it's in a rectangle at the top of the form
            if ((oPoint.x > 0 && oPoint.x < ClientWidth) &&
                (oPoint.y > 0 && oPoint.y < 100))
            {
                oMsg.Result = HTCAPTION;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
I have some data like this: 1 2 3 4 5 9 2 6
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.