WinForms윈폼 c1flexgrid :: 보호된 메모리를 읽거나 쓰려고 했습니다
페이지 정보
작성자 구름![](https://dev.mescius.co.kr/theme/hoho/img/lv2.png)
본문
관련링크
winform / 2016V2 / vs2015 / .NET 4.0 / C# / windows 10
System.AccessViolationException: 보호된 메모리를 읽거나 쓰려고 했습니다. 대부분 이러한 경우는 다른 메모리가 손상되었음을 나타냅니다.
위치: System.Drawing.SafeNativeMethods.Gdip.GdipMeasureString(HandleRef graphics, String textString, Int32 length, HandleRef font, GPRECTF& layoutRect, HandleRef stringFormat, GPRECTF& boundingBox, Int32& codepointsFitted, Int32& linesFilled)
위치: System.Drawing.Graphics.MeasureString(String text, Font font, SizeF layoutArea, StringFormat stringFormat)
위치: System.Drawing.Graphics.MeasureString(String text, Font font)
위치: C1.Win.C1FlexGrid.Util.Styles.e.a(Style A_0, Graphics A_1, Rectangle A_2, String A_3)
위치: C1.Win.C1FlexGrid.Util.Styles.e.a(Style A_0, Graphics A_1, Rectangle A_2, String A_3, Image A_4)
위치: C1.Win.C1FlexGrid.Util.Styles.e.a(Style A_0, Graphics A_1, Rectangle A_2, String A_3, Image A_4, k A_5)
위치: C1.Win.C1FlexGrid.C1FlexGridBase.b(Graphics A_0, Int32 A_1, Int32 A_2, Style A_3, Rectangle A_4, String A_5, Image A_6, DrawCellFlags A_7)
위치: C1.Win.C1FlexGrid.C1FlexGridBase.a(Graphics A_0, Int32 A_1, Int32 A_2, Style A_3, Rectangle A_4, String A_5, Image A_6, DrawCellFlags A_7)
위치: C1.Win.C1FlexGrid.C1FlexGridBase.a(Graphics A_0, Int32 A_1, Int32 A_2, Style A_3, Rectangle A_4, String A_5, Image A_6)
위치: C1.Win.C1FlexGrid.C1FlexGridBase.a(Graphics A_0, Int32 A_1, Int32 A_2, Style A_3, Rectangle A_4, String A_5, Image A_6, CheckEnum A_7)
위치: C1.Win.C1FlexGrid.C1FlexGridBase.DrawCell(PaintEventArgs e, Int32 row, Int32 col)
위치: C1.Win.C1FlexGrid.C1FlexGrid.DrawCell(PaintEventArgs e, Int32 row, Int32 col)
위치: C1.Win.C1FlexGrid.C1FlexGrid.DrawRow(PaintEventArgs e, Int32 row)
위치: C1.Win.C1FlexGrid.C1FlexGridBase.a(PaintEventArgs A_0)
위치: C1.Win.C1FlexGrid.C1FlexGridBase.OnPaint(PaintEventArgs e)
위치: System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
위치: System.Windows.Forms.Control.WmPaint(Message& m)
위치: System.Windows.Forms.Control.WndProc(Message& m)
위치: C1.Win.C1FlexGrid.Util.BaseControls.ScrollableControl.WndProc(Message& m)
위치: System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
위치: System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
위치: System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
그리드를 그리고 스타일 등 초기 설정해놓고
이제 내용을 채우려고
tick 돌려서 10초마다
db에서 dataset 갖고 와서 data bind 하는 내용인데요
tick 안에 내용 뭐 없습니다..
그냥 c1FlexGrid1.SetData(~,~,~) 이런거 몇개 없습니다
근데 내용 채우고 나서 좀 있다가 프로세스가 강제로 꺼지더라구요
그래서 이벤트 뷰어에서 보니까 저런 System.AccessViolationException 을 발견 했고
아무리 해결해보려고 해도 해결되지 않습니다...
그래서 단계별로 다 쳐내봤는데
tick {} 안에
c1FlexGrid.SetData(1,1,"안녕");
해도 보호된 메모리 건드렸다고 뜹니다
-
PrivateFontCollection privatefonts = new PrivateFontCollection();
privatefonts.AddFontFile("myFont.ttf");
Font font = new Font(privatefonts.Families[0], 30f);
c1FlexGrid1.Font = font;
이부분때문에 그리드 오류가 났었던걸로 해결했습니다
댓글목록
GCK폴님의 댓글
GCK폴![](https://dev.mescius.co.kr/theme/hoho/img/lv_admin.png)