CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: WindowsTextBox

  1. #1
    Join Date
    Apr 1999
    Posts
    6

    WindowsTextBox

    Well I got my Calculator all running in win-32 format. The only problem I want to fix is how to set the text to be right-justified? It's automatically left-justified. And since this is in C, it's not easily shown. Someone mentioned 'ED_RIGHTJUSTIFY', but we're not sure.
    Also at the moment all my numbers are floats. when they are shown it might be like 80.0000 is there a way to truncated the extra zeros, so that each time if there are extra 0's?


  2. #2
    Join Date
    May 1999
    Posts
    318

    Re: WindowsTextBox

    I you are using a studio you have just to change the property

    Hovewer the alignment property is one of the styles of a window.
    To change it use the next example :

    DWORD style;
    style = GetWindowLong(hWnd, GWL_STYLE);
    style = style | ES_RIGHT ;
    SetLastError(0);
    SetWindowLong(hWnd, GWL_STYLE, style);

    Concerning the lead zeros of your float number I am not sure to understand your problem.
    But try to use the sprintf C function to first format your number in a string and then send the string to the text box.

    Example :
    char string[10];
    float number=80f;
    sprintf(string,"%0.02f",mynumber);
    SetWindowText(textHwnd,string);



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

Featured