Esempio n. 1
0
        //  override clo
        /// <summary>
        /// when Form Close ask sons change location
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SmartForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            PrinftHelper.PrinftNormal("Disconnect Event");
            ColorChanged -= SmartForm_ColorChanged;
            if (this.Owner is SmartForm && isClosedGoback)
            {
                SmartForm mather = (SmartForm)this.Owner;
                Point     temp   = new Point();
                switch (this.direc)
                {
                case Direction.right:  temp = new Point(this.Location.X + this.Width, this.Location.Y); break;

                case Direction.left: temp = new Point(this.Location.X - this.Width, this.Location.Y); break;

                case Direction.top: temp = new Point(this.Location.X, this.Location.Y - this.Height); break;

                case Direction.down: temp = new Point(this.Location.X, this.Location.Y + this.Height); break;
                }

                TellMatherReLocated(mather, this, temp);
                mather.EventLocationChanged -= this.form_EventLocationChanged;
            }
            else if (this.Owner is SmartForm)
            {
                SmartForm mather = (SmartForm)this.Owner;
                mather.EventLocationChanged -= this.form_EventLocationChanged;
            }
        }
Esempio n. 2
0
 //   Form Tool = null;
 public SmartForm()
 {
     InitializeComponent();
     this.ControlBox          = false;
     this.AutoScaleMode       = AutoScaleMode.Dpi;
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     PrinftHelper.PrinftNormal("Connect Event");
     ColorChanged += SmartForm_ColorChanged;
     //   this.AutoSize = true;
 }
Esempio n. 3
0
 void im_Tick(object sender, EventArgs e)
 {
     try
     {
         index++;
         index = index % (Int32.MaxValue / 2);
         Refresh();
     }
     catch (Exception fs)
     {
         PrinftHelper.LogException(fs);
     }
 }
Esempio n. 4
0
 private void lst_DrawItem(object sender, DrawItemEventArgs e)
 {
     try
     {
         n++;
         e.DrawBackground();
         e.DrawFocusRectangle();
         string tex   = (this.Items[e.Index]).ToString();
         SizeF  sizeF = e.Graphics.MeasureString(tex, e.Font);
         if (sizeF.Width < e.Bounds.Width)
         {
             e.Graphics.DrawString(tex, e.Font, new SolidBrush(e.ForeColor), e.Bounds);
         }
         else
         {
             BigCount++;
             int    start         = index % tex.Length;
             string ForeString    = tex.Substring(0, start);
             string Beforestring  = tex.Substring(start);
             string ChangedString = Beforestring + ForeString;
             start = 0;
             while (start < ChangedString.Length && e.Graphics.MeasureString(ChangedString.Substring(0, start), e.Font).Width < e.Bounds.Width)
             {
                 start++;
             }
             string RealString = ChangedString.Substring(0, start);
             e.Graphics.DrawString(RealString, e.Font, new SolidBrush(e.ForeColor), e.Bounds);
         }
         if (n >= this.Items.Count)
         {
             IsAutoScrollColomn = BigCount > 0;
             n        = 0;
             BigCount = 0;
         }
     }
     catch (Exception fgg)
     {
         PrinftHelper.LogException(fgg);
         try
         {
             string tex = (this.Items[e.Index]).ToString();
             e.Graphics.DrawString(tex, e.Font, new SolidBrush(e.ForeColor), e.Bounds);
         }
         catch (Exception gd)
         {
             PrinftHelper.LogException(gd);
             e.Graphics.DrawString(this.Name, e.Font, new SolidBrush(e.ForeColor), e.Bounds);
         }
     }
 }