私はVisual Studio 2008でC#.netを使用してWindows CE 5.0でアプリケーションを開発しています。 私はユーザーコントロールを作成することによってメインユーザーコントロールにいくつかのユーザーコントロールを表示したいと思います。 メインユーザーコントロールでユーザーコントロールを読み込んでいるときに、アプリケーションがちらつきます。Windows CEアプリケーションでUIがちらつくのを避けるには?
たとえば、1つのボタン画像を持つ1つのユーザーコントロールがあります。このユーザーコントロールの20個のボタンを表示したいとします。
`protected override void OnPaint(PaintEventArgs e) { //base.OnPaint(e); グラフィックスgxOff = e.Graphics; グラフィックスg;
//Paint the string
Font boldFont = new Font("Tahoma", 8.0F, FontStyle.Bold);
Color penColor = Color.FromArgb(48, 48, 48);
StringFormat drawFormat = new StringFormat();
drawFormat.Alignment = StringAlignment.Center;
if (m_bmpOffscreen == null) //Bitmap for doublebuffering
{
m_bmpOffscreen = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height);
}
g = Graphics.FromImage(m_bmpOffscreen);
g.Clear(this.BackColor);
if (!Disabled)
{
backgroundImage = unselected_img;
if (selected)
{
backgroundImage = selected_img;
g.DrawImage(backgroundImage, this.ClientRectangle, new Rectangle(0, 0, backgroundImage.Width, backgroundImage.Height), GraphicsUnit.Pixel);
}
else
g.DrawImage(backgroundImage, this.ClientRectangle, new Rectangle(0, 0, backgroundImage.Width, backgroundImage.Height), GraphicsUnit.Pixel);
}
else
{
backgroundImage = disabled_img;
g.DrawImage(backgroundImage, this.ClientRectangle, new Rectangle(0, 0, backgroundImage.Width, backgroundImage.Height), GraphicsUnit.Pixel);
}
g.DrawString(this.Content, boldFont, new SolidBrush(penColor), new RectangleF(0, 3, 20, 20), drawFormat);
gxOff.DrawImage(m_bmpOffscreen, 0, 0);
}`
この問題を解決するにはどうすればよいですか。
ありがとうございます。
ドッキング、パネル、ユーザーコントロールとユーザーコントロールのコントロール用のレイアウトパネルを使用していますか? – Reniuz
私は別のユーザーコントロールでロードしようとしているユーザーコントロールのonpaintイベントのボタンイメージを描画しています – Shilpa
描画コードを表示します。また、私は何かを描画する20のユーザーコントロールを追加すると良い考えではないと思う。 – Reniuz