// This method is called when the control is redrawn protected override void OnPaint(PaintEventArgs eventArgs) { // Visual Studioのデザインモードのとき。 if (DesignMode) { Screen2DGl scr = window.Screen; scr.Select(); scr.SetClearColor(100, 200, 100); scr.Clear(); scr.DrawString("Open GL", 5, 10, 10); scr.DrawString("Control", 5, 30, 10); scr.Update(); } // 描画用のメソッドはここに書いて。 }
/// <summary> /// 描画メソッド。 /// Screen2DGlの線の太さを変更しているので注意。 /// </summary> public void OnDraw(Screen2DGl screen, int x, int y) { if (fpstimer == null) { return; } int fps = (int)fpstimer.Fps; int realfps = fpstimer.RealFpsInt; screen.SetLineWidth((int)((float)size) / 6 + 1); // string txt = realfps.ToString("D6"); string txt = StringConv.ToDecZeroSuppress(realfps, 6) + "FPS"; int r, g, b; screen.GetColor(out r, out g, out b); // 色を保存 screen.SetColor(0, 120, 0); screen.DrawString(txt, x, y, size); screen.SetColor(r, g, b); // 色を復帰 }
/// <summary> /// 描画メソッド。 /// Screen2DGlの線の太さを変更しているので注意。 /// </summary> public void OnDraw(Screen2DGl screen,int x,int y) { if (fpstimer == null) return ; int fps = (int)fpstimer.Fps; int realfps = fpstimer.RealFpsInt; screen.SetLineWidth((int)((float)size)/6 + 1); // string txt = realfps.ToString("D6"); string txt = StringConv.ToDecZeroSuppress(realfps,6) + "FPS"; int r,g,b; screen.GetColor(out r, out g, out b); // 色を保存 screen.SetColor(0,120,0); screen.DrawString(txt,x,y,size); screen.SetColor(r,g,b); // 色を復帰 }