It's OK, Thanks lot! ^|^
wangier
Posts
-
how to reject the invalid row adding to datatable? -
how to reject the invalid row adding to datatable?I did that. And I throw a ErrorDataRowException which inherits from Application in the data table's RowChanging event. But when the ErrorDataRowException is thrown, the application didnot enter the method UnHandledExceptionHandler. Instead, the application still popup an window in which told me there is an unhandled exception. why? pls help me. [STAThread] static void Main() { AppDomain currentAppDomain = AppDomain.CurrentDomain; currentAppDomain.UnhandledException += new UnhandledExceptionEventHandler(UnHandledExceptionHandler); FormRegisterConsole fmMain = new FormRegisterConsole(); Application.Run(fmMain); } private static void UnHandledExceptionHandler(object sender, UnhandledExceptionEventArgs args) { Exception e = (Exception) args.ExceptionObject; if (e.GetType() == typeof(Health.ApplicationLibrary.RIS.Register.ErrorDataRowException)) { MessageBox.Show(e.Message, "data updating", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("出现未处理错误: " + e.Message, "未处理错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
-
how to prevent changing columns' width in datagrid?thanks!
-
how to reject the invalid row adding to datatable?But if I don't throw the exception in RowChaging event, i can't prevent the new row to be added to the data table. Or some way to do that?
-
how to reject the invalid row adding to datatable?dataTable1.RowChaging += new DataRowChangeEventHandler(dataTable1_rowChaing) private void dataTable1_RowChanging(object sender, DataRowChangeEventArgs e) { if ( e.Action == DataRowAction.Add ) { if (...) throw new ApplicationException("不合法的检查项目!"); } } ------------ the problem is : this dataTable is associated to a datagrid, when add a new row through the datagrid, the rowchanging event can be trigered. If the row is invalid, the exception will be throwed, and the new row cannot be added to the dataTable1. But when should I handle this Exception? I can't catch this exception.
-
how to prevent changing columns' width in datagrid?how to prevent changing columns' width in datagrid?
-
how to get the indexes of selected items in DataGrid?The DataGrid support multi-selection operations. But when I have multi-selected some rows, How can I determine which rows have been selected?
-
How can I get graphics through message WM_NCPAINT ?I found that there is not difference between
WndProc
andDefWndProc
. Sometimes theWM_NCPAINT
'swParam
is 1. In this case, it will not be successful to create aRegion
. I found the graphics retrived not the same betweenIntPtr hdc = GetWindowDC(m.HWnd) Graphics g = Graphics.FromHDC(hdc)
andGraphics g = Graphics.FromHWnd(hdc)
-
Painting the title barPlease check following codes, it dosen'g work properly, the title bar is still empty. ( the method PanitNonClientArea(Graphics, RectangleF) can work properly. )
protected override void WndProc(ref Message m) { Graphics g; RectangleF rectf; Point pt; switch (m.Msg) { case WMConsts.WM_NCPAINT : IntPtr hrgn = m.WParam; if ( hrgn != (IntPtr)1 ) { Region rgn = Region.FromHrgn(hrgn); g = CreateGraphics(); rectf = rgn.GetBounds(g); PaintNonClientArea(g, rectf); } else { g = CreateGraphics(); rectf = new RectangleF(0,-23, Width, 23); PaintNonClientArea(g, rectf); g.Dispose(); } //base.WndProc(ref m); break; default : base.WndProc (ref m); break; } }
-
How can I get graphics through message WM_NCPAINT ?Please check following codes, it dosen'g work properly, the title bar is still empty. ( the method PanitNonClientArea(Graphics, RectangleF) can work properly. )
protected override void WndProc(ref Message m) { Graphics g; RectangleF rectf; Point pt; switch (m.Msg) { case WMConsts.WM_NCPAINT : IntPtr hrgn = m.WParam; if ( hrgn != (IntPtr)1 ) { Region rgn = Region.FromHrgn(hrgn); g = CreateGraphics(); rectf = rgn.GetBounds(g); PaintNonClientArea(g, rectf); } else { g = CreateGraphics(); rectf = new RectangleF(0,-23, Width, 23); PaintNonClientArea(g, rectf); g.Dispose(); } //base.WndProc(ref m); break; default : base.WndProc (ref m); break; } }
-
How can I get graphics through message WM_NCPAINT ?I found the graphics using Control.CreateGraphics only contains the client area, not contains the title bar.
-
How to get title bar's graphics or its retangle?I can get the form's graphics with CreateGraphics(). But how can I get the title bar's graphics? or How to determine the title bar's retangle? The wParam gotten from WM_NCPAINT always is 1.
-
How can I get graphics through message WM_NCPAINT ?I know I can get the form's graphics with CreateGraphics(). Can I get the title bar's graphics? or How can I determine the title bar's retangle? The wParam gotten from WM_NCPAINT always is 1.
-
How can I get graphics through message WM_NCPAINT ?For repainting the nonclient area myself, I process the message WM_NCPAINT. But the value got from wParam always is 1. Why? How can I get the nonclient area's graphics?
-
the components's commente.g. System.Windows.Forms.Button in system.windows.forms.dll I have not found the corresponding file system.windows.forms.xml .
-
How can I repait the Caption area?How can I repait the Caption area of a window customized? I can't get the graphics of caption area.
-
the components's commentI found that there is not a .xml document corresponds to .net library which involving .net classes. How does these library do that?
-
the components's commentThanks for your help!
-
How to set the TypeConverter of a Control?I got it. Thank you!
-
the components's commentIn the object browser, the comments of a class or its member's summary and parameters can be displayed at the bottom of the window (these comments use "///"). When I compile the project to a .dll, reference this .dll into another solution, the comments of the classes in this .dll can't displayed in object browser. Why? How can I fix it?