Forms

  • Thread starter Thread starter Dino M. Buljubasic
  • Start date Start date
D

Dino M. Buljubasic

I'd like to remove the form title bar and do my own. I know that removing
the title bar (by setting FormBorderStyle property to none) removes all
other events for the form such as closing, resizing, moving, etc.

I would like to write these on my own. Anybody knows any good reference
where to start learning to do this?

Thank you,
 
are you talking about dragging stuff into the picture box?
You can resize it using its anchor property to top, left,
right.
 
No, I would like to be able to drag the form on the screen and resize it by
clicking on its border and then moving the mouse. As I know, if I remove
the form title (FormBorderStype = none), all these are lost and I have to
programm them on my own.
 
That is what I need. Can you share it?

Thanks

Bilal said:
I am able to move the form using point object in Mouseup,
MouseDown and MouseMove event. It is very efficient, but
with a little more work, it can be done.
 
You know... you could get *really* crazy and do something like Windows Media
Player 9.

In which case, you create the form as normal, but you hide it via setting
opacity to 0%.. And if the mouse is over it for more than 1 second (using a
mouse event), you tell opacity to jump to 100% again...

If you notice Win Media player basically has 2 title bars... And you can
drag both, but I think the second one is using Bilal's method.

Just a concept for ya to chew on.
 
Yes, sounds interesting but the time does not allow playing with that. ....
unfortunatelly.... :)

All I want to do is to make my form look like Microsoft Outlook note. No
title bar (just an icon I place there and X (alos an icon) for close). In
addition, I need to be able to move it around the screen and resize it.

So far, I am close to finish handlers for icons but resizing and moving my
form might be a problem. (well, moving probably not since Bilal's code
should do that but resizing could be since I have to record that the mouse
is above the form's border, and then allowd user to click it and drag it to
resize the form. never did something like this but I think it should not be
difficult to do it.

Thanks,
 
Thanks Bilal


Bilal said:
you can do something like this ...

Private Sub PictureBox1_MouseUp(ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs) Handles
PictureBox1.MouseUp

Me.Location = New Point(e.X, e.Y)

End Sub

you can modify this in other events, and it will move the
form for you
 
db.24015$o21.21797@edtnps84:

Rather than using the Mouse events, it is better to override the WndProc
sub in the form. Like this:

'\\\\\
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Const WmNcHitTest As Integer = &H84
Const HtCaption As Integer = 2

If m.Msg = WmNcHitTest Then
m.Result = New IntPtr(HtCaption)
Else
MyBase.WndProc(m)
End If

End Sub
'/////

If you click anywhere in the form, you can move it with this code.

Chris
 
Thanks Cris,

Yes, I found similar code actually for moving the form around the screen. I
would actually like to reserach little bit WndProc (honestly, have no idea
what the code is doing) because it looks so cool, simple and the dragging of
the form is so smooth.

Is there a way to do the same to resize the form?

Thank you,
 
Thanks Cris,

Yes, I found similar code actually for moving the form around the
screen. I would actually like to reserach little bit WndProc
(honestly, have no idea what the code is doing) because it looks so
cool, simple and the dragging of the form is so smooth.

Is there a way to do the same to resize the form?

Thank you,

I think all that code does is trick windows into thinking you have clicked
on the form caption instead of the the client area.

There may be a way to do that with the resize event, but I don't know what
it is.

Chris
 
Back
Top