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 6915597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:29:43+00:00 2026-05-27T09:29:43+00:00

I have a custom form which does not have any type of border. I’m

  • 0

I have a custom form which does not have any type of border. I’m drawing some custom borders of my own instead, which do not extend up to the far edges of the form. Instead, whatever’s outside this custom drawn border is transparent, through the use of the form’s transparent properties. This leaves a smaller portion of the form to be usable and visible.

I know there are tons of solutions out there to accomplish this, and I’ve already found the best suited method to do this. However, this method assumes that user will be pointing the mouse along the far edges of the form. I need to limit it to react from within different constraints (for example a smaller sized rect).

Here’s the code I found which already works on a next-to-the-edge constraint:

procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;

....

procedure TForm1.WMNCHitTest(var Message: TWMNCHitTest);
const
  EDGEDETECT = 7;  //adjust to suit yourself
var
  deltaRect: TRect;  //not really used as a rect, just a convenient structure
begin
  inherited;
  if BorderStyle = bsNone then begin
    with Message, deltaRect do begin
      Left := XPos - BoundsRect.Left;
      Right := BoundsRect.Right - XPos;
      Top := YPos - BoundsRect.Top;
      Bottom := BoundsRect.Bottom - YPos;
      if (Top<EDGEDETECT)and(Left<EDGEDETECT) then
        Result := HTTOPLEFT
      else if (Top<EDGEDETECT)and(Right<EDGEDETECT) then
        Result := HTTOPRIGHT
      else if (Bottom<EDGEDETECT)and(Left<EDGEDETECT) then
        Result := HTBOTTOMLEFT
      else if (Bottom<EDGEDETECT)and(Right<EDGEDETECT) then
        Result := HTBOTTOMRIGHT
      else if (Top<EDGEDETECT) then
        Result := HTTOP
      else if (Left<EDGEDETECT) then
        Result := HTLEFT
      else if (Bottom<EDGEDETECT) then
        Result := HTBOTTOM
      else if (Right<EDGEDETECT) then
        Result := HTRIGHT
    end; 
  end;
end;

How would I go about changing the bounds for this to react? For example, the left and right edges should react 10 pixels into the form. The standard form rect may be (0, 0, 100, 100) but I want this method above to work within bounds of (10, 3, 90, 97)

  • 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-27T09:29:44+00:00Added an answer on May 27, 2026 at 9:29 am

    Actually it would make sense to define two constants instead of the only EDGEDETECT since
    you require horizontal and vertical offsets to be different and write it from scratch, but here is a quick patch:

    procedure TForm1.WMNCHitTest(var Message: TWMNCHitTest);
    const
      EDGEDETECT = 17;  //adjust to suit yourself    // <- increased to suit outer offset
    var
      deltaRect: TRect;  //not really used as a rect, just a convenient structure
    
      OuterRect: TRect;                              // used as a rect
    begin
      inherited;
      if BorderStyle = bsNone then begin
        with Message, deltaRect do begin
    
         ..
          else if (Right<EDGEDETECT) then
            Result := HTRIGHT;
         ..
    
          OuterRect := BoundsRect;                    // patch
          InflateRect(OuterRect, -10, -3);
          if not PtInRect(OuterRect, SmallPointToPoint(Message.Pos)) then
            Message.Result := HTTRANSPARENT;
    
        end;
      end;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django app with custom form fields, some of which have slow
I have a custom site definition which includes a form library. I have a
I have a custom jQuery plugin which binds a change event to a form
I have a need to display a custom form instead of the default inspector
I have a button that has custom code which sends the form data to
I have a Customer class which has all the account info.(it does NOT extend
I have designed a custom panel which can expand or collapse form at run
I have CustomForm inherited from Form which implements a boolean property named Prop .
Let's say you have a custom form MyForm : Form and want to run
Can you have custom client-side javascript Validation for standard ASP.NET Web Form Validators? For

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.