maskedit 中怎么实现从右到左输入

maskedit 中如何实现从右到左输入
哎,又遇到问题了。
如题。
比如需要输入金额时,一般都需要从右到左的输入。在editmask中设置成9999999999\.99;0;_
好像没有地方设置文字输入时的方向
麻烦这里的高手了^_^

------解决方案--------------------
其实也可以实现这种效果,用一个方框,自己实现输出效果!!还有就是在Edit里面接收的字符加到原来的Caption的左,然后再输出,这样应该可以实现你要的效果了!!
------解决方案--------------------
楼主要的效果比较麻烦,SetWindowLong / ES_RIGHT 只能将Edit中显示的串整体偏右而已。
------解决方案--------------------
C/C++ code

//首先设置为右对齐  一般在From 的 onCreate 事件中

     DWORD dwStyle = GetWindowLong(edt1->Handle,GWL_STYLE);
    dwStyle = dwStyle | ES_RIGHT;   //设为右对齐
                    // ES_LEFT   ES_CENTER
    SetWindowLong(edt1->Handle,GWL_STYLE,dwStyle);
    edt1->Invalidate();
//在编辑框的OnChange事件中加入
    edt1->SelStart = 0;  //RichEdit中先要取当前行,再加上面所有行的总长

------解决方案--------------------
楼主要的效果是不是这样:
用户需要输入:111.99
然后当用户在键盘上输入的时候:文本框的右边依次出现:
1
11
111
111.
111.9
111.99

如果是这样的话,像3楼那样设置成又对齐就可以啦??
------解决方案--------------------
我刚用 BCB6 试了一下,3楼的方法完全正确,楼主可以结贴了。。
------解决方案--------------------
我就知道有人会贴SetWindowLong / ES_RIGHT 的代码,所以提前在2楼说过了,这样出来的效果不符合楼主的需求。
------解决方案--------------------
还是换成TEdit吧. TMaskEidt不好控制(内部已经做了大量的控制代码)。 

OnKeyPress事件中

Key = '0';
Edit1.Text = Edit1.Text + Key;
------解决方案--------------------
用3方控件咯,楼主搜一下MeneyEdit 之类的就能搜到了
------解决方案--------------------
不知道LZ有没装raize控件,用RZMaskEdit 只需将Alignment属性设为 taRightJustify 就OK了。轻松搞定。
------解决方案--------------------
探讨
不知道LZ有没装raize控件,用RZMaskEdit 只需将Alignment属性设为 taRightJustify 就OK了。轻松搞定。

------解决方案--------------------
C/C++ code

#ifndef uEagleNumericEditH
#define uEagleNumericEditH
//---------------------------------------
#include <SysUtils.hpp>
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
//---------------------------------------
class PACKAGE TEagleNumericEdit : public TEdit
{
private:
    char FDecimalPoint;
    int FDecimalDigits;
protected:
    int m_DecimalPointPos;
    void __fastcall SetDecimalPoint(char Value);
    void __fastcall SetDecimalDigits(int Value);
    virtual BOOL __fastcall IsValidChar(char Key);
    DYNAMIC void __fastcall KeyPress(char &Key);
    //void __fastcall KeyPress(char &Key);
public:
    __fastcall TEagleNumericEdit(TComponent* Owner);
    void __fastcall CreateParams(TCreateParams &Params);
__published:
    // 小数点符号
    __property char DecimalPoint = {read = FDecimalPoint, write = SetDecimalPoint, default = '.'};
    // 小数位数
    __property int DecimalDigits = {read = FDecimalDigits, write = SetDecimalDigits, default = 2};
};
//---------------------------------------
#endif


.cpp 文件

#include <vcl.h>

#pragma hdrstop

#include "uEagleNumericEdit.h"
#pragma package(smart_init)
//---------------------------------------
// ValidCtrCheck is used to assure that the components created do not have
// any pure virtual functions.
//

static inline void ValidCtrCheck(TEagleNumericEdit *)
{
    new TEagleNumericEdit(NULL);
}
//---------------------------------------
__fastcall TEagleNumericEdit::TEagleNumericEdit(TComponent* Owner)
    : TEdit(Owner)
{
    FDecimalPoint = '.';
    FDecimalDigits = 2;
    Text = "";
}
//---------------------------------------
namespace Ueaglenumericedit
{
    void __fastcall PACKAGE Register()
    {
         TComponentClass classes[1] = {__classid(TEagleNumericEdit)};
         RegisterComponents("Standard", classes, 0);
    }
}
//---------------------------------------
void __fastcall TEagleNumericEdit::CreateParams(TCreateParams &Params)
{
    TEdit::CreateParams(Params);
    Params.Style |= ES_RIGHT;
}
//---------------------------------------
void __fastcall TEagleNumericEdit::SetDecimalPoint(char Value)
{
    if ( FDecimalPoint != Value )
    {
        FDecimalPoint = Value;
    }
}
//---------------------------------------
BOOL __fastcall TEagleNumericEdit::IsValidChar(char Key)
{
    BOOL blValid            = FALSE;

    switch ( Key )
    {
        case '+' :
            //break;
        case '-' :
            if ( SelStart == 0 )
            {
                blValid = TRUE;
                if ( Text.Length() > 0 && (Text[1] == '+' || Text[1] == '-') )
                {
                    blValid = FALSE;
                }
            }
            else if ( SelLength == Text.Length() )
            {
                blValid = TRUE;
            }
            break;
        case 'E' :
            //break;
        case 'e' :
            //break;
        case VK_RETURN :
            blValid = TRUE;
            break;
        case VK_BACK :
            blValid = TRUE;
            if ( m_DecimalPointPos > 0 )
            {
                m_DecimalPointPos = AnsiPos(FDecimalPoint, Text);
                MaxLength = m_DecimalPointPos == 0 ? 0 : MaxLength;
            }
            break;
        default :
            break;
    }

    if ( !blValid )
    {
        if ( Key >= '0' && Key <= '9' )
        {
            blValid = TRUE;
            if ( SelStart == 0 && SelLength != Text.Length() &&
                 (Text[1] == '+' || Text[1] == '-') )
            {
                blValid = FALSE;
            }
        }
        else if ( Key == DecimalPoint )
        {
            m_DecimalPointPos = AnsiPos(Key, Text);
            blValid = m_DecimalPointPos == 0;
            if ( blValid )
            {
                m_DecimalPointPos = Text.Length();
                MaxLength = Text.Length() + FDecimalDigits + 1;
            }
        }
    }

    if ( blValid && Key != FDecimalPoint )
    {
        if ( Text.Length() == 0 || SelLength == Text.Length() )
        {
            m_DecimalPointPos = 0;
            MaxLength = 0;
        }
        else
        {
            if ( m_DecimalPointPos > 0 )
            {
                String s1;

                m_DecimalPointPos = AnsiPos(FDecimalPoint, Text);
                if ( m_DecimalPointPos > 0 )
                {
                    s1 = Text.SubString(m_DecimalPointPos + 1, Text.Length() - m_DecimalPointPos);
                    if ( s1.Length() >= FDecimalDigits )
                    {
                        blValid = SelStart < m_DecimalPointPos;
                    }
                }
            }
        }
    }

    return blValid;
}
//---------------------------------------
void __fastcall TEagleNumericEdit::KeyPress(char &Key)
{
    if ( IsValidChar(Key) )
    {
        TEdit::KeyPress(Key);
    }
    else
    {
        Key = 0;
    }
}
//---------------------------------------
void __fastcall TEagleNumericEdit::SetDecimalDigits(int Value)
{
    FDecimalDigits = Value;
}
//---------------------------------------


// 说明 : 
// 源代码是一个组件, 可以直接复制使用
// 设置一下小数位数与小数点符号就可以了(默认的是小数位=2, 小数点符号='.'