Results 1 to 5 of 5

Thread: Moving a Form with no Control Box

  1. #1

    Thread Starter
    Hyperactive Member cajsoft's Avatar
    Join Date
    Aug 2000
    Location
    Glasgow, Scotland
    Posts
    295

    Question

    Hello Folks,
    How can I allow my form to be movable even when the control box is disabled. The form is a small rectangular form that has 4 small images placed on it, that covers most of the form. ie. there is no clickable area on the form that would allow for a form_click() event.

    Please help
    Thanks.

    Craig J

    Novice VB Programmer.... and proud of it...

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    not exactly sure what you're trying to do here, but this code will move a form from one place to another, to try it paste the code into a form with a button on it, run it and click the button

    'BEGIN CODE
    Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    Private Const HWND_TOP = 0
    Private Const SWP_SHOWWINDOW = &H40


    Private Sub Command1_Click()
    SetWindowPos Me.hwnd, HWND_TOP, 10, 10, Me.Width / 15, Me.Height / 15, SWP_SHOWWINDOW
    End Sub
    'END CODE

    Hope this helps


    You can also just set the form.Left and form.top properties of you don't want to use the API:

    Me.Left = 10
    Me.Top = 10
    'will have the same effect as SetWindowPos



    [Edited by crispin on 10-05-2000 at 12:01 PM]
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

  3. #3

    Thread Starter
    Hyperactive Member cajsoft's Avatar
    Join Date
    Aug 2000
    Location
    Glasgow, Scotland
    Posts
    295

    Question

    Hi,
    thanks for the help, but I think we are both on the wrong track.

    What I am trying to achieve is I have a form, that I dont want to look like a form when loaded, ie, remove the control box and minize buttons etc.. but, If I do remove the control box, the form can no longer be moved at runtime. I want to know is there a way that the control box can be removed and the form can still be dragged at runtime.

    Thanks again.
    CJ

  4. #4
    Guest
    Take a look at this thread.

  5. #5

    Thread Starter
    Hyperactive Member cajsoft's Avatar
    Join Date
    Aug 2000
    Location
    Glasgow, Scotland
    Posts
    295
    Yes, this is basically what I'm looking for, but it doesnt work for my program, as the form is filled up with Image's, meaning there is no clickable area on the form, only the images.

    I dont know if this makes sense to you.. If I could place another frame of some type over the form, this means I could change the code to frame1_mousemove(blah), instead of form1_mousemove(xxx), but unforunately, when I place a frame over the form, the images no longer appear.

    This one is a puzzler!

    Thanks
    Craig.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width