Results 1 to 5 of 5

Thread: [RESOLVED] FormBorderStyle <> Extyles/Styles

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    629

    Resolved [RESOLVED] FormBorderStyle <> Extyles/Styles

    In my window class I want to keep things simple, and instead of setting (ex)style flags I want to add a "FormBorderStyle" property.
    These are the (Ex)Style enumerations:
    Code:
        Public Enum Styles As Long
            ControlBox = &H80000L
            MinimizeBox = &H20000L
            MaximizeBox = &H10000L
            Sizable = THICKFRAME
            Border = &H800000L
            Caption = &HC00000L
            Visible = &H10000000L
            Disabled = &H8000000L
            Child = &H40000000L
            VScrollBar = &H200000L
            HScrollBar = &H100000L
            TabStop = &H10000L
            Group = &H20000L
            ClipSiblings = &H4000000L
            ClipChildren = &H2000000L
            ThickFrame = &H40000L
            DialogFrame = &H400000L
    
            'initial start state
            Minimize = &H20000000L
            Maximize = &H1000000L
    
            Overlapped = &H0L
            Tiled = Overlapped
            OverlappedWindow = (Overlapped Or Caption Or Styles.ControlBox Or ThickFrame Or MinimizeBox Or MaximizeBox)
            TiledWindow = OverlappedWindow
    
            PopUp = &H80000000L
            PopUpWindow = (PopUp Or Border Or Styles.ControlBox)
        End Enum
        Public Enum ExStyles As Long
            AllowDrop = &H10L
            TopMost = &H8L
            Layered = &H80000
            Composited = &H2000000L
            NoActivate = &H8000000L
            NoInheritLayout = &H100000L
            NoParentNotify = &H4L
            ToolWindow = &H80L
            MDIChild = &H40L
            Transparent = &H20L
            WindowEdge = &H100L
            ClientEdge = &H200L
            HelpButton = &H400L
            LayoutReversed = &H400000L
            DialogModalFrame = &H1L
        End Enum
    What flags are set for, for example, FormBorderStyle.FixedSingle, Fixed3D, FixedDialog etc. I first tried by displaying the flags of an already known window, but when I set these flags it doesn't change the window to the state.

    Any help greatly appreciated.

  2. #2
    PowerPoster SJWhiteley's Avatar
    Join Date
    Feb 2009
    Location
    South of the Mason-Dixon Line
    Posts
    2,256

    Re: FormBorderStyle <> Extyles/Styles

    I Believe the whole form will need to be created from scratch; you cannot simply apply a new style. That is, the style of window is only examined on construction of the form.
    "Ok, my response to that is pending a Google search" - Bucky Katt.
    "There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
    "Before you can 'think outside the box' you need to understand where the box is."

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    629

    Re: FormBorderStyle <> Extyles/Styles

    I can change the window to a tool window and change the display of mi/maximizeboxes in an already initialized program. Also, I can always use "Redraw" to update the entire screen. Why wouldn't it be possible to change it after it is initialized?

    Although, when I set everything to none the window does act weird and draws a dark-grey-like rectangle around the edges of where the default style should be.

  4. #4
    PowerPoster SJWhiteley's Avatar
    Join Date
    Feb 2009
    Location
    South of the Mason-Dixon Line
    Posts
    2,256

    Re: FormBorderStyle <> Extyles/Styles

    My comment comes from using C and C++ to build windows forms applications (ugh) and from using VB6 and win32 API calls. Things may have changed, or APIs extended to do what you want.

    I recall that some form styles could only be made without rebuilding the form from scratch (min/max buttons for example, as you have found, since they are rendered within the form) but the actual style of the frame could not.

    There may be a way around this, I'm not sure. Perhaps WPF forms uses a different rendering than the base Forms API: this may get you the effect you want.
    "Ok, my response to that is pending a Google search" - Bucky Katt.
    "There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
    "Before you can 'think outside the box' you need to understand where the box is."

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    629

    Re: FormBorderStyle <> Extyles/Styles

    Thanks for the reply. I can understand that a program can not simply change all the behaviour, look and "logic" of a window using a few style changes. I'll just keep these Exstyle and Style properties as it is, and will keep the FormBorderStyle property in the back of my head as a thing to come back to.

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