用c# .net compact 编wince界面程序,因为compact版本的控件statusbar的状态栏只支持一个栏,不支持多栏目,而项目实际需要分成5个栏,所以先用API,查了可通过发SB_SETPARTS消息来设置,但小弟新手,不知如何编写,希望各位帮忙,能提供个代码的例子,谢谢!下面为MSDN上关于SB_SETPARTS的描述:
http://msdn.microsoft.com/en-us/library/ms932515.aspx
Send Feedback
This message sets the number of parts in a status window and the coordinate of the right edge of each part.
SB_SETPARTS wParam = (WPARAM) nParts;
lParam = (LPARAM)(LPINT) aWidths;
Parameters
nParts
Number of parts to set (cannot be greater than 255).
aWidths
Address of an integer array that has the same number of elements as parts specified by nParts. Each element in the array specifies the position, in client coordinates, of the right edge of the corresponding part. If an element is –1, the position of the right edge for that part extends to the right edge of the window.
Return Values
TRUE indicates success. FALSE indicates failure.APIC#WinCESB_SETPARTS
http://msdn.microsoft.com/en-us/library/ms932515.aspx
Send Feedback
This message sets the number of parts in a status window and the coordinate of the right edge of each part.
SB_SETPARTS wParam = (WPARAM) nParts;
lParam = (LPARAM)(LPINT) aWidths;
Parameters
nParts
Number of parts to set (cannot be greater than 255).
aWidths
Address of an integer array that has the same number of elements as parts specified by nParts. Each element in the array specifies the position, in client coordinates, of the right edge of the corresponding part. If an element is –1, the position of the right edge for that part extends to the right edge of the window.
Return Values
TRUE indicates success. FALSE indicates failure.APIC#WinCESB_SETPARTS
解决方案 »
- 急!关于线程的小问题
- winform button 点击有时候会点不中是什么原因?
- System.Threading.Timer
- typeof()与Type.GetType()的问题
- C#能不能这样自定义数据类型
- DataGridView和DB4o配合使用的一个问题
- 如何用已知的Color.name给 textbox.backcolor属性赋值。
- 如何利用C#打开一个对话框获取文件夹,就象新建项目时选择文件夹一样(查询得到结果为什么都无法显示?)
- Crystal Report是哪家公司的产品 ? 一般用来做什么 ?
- 请教高手能不能在98下调试ASP.NET,要安装什么软件?给分!
- 中文分词Analyzer
- 百思不得其解——一个很基础的问题,烦请大侠帮忙看看
SendMessage(状态栏句柄, SB_SETPARTS, (WPARAM)3, (LPARAM)(LPINT)&widths[0]);
public static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int[] lParam);
public const int WM_USER = 0x0400;
public const int SB_SETPARTS = WM_USER + 4; //调用
int[] widths = { 150, 300, 400, -1 };
SendMessage(this.statusBar1.Handle, SB_SETPARTS, 3, widths);
修改完,第一栏有按设置宽度显示,但是后面2个栏没有分开显示出来,不知什么原因。
[DllImport("coredll.Dll")]
public static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int[] lParam);
public const int WM_USER = 0x0400;
public const int SB_SETPARTS = WM_USER + 4;int[] widths = { 200, 100, 100, -1 };
SendMessage(this.statusBar1.Handle, SB_SETPARTS, 3, widths);