Mirage Source http://web.miragesource.net/forums/ |
|
Borderstyle.. http://web.miragesource.net/forums/viewtopic.php?f=201&t=246 |
Page 1 of 1 |
Author: | Matt [ Wed Jul 05, 2006 7:26 pm ] |
Post subject: | Borderstyle.. |
Shouldn't this work? frmMain.BorderStyle = 2 If I call that in a form load or something? Cause, it won't. No border when the form loads. (Note: The form is set to have no border.) |
Author: | Robin [ Thu Jul 06, 2006 6:56 am ] |
Post subject: | |
Heh. I tried that so that people who turn fullscreen off don't have a border, but it didn't work for me either |
Author: | Minatours [ Thu Jul 06, 2006 9:15 am ] |
Post subject: | |
The borderstyle property is read only at run time so you cant change it that easily. I searched and found a sample project Change_BorderStyle_Demo.zip, might help abit. The website is here. |
Author: | Dr. Spoon [ Thu Jul 06, 2006 1:15 pm ] |
Post subject: | |
we have obtained a working module for this.. which i have personally tested it seems to be in proper order and does exactly what we want it to do if advocate doesn't mind i can post a link to the simple module here just to share it.. |
Author: | GodSentDeath [ Thu Jul 06, 2006 8:01 pm ] |
Post subject: | |
Using the code Minatours posted I managed to change the code to allow changing between Borderstyle 1-5 without problems. Put this code into any module: Code: Option Explicit Private Const GWL_STYLE As Long = (-16&) Private Const GWL_EXSTYLE As Long = (-20&) Private Const WS_THICKFRAME As Long = &H40000 Private Const WS_MINIMIZEBOX As Long = &H20000 Private Const WS_MAXIMIZEBOX As Long = &H10000 Private Const WS_EX_TOOLWINDOW As Long = &H80& Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd&, ByVal nIndex&) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd&, ByVal nIndex&, ByVal dwNewLong&) As Long ' SetWindowPos Flags Private Const SWP_NOSIZE = &H1 Private Const SWP_NOMOVE = &H2 Private Const SWP_NOZORDER = &H4 Private Const SWP_NOREDRAW = &H8 Private Const SWP_NOACTIVATE = &H10 Private Const SWP_FRAMECHANGED = &H20 ' The frame changed: send WM_NCCALCSIZE Private Const SWP_SHOWWINDOW = &H40 Private Const SWP_HIDEWINDOW = &H80 Private Const SWP_NOCOPYBITS = &H100 Private Const SWP_NOOWNERZORDER = &H200 ' Don't do owner Z ordering Private Const SWP_DRAWFRAME = SWP_FRAMECHANGED Private Const SWP_NOREPOSITION = SWP_NOOWNERZORDER ' SetWindowPos() hwndInsertAfter values Private Const HWND_TOP = 0 Private Const HWND_BOTTOM = 1 Private Const HWND_TOPMOST = -1 Private Const HWND_NOTOPMOST = -2 Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd&, ByVal hWndInsertAfter&, ByVal x&, ByVal y&, ByVal cx&, ByVal cy&, ByVal wFlags&) As Long Public Sub ChangeBorderStyle(TheForm As Form, Style As Byte) Dim bToggleStyle As Boolean, bToggleExStyle As Boolean, cStyle As Byte 'This makes sure the selected style is within acceptable range If Style > 5 Or Style < 0 Then Style = TheForm.BorderStyle cStyle = TheForm.BorderStyle TheForm.BorderStyle = Style 'Checks the current BorderStyle and changes the variables to comply with selected style If Style = 0 Then 'Don't know yet >_>... ElseIf Style = 1 Then If cStyle = 2 Then bToggleStyle = True ElseIf cStyle = 3 Then bToggleStyle = False ElseIf cStyle = 4 Then bToggleExStyle = True ElseIf cStyle = 5 Then bToggleStyle = True bToggleExStyle = True End If ElseIf Style = 2 Then If cStyle = 1 Then bToggleStyle = True bToggleExStyle = False ElseIf cStyle = 3 Then bToggleStyle = True ElseIf cStyle = 4 Then bToggleStyle = True bToggleExStyle = True ElseIf cStyle = 5 Then bToggleStyle = False bToggleExStyle = True End If ElseIf Style = 3 Then If cStyle = 1 Then bToggleStyle = False ElseIf cStyle = 2 Then bToggleStyle = True ElseIf cStyle = 4 Then bToggleExStyle = True ElseIf cStyle = 5 Then bToggleStyle = True bToggleExStyle = True End If ElseIf Style = 4 Then If cStyle = 1 Then bToggleExStyle = True ElseIf cStyle = 2 Then bToggleStyle = True bToggleExStyle = True ElseIf cStyle = 3 Then bToggleExStyle = True ElseIf cStyle = 5 Then bToggleStyle = True bToggleExStyle = False End If Else If cStyle = 1 Then bToggleStyle = True bToggleExStyle = True ElseIf cStyle = 2 Then bToggleExStyle = True ElseIf cStyle = 3 Then bToggleStyle = True bToggleExStyle = True ElseIf cStyle = 4 Then bToggleStyle = True bToggleExStyle = False End If End If If bToggleStyle Then 'Toggles between Fixed and Sizeable Call SetWindowLong(TheForm.hWnd, GWL_STYLE, GetWindowLong(TheForm.hWnd, GWL_STYLE) Xor (WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX)) End If If bToggleExStyle Then 'Toggles between ToolWindow and Regular Window Call SetWindowLong(TheForm.hWnd, GWL_EXSTYLE, GetWindowLong(TheForm.hWnd, GWL_EXSTYLE) Xor WS_EX_TOOLWINDOW) End If Call SetWindowPos(TheForm.hWnd, 0&, 0&, 0&, 0&, 0&, SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOZORDER Or SWP_FRAMECHANGED) End Sub Example of using this code: Code: ChangeBorderStyle frmChangeBorderStyle, 1
frmChangeBorderStyle is the form that I'm changing the Border Style. 1 is the style number. Probably not the best way or code, but it works |
Author: | Minatours [ Fri Jul 07, 2006 9:13 pm ] |
Post subject: | |
Ace, knew someone would use it |
Author: | Misunderstood [ Sat Jul 08, 2006 12:00 am ] |
Post subject: | |
Why do you want to do this? |
Author: | Tosuxo [ Sat Jul 08, 2006 12:06 am ] |
Post subject: | |
Misunderstood wrote: Why do you want to do this?
ahhh but the real question is.... "why not?" |
Author: | Misunderstood [ Sat Jul 08, 2006 12:14 am ] |
Post subject: | |
... |
Author: | Matt [ Sat Jul 08, 2006 12:58 am ] |
Post subject: | |
We want to add the border back when a player chooses windowed mode, you seen how it was when I sent you the client. Lol. It's annoying not being able to move the client around. |
Author: | Misunderstood [ Sat Jul 08, 2006 1:19 am ] |
Post subject: | |
there are other ways to move the client around, you just need to implement an api. |
Author: | Matt [ Sat Jul 08, 2006 2:05 am ] |
Post subject: | |
We'd rather have the default border. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |