Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello, I need some help once again:p !

 

It's something very simple...but it don't works.

I want my Form to take all the screen (so you don't see the taskbar). I would like no minimize, maximize, well no control box at all, and I would like a title in the blue bar on the top.

 

For that, it's okay. But now, there's the problem. When you click on the blue bar, you can drag the form and move it. It't not very good for my application.

 

I saw a property <locked>. "Great", I thought. But in TRUE, it's locking anything. You can move the form as you want.

 

I tried to do use sub, which replace the form on the top-left edge of the screen, something like that :

 

   Private Sub myForm_LocationChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.LocationChanged
       Me.Location = New System.Drawing.Point(0, 0)
       Me.DesktopLocation = New System.Drawing.Point(0, 0)
       Me.Left = 0
       Me.Top = 0
       Me.SetDesktopLocation(0, 0)
       Me.SetDesktopBounds(0, 0, 800, 600)
   End Sub

 

...No way, you can move the form by clicking on the blue bar...urps, but why :confused: Is there something I missed ??

 

Thanks for help

  • *Experts*
Posted

You might be able to handle the WndProc and look for the WM_MOVE message and cancel it. I haven't tried it, but it should work. I'm not sure WHY you'd ever want to prevent moving a full screen window but there ya go.

 

-Ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

the Locked property has nothing to do with moving the screen. Locked is used more on text boxes; it's similiar to Enabled; with Locked though things aren't greyed out, you can put the cursor there but you just can't edit what's there.

 

For the movement:

 

(I use C# so forgive the possible syntax errors)

[C#]

this.Bounds = Screen.PrimaryScreen.Bounds

[/C#]

for VB I think it would be:

Me.Bounds = Screen.PrimaryScreen.Bounds

 

You can get rid of all that other code... it's redundant

 

Then on the properties for you Form (or in code) change the

FormBorderStyle to None.

 

Word of advice... put yourself a button on the form that closes the form and make sure you assign the code and test it before doing the changes I mentioned above otherwise you may end up not getting your form to close once you open it other than by doing ctl+alt+del.

 

Brian

Posted

Well, Brian, I think

 

Me.Bounds = Screen.PrimaryScreen.Bounds

 

doesnt exists in VB. It's either location or SetDesktopBounds, but it doesn't work.

 

And a little question for Nerseus. Why is it a strange idea to lock a window ? I just decide to do this on my own, but if it's totally useless, I can drop this idea.

Posted

Me.Bounds should, it's in C# and they both use .NET and the Bounds property is part of the Control namespace (System.Windows.Forms), which you must have to have any forms... and this is the fully qualified name for Screen:

 

System.Windows.Forms.Screen

 

If nothing else Bounds is just a rectangle, do you have a Me.Rectangle?

 

I'll wipe the dust off my VB.NET app and find out for sure tonight and try to remember to get back with you and get it to work for you, and Nerseus, one possible idea is what I use it for - sloppily thrown together games! :)

 

Brian

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...