Thread: scrolling of the window in c language graphics

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    11

    scrolling of the window in c language graphics

    I would like some suggestions and if possible the source code
    for scrolling like the scrolling we usually do in windows.

    I tried my best but i'm unable to do it.

    I making a editor like a notepad in windows with
    C language in graphics mode.So ur help will be most valuable to me.

    Please be fast.
    Last edited by denny; 12-24-2001 at 08:08 AM.

  2. #2
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Look up the syntax of ScrollWindow() for the API. That does what you want. Don't forget to UpdateWindow(hwnd) after though.

    --Garfield
    1978 Silver Anniversary Corvette

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    7

    Question I have this question too!

    I have this question too!
    pleaese answer me!!!
    [email protected]

  4. #4
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    I think that you are talking about a screen mode but if you want to build an application like notepad you need to write a Windows program. Use a Windows Form.

  5. #5
    If you are making a windows program, I think it can be done very easily
    Make an edit box the size of your client area, add a menu with all the features you want and it is done. I’ve never done it and there could be some unforeseen difficulties, but I think this is the main thought.

  6. #6
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Originally posted by maes
    If you are making a windows program, I think it can be done very easily
    Make an edit box the size of your client area, add a menu with all the features you want and it is done. I’ve never done it and there could be some unforeseen difficulties, but I think this is the main thought.
    Sounds good!

    --Garfield
    1978 Silver Anniversary Corvette

  7. #7
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Better control if over text formatting if you use a HDC. Try getting different fonts, line breaks, right or center justification, colours ect in the edit ctrl.

    Use a frame ctrl, get its HWND.
    GetDC() on this HWND and create TWO Compatible HDC's with CreateCompatibleDC(), create two bmp's with CreateCompatibleBitmap(), select them into the HDC's with SelectObject() catching the returnsed BMP's to be replaced (re SelectObject()'ed) on exit, before the created HDC's and BMP's are deleted with DeleteObject()

    One HDC is to do all the drawing on (Buffer or FrameBuffer). Assemble the text, when you have finished copy to the other (ScreenDC). Then call a paint with InvalidateRect()

    The paint function is called in response to a WM_PAINT msg in the callback.
    In the paint call BeginPaint() and BitBlt() the ScreenDC to the DC returned from the BeginPaint().
    Call EndPaint()

    Look at ScrollDC() to do the scrolling.
    Last edited by novacain; 12-27-2001 at 11:07 PM.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  8. #8
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    here's a useful one, though not for scrolling......



    void CenteredTextOut(HDC hdc, int Ycoord, char *string)
    {
    int Xcoord = GetSystemMetrics(SM_CXSCREEN);

    int len = strlen(string);

    SIZE sz;

    GetTextExtentPoint32(hdc, string, len, &sz);

    Xcoord = (Xcoord / 2) - (sz.cx / 2);

    TextOut(hdc, Xcoord, Ycoord, string, len);
    }
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. input/output
    By dogbert234 in forum Windows Programming
    Replies: 11
    Last Post: 01-26-2005, 06:57 AM
  2. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM
  3. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  4. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM
  5. Invoking MSWord
    By Donn in forum C Programming
    Replies: 21
    Last Post: 09-08-2001, 04:08 PM