Q&A

  • 콤보박스 폭조정,그리드 금액 천단위구분콤마
콤포넌트가 아니라 소스로 구현하고 싶습니다.

콤보박스의 크기는 작게 고정시키고

드롭다운시 아이템의 길이에 맞춰 폭 늘리는법.

그리드에서 숫자입력시 숫자 하나하나 입력이

일어날때 마다 콤마를 찍어주는 법.

아시는 분 빨랑 보시고

가르쳐주세요





1  COMMENTS
  • Profile
    톰과 제리 2000.07.01 07:51
    콤보박스 폭조정 마루탑니다.

    그럼..

    function TForm1.GetTextWidth(S: String): Integer;

    begin

    Result := Canvas.TextWidth(s);

    end;



    procedure TForm1.AdjustDropDownWidth;

    var

    i, ItemWidth: Integer;

    begin

    ItemWidth := 0;

    for i := 0 to ComboBox1.Items.Count - 1 do

    if GetTextWidth(ComboBox1.Items[i]) > ItemWidth then

    ItemWidth := GetTextWidth(ComboBox1.Items[i]) + 8;

    ComboBox1.Perform(CB_SETDROPPEDWIDTH, ItemWidth, 0);

    end;



    procedure TForm1.Button1Click(Sender: TObject);

    begin

    ComboBox1.Items.Add(Edit1.Text);

    AdjustDropDownWidth;

    end;



    질문자 wrote:

    > 콤포넌트가 아니라 소스로 구현하고 싶습니다.

    > 콤보박스의 크기는 작게 고정시키고

    > 드롭다운시 아이템의 길이에 맞춰 폭 늘리는법.

    > 그리드에서 숫자입력시 숫자 하나하나 입력이

    > 일어날때 마다 콤마를 찍어주는 법.

    > 아시는 분 빨랑 보시고

    > 가르쳐주세요

    >

    >