<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      一個Xp風格的表單類(一)

      [摘要]其實是一個 無邊框窗體,寫成的表單類....但是外表看起來和普通的FORM完全一樣.呵呵. 最可惜的是,現在還沒找到,在工具欄上放菜單的辦法......哭....下面是運行時候的圖片..我喜歡程序,...
      其實是一個 無邊框窗體,寫成的表單類....但是外表看起來和普通的FORM完全一樣.

      呵呵. 最可惜的是,現在還沒找到,在工具欄上放菜單的辦法......哭....

      下面是運行時候的圖片..



      我喜歡程序,更喜歡程序有個PL的界面....

      但是網上似乎找不到詳細的,關于此方面的教程或源碼.

      重繪時改用了雙緩沖,在窗體上有動畫的時候,重繪不會出現閃爍的現象了.

      獻丑一下,把源碼貼出來,大家一起交流....

      下面是引用,以及,聲明的部分##########################################

      using System;
      using System.ComponentModel;
      using System.Windows.Forms;
      using System.Drawing;
      using System.Drawing.Drawing2D;
      using System.IO;
      using System.Runtime.InteropServices;
      namespace XpFormOfApc
      {
      /// <summary>
      /// Form1 的摘要說明。
      /// </summary>

      public class XpForm : System.Windows.Forms.Form
      {
      public delegate void SysHandler(object sender,System.EventArgs e);
      public event SysHandler SysDoubleClick;

      //############API設置窗口STYLE#############
      private const int GWL_STYLE = (-16);
      private const int WS_SYSMENU = 0x80000;
      private const int WS_SIZEBOX = 0x40000;
      private const int WS_MAXIMIZEBOX = 0x10000;
      private const int WS_MINIMIZEBOX=0x20000;
      [System.Runtime.InteropServices.DllImport("user32", EntryPoint="SetWindowLong")]
      private static extern int SetWindowLongA(int hwnd, int nIndex, int dwNewLong);
      //###########普通組件定義#################
      private System.ComponentModel.IContainer components;
      private System.Windows.Forms.ImageList imglist;
      private System.Windows.Forms.ImageList syslist;
      //###############組件屬性##################
      //---系統按鈕---
      private bool Sys_Close_Visible=true;
      private bool Sys_Max_Visible=true;
      private bool Sys_Res_Visible=false;
      private bool Sys_Min_Visible=true;
      private bool Sys_Down_Visible=false;
      private bool Sys_Up_Visible=true;
      private bool Sys_Tray_Visible=true;
      private bool IsShowInTray=false;
      private int FormIconWidth=16;
      private int FormIconHeight=16;
      private const int ONE=23; //按鈕寬21+2間隔
      private int[,] SysCmd=new int[9,7]{
      {1,0,7,0,6,21,21},
      {1,1,8,0,6,21,21},
      {0,2,9,0,6,21,21},
      {1,3,10,0,6,21,21},
      {0,4,11,0,6,21,21},
      {1,5,12,0,6,21,21},
      {1,6,13,0,6,21,21},
      {10,5,12,0,0,21,21},
      {11,5,12,32,0,0,30}
      }; //10-FORM_ICON 11-FORM_TITLE
      //---表單圖標--托盤圖標---
      private NotifyIcon ni=new NotifyIcon();
      private Icon TrayIcon;
      private ContextMenu TrayContextMenu;
      private string[] TrayToolTip;
      private string TempTrayToolTip;
      //public event SysOnDoubleClick (System.EventArgs e); //托盤圖標雙擊事件

      private Rectangle FormRect;//表單上一狀態的RECT 用于Down還原

      //允許拖拽標志 - 坐標
      private bool CanMove=false;
      private Point CurPoint=new Point(0,0);
      private Point CurPoint2=new Point(0,0);


      //
      private int CanUp=0;

      //====================================================
      [DllImport("user32.dll")]
      public static extern bool ReleaseCapture();
      [DllImport("user32.dll")]
      public static extern bool SendMessage(IntPtr hwnd,int wMsg,int wParam,int lParam);

      private const int WM_SYSCOMMAND=0x0112;
      private const int SC_MOVE=0xF010;
      private const int HTCAPTION=0x0002;
      private const int HTRIGHT=0x0011;





      ################ 下面是代碼 ###############

      public XpForm()
      {
      //
      // Windows 窗體設計器支持所必需的
      //
      InitializeComponent();
      //this.SetBounds(4,30,this.Width-8,this.Height-34);
      //
      // TOD 在 InitializeComponent 調用后添加任何構造函數代碼
      //
      }

      /// <summary>
      /// 清理所有正在使用的資源。
      /// </summary>
      protected override void Dispose( bool disposing )
      {
      if( disposing )
      {
      if (components != null)
      {
      components.Dispose();
      }
      }
      base.Dispose( disposing );
      }

      #region Windows 窗體設計器生成的代碼
      /// <summary>
      /// 設計器支持所需的方法 - 不要使用代碼編輯器修改
      /// 此方法的內容。
      /// </summary>
      private void InitializeComponent()
      {
      this.components = new System.ComponentModel.Container();
      System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(XpForm));
      this.imglist = new System.Windows.Forms.ImageList(this.components);
      this.syslist = new System.Windows.Forms.ImageList(this.components);
      //
      // imglist
      //
      this.imglist.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
      this.imglist.ImageSize = new System.Drawing.Size(50, 50);
      this.imglist.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imglist.ImageStream")));
      this.imglist.TransparentColor = System.Drawing.Color.Black;
      //
      // syslist
      //
      this.syslist.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
      this.syslist.ImageSize = new System.Drawing.Size(21, 21);
      this.syslist.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("syslist.ImageStream")));
      this.syslist.TransparentColor = System.Drawing.Color.Transparent;
      //
      // XpForm
      //
      this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
      this.ClientSize = new System.Drawing.Size(280, 136);
      this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
      this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
      this.Name = "XpForm";
      this.Text = "APC心靈空間";

      }
      #endregion

      /// <summary>
      /// 應用程序的主入口點。
      /// </summary>
      [STAThread]
      static void Main()
      {
      //XpForm xf=new XpForm();
      //xf.SysDoubleClick+=new SysHandler(xf.ni_DoubleClick);
      Application.Run(new XpForm());

      }



      //######################### 自 定 函 數 ##############################
      private void RePaint(bool ClearAll)
      {
      Graphics g=this.CreateGraphics();
      if(ClearAll==true){g.Clear(Color.FromArgb(242,242,242));}
      //畫XP邊框
      g.DrawImage(imglist.Images[1],0,0,this.Width+50,30); //橫幅
      g.DrawImage(imglist.Images[0],0,0,6,30); //左角
      g.DrawImage(imglist.Images[2],this.Width-6,0,6,30); //右角
      g.DrawImage(imglist.Images[5],0,this.Height-4,this.Width+50,4);//下邊
      g.DrawImage(imglist.Images[3],0,7,4,this.Height); //左邊
      g.DrawImage(imglist.Images[4],this.Width-4,7,4,this.Height);//右邊
      //畫圖標
      g.DrawImage((Image)this.Icon.ToBitmap(),new Rectangle(8,6,FormIconWidth,FormIconHeight));
      //畫標題
      g.DrawString(this.Text,new Font("宋體",9,FontStyle.Bold),new SolidBrush(Color.White),32,10);
      //計算..畫按鈕
      InitSysCmd();
      int SysIndex=1;
      for(int i=0;i<=6;i++)
      {
      //if(SysVisible[i]==1)
      if(SysCmd[i,0]==1)
      {
      g.DrawImage(syslist.Images[i],this.Width-ONE*SysIndex-6,6,21,21);
      SysCmd[i,3]=this.Width-ONE*SysIndex-6; //記錄各SysCmd的Rect.X
      SysCmd[8,5]=this.Width-ONE*SysIndex-6; //標題欄拖拽的長度
      SysIndex+=1;
      }
      }

      g.Dispose();
      }
      private void RePaint()
      {
      Bitmap b=new Bitmap(this.Width,this.Height);
      Graphics bmp=Graphics.FromImage((Image)b);

      //Bitmap c=new Bitmap(100,100,this.CreateGraphics());
      //g.Clear(this.BackColor);

      //畫XP邊框
      bmp.DrawImage(imglist.Images[1],0,0,this.Width+50,30); //橫幅
      bmp.DrawImage(imglist.Images[0],0,0,6,30); //左角
      bmp.DrawImage(imglist.Images[2],this.Width-6,0,6,30); //右角
      bmp.DrawImage(imglist.Images[5],0,this.Height-4,this.Width+50,4);//下邊
      bmp.DrawImage(imglist.Images[3],0,7,4,this.Height); //左邊
      bmp.DrawImage(imglist.Images[4],this.Width-4,7,4,this.Height);//右邊
      //畫圖標
      bmp.DrawImage((Image)this.Icon.ToBitmap(),new Rectangle(8,6,FormIconWidth,FormIconHeight));
      //畫標題
      bmp.DrawString(this.Text,new Font("宋體",9,FontStyle.Bold),new SolidBrush(Color.White),32,10);
      //計算..畫按鈕
      InitSysCmd();
      int SysIndex=1;
      for(int i=0;i<=6;i++)
      {
      //if(SysVisible[i]==1)
      if(SysCmd[i,0]==1)
      {
      bmp.DrawImage(syslist.Images[i],this.Width-ONE*SysIndex-6,6,21,21);
      SysCmd[i,3]=this.Width-ONE*SysIndex-6; //記錄各SysCmd的Rect.X
      SysCmd[8,5]=this.Width-ONE*SysIndex-6; //標題欄拖拽的長度
      SysIndex+=1;
      }
      }
      Graphics g=this.CreateGraphics();
      g.DrawImage(b,0,0);
      bmp.Dispose();
      g.Dispose();
      }

      private void ReCreateRegion()
      {
      Rectangle r=Screen.GetWorkingArea(this);
      Point[] p=new Point[]{
      new Point(0,6),
      new Point(1,4),
      new Point(4,1),
      new Point(6,0),
      new Point(this.Width-6,0),
      new Point(this.Width-4,1),
      new Point(this.Width-1,4),
      new Point(this.Width-1,5),
      new Point(this.Width,this.Height),
      new Point(0,this.Height)};
      byte[] b=new byte[]{
      (byte)PathPointType.Line,
      (byte)PathPointType.Line,
      (byte)PathPointType.Line,
      (byte)PathPointType.Line,
      (byte)PathPointType.Line,
      (byte)PathPointType.Line,
      (byte)PathPointType.Line,
      (byte)PathPointType.Line,
      (byte)PathPointType.Line,
      (byte)PathPointType.Line};
      System.Drawing.Drawing2D.GraphicsPath path=new GraphicsPath(p,b);
      this.Region=new Region(path);

      }
      private void InitSysCmd()
      {
      if(Sys_Close_Visible==true){SysCmd[0,0]=1;}
      else{SysCmd[0,0]=0;}
      if(Sys_Max_Visible==true){SysCmd[1,0]=1;}
      else{SysCmd[1,0]=0;}
      if(Sys_Res_Visible==true){SysCmd[2,0]=1;}
      else{SysCmd[2,0]=0;}
      if(Sys_Min_Visible==true){SysCmd[3,0]=1;}
      else{SysCmd[3,0]=0;}
      if(Sys_Up_Visible==true){SysCmd[5,0]=1;}
      else{SysCmd[5,0]=0;}
      if(Sys_Down_Visible==true){SysCmd[4,0]=1;}
      else{SysCmd[4,0]=0;}
      if(Sys_Tray_Visible==true){SysCmd[6,0]=1;}
      else{SysCmd[6,0]=0;}
      }
      private void DoClick(int i)
      {
      switch(i)
      {
      case 0://關閉
      this.Close();
      break;
      case 1://最大化
      this.WindowState=FormWindowState.Maximized;
      break;
      case 2://還原
      this.WindowState=FormWindowState.Normal;
      break;
      case 3://最小化
      this.WindowState=FormWindowState.Minimized;
      break;
      case 4://放下
      this.Top=FormRect.Y;
      this.Left=FormRect.X;
      this.Width=FormRect.Width;
      this.Height=FormRect.Height;
      Sys_Down_Visible=false;
      Sys_Up_Visible=true;
      //this.RePaint();
      break;
      case 5://收起
      FormRect=new Rectangle(this.Left,this.Top,this.Width,this.Height);
      this.Height=30;
      this.Top=0;
      Sys_Up_Visible=false;
      Sys_Down_Visible=true;
      this.RePaint();
      break;
      case 6://縮入托盤
      ni.Text=TempTrayToolTip;
      ni.Icon=TrayIcon;
      ni.ContextMenu=TrayContextMenu;
      this.WindowState=FormWindowState.Minimized;
      this.ShowInTaskbar=false;
      this.Visible=false;
      ni.Visible=true;
      break;
      }

      }
      private void ni_DoubleClick(object sender,System.EventArgs e)
      {
      OnSysDoubleClick(e);
      if(ShowInTray==true)
      {
      ni.Visible=true;
      }
      }
      void OnSysDoubleClick(System.EventArgs e)
      {
      if(this.Visible==true)
      {
      this.WindowState=FormWindowState.Minimized;
      this.ShowInTaskbar=false;
      this.Visible=false;
      ni.Visible=true;
      }
      else
      {
      int mStyle=WS_SYSMENU;
      if(Sys_Max_Visible==true){mStyle=mStyle WS_MAXIMIZEBOX;}
      if(Sys_Min_Visible==true){mStyle=mStyle WS_MINIMIZEBOX;}

      if(ShowInTray==false){ni.Visible=false;}

      this.ShowInTaskbar=true;
      this.WindowState=FormWindowState.Minimized;
      int a=SetWindowLongA(this.Handle.ToInt32(),GWL_STYLE,mStyle);
      this.Visible=true;
      this.WindowState=FormWindowState.Normal;
      }
      }







      #region __重 載 事 件___
      //######################### 重 載 事 件 ###############################
      protected override void OnLoad(System.EventArgs e)
      {
      int mStyle=WS_SYSMENU;
      if(Sys_Max_Visible==true){mStyle=mStyle WS_MAXIMIZEBOX;}
      if(Sys_Min_Visible==true){mStyle=mStyle WS_MINIMIZEBOX;}
      int a=SetWindowLongA(this.Handle.ToInt32(),GWL_STYLE,mStyle);
      if(IsShowInTray==true){ni.Icon=TrayIcon;ni.ContextMenu=TrayContextMenu;ni.Text=TempTrayToolTip;ni.Visible=true;}
      this.ni.DoubleClick+=new System.EventHandler(this.ni_DoubleClick);
      this.SetStyle(ControlStyles.DoubleBuffer ControlStyles.ResizeRedraw ControlStyles.ContainerControl,true);
      }
      protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
      {
      //base.OnPaint(e);
      this.RePaint();
      base.OnPaint(e);
      //ee=e;
      }

      protected override void OnResize(System.EventArgs e)
      {
      Rectangle r=Screen.GetWorkingArea(this);
      this.MaximumSize=new Size(r.Width,r.Height);
      if(this.WindowState==FormWindowState.Maximized)
      {
      if(Sys_Max_Visible==true)
      {
      Sys_Max_Visible=false;
      Sys_Res_Visible=true;
      }
      if(Sys_Up_Visible==true)
      {
      Sys_Up_Visible=false;
      CanUp=1;
      }
      }
      if(this.WindowState==FormWindowState.Normal)
      {
      if(Sys_Res_Visible==true)
      {
      Sys_Max_Visible=true;
      Sys_Res_Visible=false;
      }
      if(CanUp==1)
      {
      Sys_Up_Visible=true;
      CanUp=0;
      }
      }
      this.RePaint();
      //this.OnPaint(ee);
      ReCreateRegion();
      this.Refresh();
      }
      protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
      {
      if(CanMove==true)
      {
      //this.Cursor=Cursors.SizeAll;
      //this.Top=Cursor.Position.Y-CurPoint.Y;
      //this.Left=Cursor.Position.X-CurPoint.X;
      if(CurPoint.X>SysCmd[8,3] && CurPoint.X<SysCmd[8,5] && CurPoint.Y<30 && (Sys_Res_Visible!=true ))
      {
      ReleaseCapture();
      SendMessage(this.Handle,WM_SYSCOMMAND,SC_MOVE+HTCAPTION, 0);
      }

      }


      Graphics g=this.CreateGraphics();
      for(int i=0;i<=6;i++)
      {
      if(SysCmd[i,0]==1)
      {
      if(e.X>SysCmd[i,3] && e.X<SysCmd[i,3]+21 && e.Y>6 && e.Y<27)
      {g.DrawImage(syslist.Images[SysCmd[i,2]],SysCmd[i,3],6,21,21);}
      else{g.DrawImage(syslist.Images[SysCmd[i,1]],SysCmd[i,3],6,21,21);}
      }
      }
      g.Dispose();

      CurPoint2.X=Cursor.Position.X-this.Left;
      CurPoint2.Y=Cursor.Position.Y-this.Top;
      }
      protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
      {
      if(e.Button==MouseButtons.Left && e.X>SysCmd[8,3] && e.X<SysCmd[8,5] && e.Y<30)
      {
      CanMove=true;
      }
      CurPoint.X=e.X;
      CurPoint.Y=e.Y;
      }

      protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
      {
      //if(e.Button==MouseButtons.Left && e.X>SysCmd[8,3] && e.X<SysCmd[8,5] && e.Y<30)
      //{
      CanMove=false;
      this.Cursor=Cursors.Default;
      //}
      }

      protected override void OnClick(System.EventArgs e)
      {
      for(int i=0;i<=6;i++)
      {
      if(SysCmd[i,0]==1)
      {
      if(CurPoint.X>SysCmd[i,3] && CurPoint.X<SysCmd[i,3]+21 && CurPoint.Y>6 && CurPoint.Y<27)
      {DoClick(i);}
      else{}
      }
      }
      }
      protected override void OnDoubleClick(System.EventArgs e)
      {
      if(CurPoint.X>SysCmd[8,3] && CurPoint.X<SysCmd[8,5] && CurPoint.Y<30 && (Sys_Max_Visible==true Sys_Res_Visible==true ))
      {
      if(this.WindowState==FormWindowState.Maximized)
      {
      this.WindowState=FormWindowState.Normal;
      }
      else
      {
      this.WindowState=FormWindowState.Maximized;
      }
      this.Cursor=Cursors.Default;
      }
      }

      protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
      {
      ni.Visible=false;
      ni.Dispose();
      }

      protected override void OnTextChanged(System.EventArgs e)
      {this.RePaint(false);}

      //protected override void OnLayout(System.Windows.Forms.LayoutEventArgs e)
      //{
      //mmd,在這里一加事件,居然從TRAY里恢復窗口的時候,不從畫子控件了..郁悶
      //this.XpPanel.Location=new Point(4,30);
      //this.XpPanel.Size=new Size(this.Width-8,this.Height-34);
      //this.XpPanel.SendToBack();
      //foreach(Control c in this.Controls)
      //{
      //c.Parent=this.XpPanel;
      //}
      //}

      //protected override void OnControlAdded(System.Windows.Forms.ControlEventArgs ce)
      //{
      /* 這也不是什么根本的辦法,,,,,自己用還中....
      try
      {
      if(ce.Control.Parent==this && ce.Control.Name!=this.Name && ce.Control.Name!=this.XpPanel.Name)
      {
      ce.Control.Parent=this.XpPanel;
      }
      }
      catch{}
      */
      //}

      /*
      protected override void WndProc(ref Message m)
      {
      base.WndProc(ref m);
      if (m.Msg == 0x0084 && CurPoint2.Y<=30 ) //WM_NCHITTEST
      {
      m.Result= (IntPtr)2; // HTCLIENT
      this.Text=this.CurPoint2.Y.ToString();
      return;
      }

      }*/
      //protected override void OnActivated(System.EventArgs e)
      //{

      //}
      //####################################################################
      #endregion









      #region 自 定 義 屬 性
      //####################### 自 定 義 屬 性 #############################
      [
      Category("XpForm屬性"),
      Description("獲取或設置窗體的關閉按鈕是否可見.")
      ]
      public bool Sys_Close_IsVisible
      {
      get{return Sys_Close_Visible;}
      set
      {
      Sys_Close_Visible=value;
      InitSysCmd();
      int SysIndex=0;
      for(int i=0;i<=6;i++)
      {
      if(SysCmd[i,0]==1)
      {
      SysIndex+=1;
      }
      }
      this.Invalidate(new Rectangle(this.Width-6-ONE*SysIndex,6,6+ONE*SysIndex,21));
      }
      }
      [
      Category("XpForm屬性"),
      Description("獲取或設置窗體的最大化按鈕是否可見.")
      ]
      public bool Sys_Max_IsVisible
      {
      get{return Sys_Max_Visible;}
      set
      {
      Sys_Max_Visible=value;
      InitSysCmd();
      int SysIndex=0;
      for(int i=0;i<=6;i++)
      {
      if(SysCmd[i,0]==1)
      {
      SysIndex+=1;
      }
      }
      this.Invalidate(new Rectangle(this.Width-6-ONE*SysIndex,6,6+ONE*SysIndex,21));
      }
      }
      [
      Category("XpForm屬性"),
      Description("獲取或設置窗體的最小化按鈕是否可見.")
      ]
      public bool Sys_Min_IsVisible
      {
      get{return Sys_Min_Visible;}
      set
      {
      Sys_Min_Visible=value;
      InitSysCmd();
      int SysIndex=0;
      for(int i=0;i<=6;i++)
      {
      if(SysCmd[i,0]==1)
      {
      SysIndex+=1;
      }
      }
      this.Invalidate(new Rectangle(this.Width-6-ONE*SysIndex,6,6+ONE*SysIndex,21));
      }
      }
      [
      Category("XpForm屬性"),
      Description("獲取或設置窗體的收起(向上)按鈕是否可見.")
      ]
      public bool Sys_Up_IsVisible
      {
      get{return Sys_Up_Visible;}
      set
      {
      Sys_Up_Visible=value;
      InitSysCmd();
      int SysIndex=0;
      for(int i=0;i<=6;i++)
      {
      if(SysCmd[i,0]==1)
      {
      SysIndex+=1;
      }
      }
      this.Invalidate(new Rectangle(this.Width-6-ONE*SysIndex,6,6+ONE*SysIndex,21));
      }
      }
      [
      Category("XpForm屬性"),
      Description("獲取或設置窗體的縮入托盤按鈕是否可見.")
      ]
      public bool Sys_Tray_IsVisible
      {
      get{return Sys_Tray_Visible;}
      set
      {
      Sys_Tray_Visible=value;
      InitSysCmd();
      int SysIndex=0;
      for(int i=0;i<=6;i++)
      {
      if(SysCmd[i,0]==1)
      {
      SysIndex+=1;
      }
      }
      this.Invalidate(new Rectangle(this.Width-6-ONE*SysIndex,6,6+ONE*SysIndex,21));
      }
      }
      [
      Category("XpForm屬性"),
      Description("獲取或設置窗體在托盤區顯示的圖標.")
      ]
      public Icon Sys_Icon
      {
      get{return TrayIcon;}
      set{TrayIcon=value;ni.Icon=TrayIcon;}
      }
      [
      Category("XpForm屬性"),
      Description("獲取或設置窗體在托盤區的上下文菜單.")
      ]
      public ContextMenu Sys_ContextMenu
      {
      get{return TrayContextMenu;}
      set{TrayContextMenu=value;ni.ContextMenu=TrayContextMenu;}
      }
      [
      Category("XpForm屬性"),
      Description("獲取或設置當鼠標停留在托盤區圖標上時的提示文字.")
      ]
      public string Sys_ToolTip
      {
      get{return TempTrayToolTip;}
      set{TempTrayToolTip=value;TrayToolTip=TempTrayToolTip.Split("\n".ToCharArray(),0);ni.Text=value;}
      }
      [
      Category("XpForm屬性"),
      Description("多行編輯控件中的文本行,作為字符串值的數組.(用于設置多行ToolTip)")
      ]
      public string[] Sys_ToolTip_Lines
      {
      get{return TrayToolTip;}
      set
      {
      string[] a=value;
      //TrayToolTip=value[0];
      TempTrayToolTip="";
      for(int i=0;i<=a.Length-1;i++)
      {
      TempTrayToolTip=TempTrayToolTip+a.GetValue(i).ToString();
      if(i<a.Length-1)
      {
      TempTrayToolTip=TempTrayToolTip+"\n";
      }
      }
      ni.Text=TempTrayToolTip;
      TrayToolTip=value;
      }
      }
      [
      Category("XpForm屬性"),
      Description("獲取或設置窗體剛啟動時是否在托盤區顯示.(需要先設置Sys_Icon屬性.)")
      ]
      public bool ShowInTray
      {
      get{return IsShowInTray;}
      set
      {
      IsShowInTray=value;
      if(!this.DesignMode)
      {
      ni.Icon=TrayIcon;
      ni.ContextMenu=TrayContextMenu;
      ni.Text=TempTrayToolTip;
      ni.Visible=value;
      }
      }
      }
      [
      Category("XpForm屬性"),
      Description("窗體圖標的寬.)")
      ]
      public int FormIcon_Width
      {
      get{return FormIconWidth;}
      set
      {
      if(value>=FormIconWidth)
      {
      FormIconWidth=value;
      this.Invalidate(new Rectangle(8,6,value,FormIconHeight));
      }
      else
      {
      int temp=FormIconWidth;
      FormIconWidth=value;
      this.Invalidate(new Rectangle(8,6,value,temp));
      }
      }
      }
      [
      Category("XpForm屬性"),
      Description("窗體圖標的高.)")
      ]
      public int FormIcon_Height
      {
      get{return FormIconHeight;}
      set
      {
      if(value>=FormIconHeight)
      {
      FormIconHeight=value;
      this.Invalidate(new Rectangle(8,6,FormIconWidth,value));
      }
      else
      {
      int temp=FormIconHeight;
      FormIconHeight=value;
      this.Invalidate(new Rectangle(8,6,temp,value));
      }
      }
      }
      //####################################################################
      #endregion
      }
      }




      日韩精品一区二区三区高清