C# と VB.NET の質問掲示板

ASP.NET、C++/CLI、Java 何でもどうぞ

ログ内検索
  • キーワードを複数指定する場合は 半角スペース で区切ってください。
  • 検索条件は、(AND)=[A かつ B] (OR)=[A または B] となっています。
  • [返信]をクリックすると返信ページへ移動します。
キーワード/ 検索条件 /
検索範囲/ 強調表示/ ON (自動リンクOFF)
結果表示件数/ 記事No検索/ ON
大文字と小文字を区別する

No.55806 の関連記事表示

<< 0 >>
■55806  Re[2]: コンボボックスの表示テキスト位置を設定したい
□投稿者/ マサヤ -(2010/12/14(Tue) 18:03:17)
    C#だとこれであってますか?
    [StructLayout(LayoutKind.Sequential)]
            private class comboBoxInfo
            {
                public int Size;
                public Rectangle RectItem;
                public Rectangle RectButton;
                public int ButtonState;
                public IntPtr ComboBoxHandle;
                public IntPtr EditBoxHandle;
                public IntPtr ListBoxHandle;
                public void New()
                {
                    this.Size = Marshal.SizeOf(this);
                }
            }
            [DllImport("user32.dll")]
            private extern static bool GetComboBoxInfo(IntPtr hwindCombo, comboBoxInfo cbi);
            [DllImport("user32.dll")]
            private extern static int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
            [DllImport("user32.dll")]
            private extern static int GetWindowLong(IntPtr hWnd, int nIndex);
            private const int GWL_STYLE = -16;
            private const int ES_RIGHT = -8;
    
            private void SetRightAlign(ComboBox combo)
            {
                comboBoxInfo ci = new comboBoxInfo();
                if(!GetComboBoxInfo(combo.Handle, ci))
                {
                    return;
                }
                if (ci.EditBoxHandle == IntPtr.Zero)
                {
                    return;
                }
                int style = GetWindowLong(ci.EditBoxHandle, GWL_STYLE);
                SetWindowLong(ci.EditBoxHandle, GWL_STYLE, style); 
            }
    
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                SetRightAlign(comboBox1);
            }
記事No.55792 のレス /過去ログ93より / 関連記事表示
削除チェック/



<< 0 >>

パスワード/

- Child Tree -