我是新的移动开发和我的工作理念应用在Windows Mobile 6.0系统和CF 2.0

的证明

我试图设计新backgorund我与Adobe公司的Photoshop应用程序,我发现了codeproject.com教程关于解决了Windows Mobile全屏的问题,应用图像背景问题与根据Dr.Luiji的的 iPhone UI,在Windows Mobile文章

当我试图添加形式背景一些梯度图像。 替代文字http://img268.imageshack.us/img268/8482/ppc2.jpg

图像质量似乎较差。但我想其他背景图片添加到我的形式背景下,似乎不错。

替代文字http://img199.imageshack.us/img199/9812/ppc3 .JPG

我不明白问题出在哪里,我想改变我的backgorund图像BMP,PNG,JPG等它仍然较差。我在做什么错用Photoshop?点击 (注:?在另一方面,我还没有尝试过在真实的PocketPC这种设计又是它不)

然而, 我的另一个真正的问题是在移动形式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);

        }

    }
}

我试图添加窗体上某些控件然后控制被示出透明,当应用程序第一次运行时。如果您尝试移动光标移到这些控件,这些都变成正常。

我能做些什么,为解决这个问题?

感谢您。

替代文字http://img508.imageshack.us/img508/6717/ppc1 .JPG

有帮助吗?

解决方案

首先,你的代码需要一些清理:

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();

        Bitmap backgroundVertical = null;
        public MainForm()
        {
            InitializeComponent();
            backgroundVertical = new Bitmap(_globals.ApplicationPath + @"\Resources\wallpaper.bmp");
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
        }


        protected override void OnPaintBackground(PaintEventArgs e)
        {
            //base.OnPaintBackground(e);
        }


        protected override void OnPaint(PaintEventArgs e)
        {
             using (Bitmap buffer = new Bitmap(this.Width, this.Height))
             using (Graphics gfx = Graphics.FromImage(buffer))
             {
                gfx.Clear(this.BackColor);
                gfx.DrawImage(backgroundVertical, 0, 0);
                //this.Invalidate();  Don't call Invalidate here, it shouldn't be needed
                e.Graphics.DrawImage(buffer, 0, 0);
             }
        }
    }
}

克里斯·塔克的关于位图在CF的经典博客会谈你必须要小心:

HTTP://blog.opennetcf的.com / ctacke / PERMALINK,GUID 987041fc-2e13-4bab-930A-f79021225b74.aspx

在所有这一切,我真的不知道你的问题是什么。你可以再详细一点吗?例如像,我没有看到任何P /调用,但你说你用了一些。他们在哪里?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top