フォームにはピクチャーボックスとwebbrowserが張り付けてあります。
ピクチャボックス内でdxライブラリを使ったゲームを表示させます。
ここで質問があります。
webbrowserを使ってサイトを表示させようとしたときにゲーム画面がカクカクする現象が起きてしまいます。
これをどのようにしたら解決できるでしょうか。
最悪縁なしのフォームを一つ作ってそれをwebbrawserがあったスペースに重ねる方法があるのですが効率が悪いと思います。
下記のようなプログラムを
http://qiita.com/hart_edsf/items/0301f17e2d9acd890c5e
を参考にして書きました。ブラウザは貼り付けてオプションで設定しました。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DxLibDLL;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
int i = 0;
public Form1()
{
InitializeComponent();
DX.SetUserWindow(this.Handle);
DX.SetUserChildWindow(pictureBox1.Handle);
DX.DxLib_Init();
DX.SetDrawScreen(DX.DX_SCREEN_BACK);
}
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
DX.DxLib_End();
}
public void MainLoop()
{
// 画面に描かれているものを一回全部消す
DX.ClsDrawScreen();
DX.DrawString(0, i, "Hello C# World!", -1);
i++;
if (i > 200) i = 0;
// 裏画面の内容を面画面に反映される
DX.ScreenFlip();
}
}
}