zoukankan      html  css  js  c++  java
  • WinCEWindow Mobile程序桌面化总结

    1、系统API处理

    将桌面、移动API分开处理

    2、一份代码,两个工程,分别编译

    添加已有文件时,使用添加链接,而不是添加附本

    3、桌面窗体出现位置不规律,样式不统一问题

    首先,在窗体类成员加入两个成员变量

            publicForm parentForm;    

            privatebool inited;       

    然后添加如下代码

     

            public ctor(Form parent)

                : this()

            {

                parentForm = parent;

            }

     

            protectedoverridevoid OnClosing(CancelEventArgs e)

            {

                if (parentForm != null)

                {

                    parentForm.Location = this.Location;

                    parentForm.Show();

                }

                base.OnClosing(e);

            }

     

            protectedoverridevoid OnActivated(EventArgs e)

            {

                if (!inited)

                {

                    inited = true;

                    parentForm.Hide();

                }

                base.OnActivated(e);

            }

     

            protectedoverridevoid OnLoad(EventArgs e)

            {

                if (parentForm != null)

                {

                    if (Environment.OSVersion.Platform == PlatformID.WinCE)

                    {

                        this.FormBorderStyle = FormBorderStyle.None;

                        this.ControlBox = false;

                    }

                    else

                    {

                        bool tmp = this.Visible;

                        this.Visible = false;

                        this.FormBorderStyle = FormBorderStyle.FixedSingle;

                        this.ControlBox = true;

                        this.MaximizeBox = false;

                        this.MinimizeBox = true;

                        this.Visible = tmp;

                    }

                    this.Location = parentForm.Location;

                    this.Size = parentForm.Size;

                }

                base.OnLoad(e);

            }

     

    使用时,使用窗体类带有Form parent参数的构造

  • 相关阅读:
    C#如何释放未托管资源
    C# 如何将一个List转换为只读的
    【转载】所谓爱情不是一个人的事情(爱情不完全手册)
    vbs SendKey 用法 Sendkey 键盘对应的码表
    PowerShell签名和执行策略
    IDisposable接口和析构函数的联合使用
    [读报]2009中国基金业明星基金奖揭晓
    【读书笔记】泛型接口 和 泛型方法
    C# 反射(转)
    设计模式详解——装饰者模式
  • 原文地址:https://www.cnblogs.com/hbhbice/p/4286643.html
Copyright © 2011-2022 走看看