Windows Mobile应用程序后台问题
我是新的移动开发人员,正在 Windows Mobile 6.0 Os 和 CF 2.0 上进行概念验证应用程序,
我尝试使用 Adobe Photoshop 为我的应用程序设计新的背景,我在 codeproject.com 上找到了有关解决问题的教程根据 Luiji 博士的 iPhone UI 使用 Pinvoke api 的 Windows Mobile 全屏问题和应用程序图像背景问题在Windows Mobile文章中,
当我尝试添加表单背景时一些渐变图像。 替代文本 http://img268.imageshack.us/img268/8482/ppc2.jpg< /a>
图像质量似乎很差。 但我尝试在表单背景中添加另一个背景图像,看起来不错。
替代文本 http://img199.imageshack.us/img199/9812/ppc3.jpg< /a>
我不明白问题出在哪里,我尝试将背景图像更改为 bmp、png、jpg 等,但效果仍然很差。 我用 Photoshop 做错了什么?
(注:另一方面,我还没有在真正的袖珍电脑上尝试过这种设计。不是吗?)
但是, 我的另一个真正的问题是移动表单上的 OnPaintBackground 方法。 正如我上面所写,我使用 Pinvoke api 来绘制全屏表单。 这是示例代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using Microsoft.WindowsMobile.Status;
namespace My_Mobile
{
public partial class MainForm : Form
{
Globals _globals = new Globals();
Graphics _gxBuffer;
Bitmap _offsetBitmap;
Bitmap backgroundVertical = null;
public MainForm()
{
InitializeComponent();
backgroundVertical = new Bitmap(_globals.ApplicationPath + @"\Resources\wallpaper.bmp");
_offsetBitmap = new Bitmap(this.Width, this.Height);
}
private void MainForm_Load(object sender, EventArgs e)
{
}
protected override void OnPaintBackground(PaintEventArgs e)
{
//base.OnPaintBackground(e);
}
protected override void OnPaint(PaintEventArgs e)
{
_gxBuffer = Graphics.FromImage(_offsetBitmap);
_gxBuffer.Clear(this.BackColor);
_gxBuffer.DrawImage(backgroundVertical, 0, 0);
this.Invalidate();
e.Graphics.DrawImage(_offsetBitmap, 0, 0);
}
}
}
我试图在表单上添加一些控件,然后在应用程序第一次运行时控件显示为透明。 如果您尝试将光标移到这些控件上,它们将恢复正常。
我能做什么来解决这个问题?
谢谢。
I'm new mobile development and i'm working on an proof of concept application on Windows Mobile 6.0 Os and CF 2.0
I tried to design new backgorund for my application with the Adobe Photoshop, i found a tutorial on the codeproject.com about solving the windows mobile fullscreen problem and app image background issue with Pinvoke api according to Dr.Luiji's iPhone UI in Windows Mobile article
When i tried to add form background some gradient image.
alt text http://img268.imageshack.us/img268/8482/ppc2.jpg
Image quality seems poor. But i tried to add another background image to my form background, it seems good.
alt text http://img199.imageshack.us/img199/9812/ppc3.jpg
I don't understand where is the problem, i tried to change my backgorund image to bmp, png, jpg etc. it still poor. What am i doing mistake with photoshop ?
(Note : on the other hand, i haven't tried this design on real pocketpc yet. is it not ?)
However,
My another real problem is OnPaintBackground method on the mobile forms.
as i wrote above i have used Pinvoke api for drawing fullscreen forms. Here is the sample code :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using Microsoft.WindowsMobile.Status;
namespace My_Mobile
{
public partial class MainForm : Form
{
Globals _globals = new Globals();
Graphics _gxBuffer;
Bitmap _offsetBitmap;
Bitmap backgroundVertical = null;
public MainForm()
{
InitializeComponent();
backgroundVertical = new Bitmap(_globals.ApplicationPath + @"\Resources\wallpaper.bmp");
_offsetBitmap = new Bitmap(this.Width, this.Height);
}
private void MainForm_Load(object sender, EventArgs e)
{
}
protected override void OnPaintBackground(PaintEventArgs e)
{
//base.OnPaintBackground(e);
}
protected override void OnPaint(PaintEventArgs e)
{
_gxBuffer = Graphics.FromImage(_offsetBitmap);
_gxBuffer.Clear(this.BackColor);
_gxBuffer.DrawImage(backgroundVertical, 0, 0);
this.Invalidate();
e.Graphics.DrawImage(_offsetBitmap, 0, 0);
}
}
}
I'm trying to add some controls on the form then controls are shown transparent when the application run the first time. If you try to move cursor over the these controls, these are turn to normally.
What can i do for solve this problem ?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您的代码需要一些清理:
Chris Tacke 的经典博客讨论了 CF 中的位图。 您需要小心:
http:// blog.opennetcf.com/ctacke/PermaLink,guid,987041fc-2e13-4bab-930a-f79021225b74.aspx
毕竟,我不太确定你的问题是什么。 你可以再详细一点吗? 例如,我没有看到任何 P/Invokes,但你说你使用了一些。 他们在哪里?
First of all, your code needs some clean up:
Chris Tacke's classic blog talks about Bitmaps in the CF. You need to be careful:
http://blog.opennetcf.com/ctacke/PermaLink,guid,987041fc-2e13-4bab-930a-f79021225b74.aspx
After all that, I'm not really sure what your question is. Could you be more specific? Like for example, I don't see any P/Invokes, but you said you used some. Where are they?