Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. modify style window

modify style window

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
9 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jeremysay
    wrote on last edited by
    #1

    hello, How can i modify style of child window, i use

    pChild->ModifyStyle(0,WS_THICKFRAME,SWP_NOMOVE | SWP_NOSIZE  );
    

    but the window haven't resizable border. you know how to do this ? thx in advance

    Z 1 Reply Last reply
    0
    • J jeremysay

      hello, How can i modify style of child window, i use

      pChild->ModifyStyle(0,WS_THICKFRAME,SWP_NOMOVE | SWP_NOSIZE  );
      

      but the window haven't resizable border. you know how to do this ? thx in advance

      Z Offline
      Z Offline
      Zdeslav Vojkovic
      wrote on last edited by
      #2

      does the window have WS_DLGFRAME style also? if it does, i think you will have to remove it. some window styles cannot be used together. also, for some styles you have to call SetWindowPos() after ModifyStyle(), to make them active (IIRC, ES_READONLY for edit controls ,etc)

      J 1 Reply Last reply
      0
      • Z Zdeslav Vojkovic

        does the window have WS_DLGFRAME style also? if it does, i think you will have to remove it. some window styles cannot be used together. also, for some styles you have to call SetWindowPos() after ModifyStyle(), to make them active (IIRC, ES_READONLY for edit controls ,etc)

        J Offline
        J Offline
        jeremysay
        wrote on last edited by
        #3

        thx Zed my window doesn't have WS_DLGFRAME. I have a little problem with SetWindowPos() : pChild->SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER); after SetWindowPos my window has resizable borders, but i put the flags SWP_NOMOVE but my view move and it does not remain where it was. So i would like to get border without call SetWindowPosit isn't posible ?:confused:

        Z 1 Reply Last reply
        0
        • J jeremysay

          thx Zed my window doesn't have WS_DLGFRAME. I have a little problem with SetWindowPos() : pChild->SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER); after SetWindowPos my window has resizable borders, but i put the flags SWP_NOMOVE but my view move and it does not remain where it was. So i would like to get border without call SetWindowPosit isn't posible ?:confused:

          Z Offline
          Z Offline
          Zdeslav Vojkovic
          wrote on last edited by
          #4

          jeremysay wrote: So i would like to get border without call SetWindowPosit isn't posible ? i'm not sure the problem is that SWP_FRAMECHANGED flags resulst in WM_NCCALCSIZE being sent to window, which forces the window to change its size. maybe you can add SWP_NOREDRAW flag which will defer repainting, and then call MoveWindow() to resize the window to its previous size. i'm not sure if this will work, but you can try

          J 1 Reply Last reply
          0
          • Z Zdeslav Vojkovic

            jeremysay wrote: So i would like to get border without call SetWindowPosit isn't posible ? i'm not sure the problem is that SWP_FRAMECHANGED flags resulst in WM_NCCALCSIZE being sent to window, which forces the window to change its size. maybe you can add SWP_NOREDRAW flag which will defer repainting, and then call MoveWindow() to resize the window to its previous size. i'm not sure if this will work, but you can try

            J Offline
            J Offline
            jeremysay
            wrote on last edited by
            #5

            thx Zed for your help ! Zed wrote: maybe you can add SWP_NOREDRAW flag which will defer repainting, and then call MoveWindow() to resize the window to its previous size. i'm not sure if this will work, but you can try before call ModifyStyle ,i moved the view with ScrollWindow, there is a possibility to get "window scrolling" position (and not use GetScrollPos for scrollbar) ? thx again Zed

            Z 1 Reply Last reply
            0
            • J jeremysay

              thx Zed for your help ! Zed wrote: maybe you can add SWP_NOREDRAW flag which will defer repainting, and then call MoveWindow() to resize the window to its previous size. i'm not sure if this will work, but you can try before call ModifyStyle ,i moved the view with ScrollWindow, there is a possibility to get "window scrolling" position (and not use GetScrollPos for scrollbar) ? thx again Zed

              Z Offline
              Z Offline
              Zdeslav Vojkovic
              wrote on last edited by
              #6

              GetScrollInfo(), but i'm not quiter sure what are you trying to achieve. can you post some more details?

              J 1 Reply Last reply
              0
              • Z Zdeslav Vojkovic

                GetScrollInfo(), but i'm not quiter sure what are you trying to achieve. can you post some more details?

                J Offline
                J Offline
                jeremysay
                wrote on last edited by
                #7

                in fact i scroll the view without use the scrollbar. when i click in the view and move my mouse i do :

                if (pMsg->message == WM_MOUSEMOVE)  )
                {
                	if (pMsg->wParam & VK_LBUTTON)
                	{
                		POINT Point = pMsg->pt;
                		long ScrollX = Point.x - m_Point.x;
                		long ScrollY = Point.y - m_Point.y;
                		ScrollWindow(-ScrollX,-ScrollY);
                                m_pPoint = Point
                         }
                }
                

                so i move my view and i don't know really its coordinates. when i use :

                pChild->SetWindowPos(NULL, 0, 0, 0, 0,SWP_FRAMECHANGED |
                				SWP_NOMOVE | SWP_NOSIZE |
                				SWP_NOZORDER);
                

                my view loose its scrolling, so i want to know its coordinate before SetWindowPos. Or get a way to put the sizable border without use SetWindowPos. have you any idea ?

                Z 1 Reply Last reply
                0
                • J jeremysay

                  in fact i scroll the view without use the scrollbar. when i click in the view and move my mouse i do :

                  if (pMsg->message == WM_MOUSEMOVE)  )
                  {
                  	if (pMsg->wParam & VK_LBUTTON)
                  	{
                  		POINT Point = pMsg->pt;
                  		long ScrollX = Point.x - m_Point.x;
                  		long ScrollY = Point.y - m_Point.y;
                  		ScrollWindow(-ScrollX,-ScrollY);
                                  m_pPoint = Point
                           }
                  }
                  

                  so i move my view and i don't know really its coordinates. when i use :

                  pChild->SetWindowPos(NULL, 0, 0, 0, 0,SWP_FRAMECHANGED |
                  				SWP_NOMOVE | SWP_NOSIZE |
                  				SWP_NOZORDER);
                  

                  my view loose its scrolling, so i want to know its coordinate before SetWindowPos. Or get a way to put the sizable border without use SetWindowPos. have you any idea ?

                  Z Offline
                  Z Offline
                  Zdeslav Vojkovic
                  wrote on last edited by
                  #8

                  i'm not sure if i correctly understood the relationship between the view and pChild. is that the same window or are they parent-child? if the view is scrolled only from your code, maybe you can accumulate ScrollX and ScrollY in every WM_MOUSEMOVE handler call and thus have the total ammount by which the view was scrolled, so you can use that (i'm just guessing here).

                  J 1 Reply Last reply
                  0
                  • Z Zdeslav Vojkovic

                    i'm not sure if i correctly understood the relationship between the view and pChild. is that the same window or are they parent-child? if the view is scrolled only from your code, maybe you can accumulate ScrollX and ScrollY in every WM_MOUSEMOVE handler call and thus have the total ammount by which the view was scrolled, so you can use that (i'm just guessing here).

                    J Offline
                    J Offline
                    jeremysay
                    wrote on last edited by
                    #9

                    Zed wrote: is that the same window or are they parent-child? pChild is the parent child. Zed wrote: if the view is scrolled only from your code, maybe you can accumulate ScrollX and ScrollY in every WM_MOUSEMOVE handler call and thus have the total ammount by which the view was scrolled, so you can use that (i'm just guessing here). OK thx, i'll go to do this, i hoped there was a "function" like GetScrollWindow"....but no. thx Zed for you help!

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups