Button border remove
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 25

Thread: Button border remove

  1. #1
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Button border remove

    i want to remove DialogBox Button's border without OwnerDraw. Im using Win32 not MFC. Please guide how to do it.

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Button border remove

    You want to remove the border of the buttons on a dialog box? Or you want to remove the border of a dialog box? I'm a little bit confused here.

    Without owner draw, you could try to use the BS_FLAT style, but it might still have a border.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: Button border remove

    I need to remove button border in dialogbox.

  4. #4
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: Button border remove

    Any one??

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,013

    Re: Button border remove

    Quote Originally Posted by hypheni View Post
    Any one??
    You didn't answer on this question:
    Quote Originally Posted by cilu View Post
    You want to remove the border of the buttons on a dialog box? Or you want to remove the border of a dialog box? I'm a little bit confused here.
    So, again:
    to remove border of the button in dialogbox
    or
    to remove border of the dialogbox?
    Victor Nijegorodov

  6. #6
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: Button border remove

    why you guys are so confused.. its clearly written in the title that "Button border remove".. so what does this means... i want to remove button borders within dialog box

  7. #7
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Button border remove

    Code:
    CWnd::ModifyStyle (WS_BORDER, 0);

  8. #8
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: Button border remove

    This is a MFC code. How to apply this in Win32 coding..

  9. #9
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Button border remove

    You can use GetWindowLong() and SetWindowLong().
    Code:
    DWORD styles = ::GetWindowLong(hWnd, GWL_STYLE);
    styles &= ~WS_BORDER;
    ::SetWindowLong(hWnd, GWL_STYLE, styles);
    I'm not sure this is going to work though. But on the other hand, I never tried it.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  10. #10
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: Button border remove

    No.. no use

  11. #11
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,013

    Re: Button border remove

    Quote Originally Posted by hypheni View Post
    No.. no use

    Could you translate it?
    Victor Nijegorodov

  12. #12
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: Button border remove

    The code posted by Cilu did not serve my purpose. I need to remove Button border within a dialogbox without using owner draw..

  13. #13
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,013

    Re: Button border remove

    Use Spy++ to find out this button styles. Then try to remove all styles that could cause any type of the border (use the code similar to what cilu posted)
    Victor Nijegorodov

  14. #14
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Button border remove

    Cilu's code has nothing to do with ownerdraw or not. It simply changes a windowstyle. Below you see the MFC implementation. It's allmost the same. And this code has also nothing to do with ownerdraw.
    Code:
    AFX_STATIC BOOL AFXAPI _AfxModifyStyle(HWND hWnd, int nStyleOffset,
    	DWORD dwRemove, DWORD dwAdd, UINT nFlags)
    {
    	ASSERT(hWnd != NULL);
    	DWORD dwStyle = ::GetWindowLong(hWnd, nStyleOffset);
    	DWORD dwNewStyle = (dwStyle & ~dwRemove) | dwAdd;
    	if (dwStyle == dwNewStyle)
    		return FALSE;
    
    	::SetWindowLong(hWnd, nStyleOffset, dwNewStyle);
    	if (nFlags != 0)
    	{
    		::SetWindowPos(hWnd, NULL, 0, 0, 0, 0,
    			SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | nFlags);
    	}
    	return TRUE;
    }

  15. #15
    Join Date
    Jul 2009
    Location
    India
    Posts
    835

    Re: Button border remove

    Just checked in spy++.. there is no style dealing with button border..

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center