怎样用window API修改combobox的值
1个回答
展开全部
using System.Runtime.InteropServices;
[DllImport("User32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(
IntPtr hWnd,
int Msg,
int wParam,
int lParam
);
public int CB_SETCURSEL = 334;
private void button1_Click(object sender, EventArgs e)
{
SendMessage(comboBox1.Handle, CB_SETCURSEL, 1, 0);
//或者
comboBox1.SelectedIndex = 1;
}
[DllImport("User32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(
IntPtr hWnd,
int Msg,
int wParam,
int lParam
);
public int CB_SETCURSEL = 334;
private void button1_Click(object sender, EventArgs e)
{
SendMessage(comboBox1.Handle, CB_SETCURSEL, 1, 0);
//或者
comboBox1.SelectedIndex = 1;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询