Jump to content

need 2 answers for two cool things

- - - - -

  • Please log in to reply
6 replies to this topic

#1
Paulo_Jorge

Paulo_Jorge

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
1st - i saw on a youtube video, a guy moving buttons/pictures in visual basic, while the project was running; it created and represented the idea of moving icons in windows desktop.

i want to do the same; anyone know something? code/links, something useful

2nd - this is about resizing the form:

-when i resize the form, i want the objects of that form, to adapt and resize to the new size of the form; it supposed they adjust automatically with the resizing of the form; please tell me how i can do that.

-when i put the form windowstate maximized, the form appears maximized of course, but the object dont lool proporcionally and it the right place;for example i put a button in the bottom left corner, but when the project loads, that object appears in center left. is there anyway to do that without having to coding coordinates;


thanks, and sorry for the long text and the english

#2
hetra

hetra

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 298 posts
  • Location:Australia
  • Programming Language:C, C++, PHP, Python, Delphi/Object Pascal, Assembly
  • Learning:Python, Assembly
Perhaps by anchoring the elements to the sides of the form? I don't know Visual Basic, but in Visual C++, that's what I would do.

I suppose it's slightly out of my field.
Jack
Creator, Owner, Webmaster
Brezerd.net

#3
Simonxz

Simonxz

    Learning Programmer

  • Members
  • PipPipPip
  • 42 posts
Take a look into the Dock property. You can place your items by using splitcontainers and panel, and docking your controls into them.

#4
Mark Wylde

Mark Wylde

    Learning Programmer

  • Members
  • PipPipPip
  • 46 posts
To answer your first question you'll probably want to use the MouseDown event on the object you want to move.

So if you want to move a command button for example then you would do something like this:

This is a really rough example so sorry

Private Sub Button1_MouseDown()

        button1.capture = false

        Dim sndmsg As Message = Message.Create(TextBox1.Handle, &HA1, New IntPtr(2), IntPtr.Zero)

        me.defwndproc(sndmsg)

End Sub



#5
Paulo_Jorge

Paulo_Jorge

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
THANKS

this works fine but the click event dont work with this, i cant understand why, it only works if i put the code in the mousedown event, and i dont wont that.

please help, it's not th first time that my clickevent dont work

#6
Mark Wylde

Mark Wylde

    Learning Programmer

  • Members
  • PipPipPip
  • 46 posts
What you could do is put this in the MouseMove event. Then I think MouseMove has a property to say if a mouse button is clicked. It might be Button or something, not sure of the top of my head.

#7
Paulo_Jorge

Paulo_Jorge

    Learning Programmer

  • Members
  • PipPipPip
  • 54 posts
worked PERFECT , in the mousemove event

THANKS THANKS.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users