コード例 #1
0
 public void Remove(ToolbarItem anItem)
 {
     int index = base.List.IndexOf(anItem);
     if (index >= 0)
     {
         this.Remove(index);
     }
 }
コード例 #2
0
 public void Add(ToolbarItem anItem)
 {
     anItem.RefreshRequired += new RefreshRequiredEventHandler(this.RefreshToolbarItemRequired);
     base.List.Add(anItem);
 }
コード例 #3
0
 private Rectangle GetImageDestRect(ToolbarItem anItem, Image anImage)
 {
     int num;
     int num2;
     if (anItem.StretchImage)
     {
         return new Rectangle(0, 0, anItem.ClientRectangle.Width, anItem.ClientRectangle.Height);
     }
     Size anImgSize = anImage.Size;
     if (anItem.ItemSizeType != ToolbarItemSizeType.ByImageWithoutScaling)
     {
         anImgSize.Height = (int) (anImgSize.Height * ToolbarControl.m_ScaleFactor.Height);
         anImgSize.Width = (int) (anImgSize.Width * ToolbarControl.m_ScaleFactor.Width);
     }
     this.GetImageLocation(anItem.ImageAlignment, anItem.ClientRectangle, anImgSize, out num, out num2);
     return new Rectangle(num, num2, anImgSize.Width, anImgSize.Height);
 }
コード例 #4
0
 private Rectangle DrawToolbarImage(Graphics gr, ToolbarItem anItem, Image image, Rectangle aRect)
 {
     Rectangle imageDestRect = this.GetImageDestRect(anItem, image);
     imageDestRect.X += aRect.X;
     imageDestRect.Y += aRect.Y;
     this.DrawImage(gr, image, imageDestRect, anItem.AutoTransparent);
     return imageDestRect;
 }
コード例 #5
0
 protected void GetTextLocation(ToolbarItem anItem, Rectangle aClientRect, SizeF textSize, out int aTextLeft, out int aTextTop)
 {
     this.GetLocationByAlignment(anItem.TextAlignment, aClientRect, textSize, out aTextLeft, out aTextTop);
 }
コード例 #6
0
 protected Size GetItemSize(ToolbarItem anItem)
 {
     Size empty = Size.Empty;
     if ((anItem.ImagePressed != null) && anItem.Pressed)
     {
         return anItem.ImagePressed.Size;
     }
     if (anItem.ImageDefault != null)
     {
         empty = anItem.ImageDefault.Size;
     }
     return empty;
 }
コード例 #7
0
 protected void DrawToolbarItem(Graphics gr, Rectangle aRect, ToolbarItem anItem, bool aFocused)
 {
     if (anItem.BackColor != Color.Transparent)
     {
         Rectangle rect = aRect;
         using (SolidBrush brush = new SolidBrush(anItem.BackColor))
         {
             gr.FillRectangle(brush, rect);
         }
     }
     if ((anItem.ImagePressed == null) && anItem.Pressed)
     {
         Rectangle rc = aRect;
         rc.Inflate(-1, -1);
         using (Pen pen = new Pen(anItem.FocusedColor))
         {
             DrawRoundedRect(gr, pen, anItem.FocusedColor, rc, this.KSelectionRoundSize);
         }
     }
     if ((anItem.ImagePressed != null) && anItem.Pressed)
     {
         this.DrawToolbarImage(gr, anItem, anItem.ImagePressed, aRect);
     }
     else if (anItem.ImageDefault != null)
     {
         this.DrawToolbarImage(gr, anItem, anItem.ImageDefault, aRect);
     }
     this.DrawText(gr, anItem, aRect);
 }
コード例 #8
0
 public void Add(ToolbarItem anItem)
 {
     anItem.RefreshRequired += new RefreshRequiredEventHandler(this.RefreshToolbarItemRequired);
     base.List.Add(anItem);
 }
コード例 #9
0
ファイル: TabPage.cs プロジェクト: north0808/haina
 public TabPage()
 {
     base.Text = "";
     this.m_TabItem = new ToolbarItem();
 }
コード例 #10
0
 protected void GetTextLocation(ToolbarItem anItem, Rectangle aClientRect, SizeF textSize, out int aTextLeft, out int aTextTop)
 {
     this.GetLocationByAlignment(anItem.TextAlignment, aClientRect, textSize, out aTextLeft, out aTextTop);
 }
コード例 #11
0
ファイル: ToolbarControl.cs プロジェクト: north0808/haina
 private ToolbarItem ReadToolbarItem(XmlReader reader)
 {
     ToolbarItem o = null;
     try
     {
         string str = reader["Name"];
         o = new ToolbarItem();
         if (this._designTimeCallback != null)
         {
             this._designTimeCallback(o, null);
         }
         o.Name = str;
         if (!reader.IsEmptyElement)
         {
             goto Label_00CF;
         }
         return o;
     Label_0042:
         try
         {
             string str2;
             if (((str2 = reader.Name) == null) || (str2 == ""))
             {
                 goto Label_00CF;
             }
             if (!(str2 == "ToolbarItem"))
             {
                 if (str2 == "Image")
                 {
                     goto Label_009E;
                 }
                 if (str2 == "Property")
                 {
                     goto Label_00A8;
                 }
                 goto Label_00CF;
             }
             if (this._designTimeCallback != null)
             {
                 this._designTimeCallback(o, null);
             }
             return o;
         Label_009E:
             this.ReadImage(o, reader);
             goto Label_00CF;
         Label_00A8:
             this.m_Conversion.SetProperty(o, reader["Name"], reader["Value"]);
         }
         catch
         {
         }
     Label_00CF:
         if (reader.Read())
         {
             goto Label_0042;
         }
     }
     catch
     {
         try
         {
             if (((reader.Name == "ToolbarItem") && reader.IsStartElement()) && !reader.IsEmptyElement)
             {
                 while (reader.Read())
                 {
                     if (reader.Name == "ToolbarItem")
                     {
                         goto Label_0122;
                     }
                 }
             }
         }
         catch
         {
         }
     }
     Label_0122:
     if (o != null)
     {
         return o;
     }
     return new ToolbarItem();
 }
コード例 #12
0
ファイル: ToolbarControl.cs プロジェクト: north0808/haina
 private void ReadImage(ToolbarItem anItem, XmlReader reader)
 {
     try
     {
         if (reader.Name == "Image")
         {
             Bitmap bitmap = ToolbarConversion.ImageFromString(reader["Data"]);
             this.m_Conversion.SetProperty(anItem, reader["Name"], bitmap);
         }
     }
     catch (Exception)
     {
     }
 }
コード例 #13
0
ファイル: TabPage.cs プロジェクト: windygu/haina
 public TabPage()
 {
     base.Text      = "";
     this.m_TabItem = new ToolbarItem();
 }
コード例 #14
0
 public void Insert(int index, ToolbarItem anItem)
 {
     anItem.RefreshRequired += new RefreshRequiredEventHandler(this.RefreshToolbarItemRequired);
     base.List.Insert(index, anItem);
 }
コード例 #15
0
 public void Insert(int index, ToolbarItem anItem)
 {
     anItem.RefreshRequired += new RefreshRequiredEventHandler(this.RefreshToolbarItemRequired);
     base.List.Insert(index, anItem);
 }
コード例 #16
0
 protected void DrawText(Graphics gr, ToolbarItem anItem, Rectangle aClientRect)
 {
     if ((anItem.Text != null) && (anItem.Text.Length != 0))
     {
         int num4;
         int num5;
         SolidBrush brush = new SolidBrush(anItem.ForeColor);
         string[] strArray = anItem.Text.Replace(@"\n", @"\").Split(new char[] { '\\' });
         SizeF ef = new SizeF(0f, 0f);
         float width = 0f;
         float height = 0f;
         for (int i = 0; i < strArray.Length; i++)
         {
             ef = gr.MeasureString(strArray[i], anItem.Font);
             if (width < ef.Width)
             {
                 width = ef.Width;
             }
             if (height < ef.Height)
             {
                 height = ef.Height;
             }
         }
         SizeF textSize = new SizeF(width, height * strArray.Length);
         this.GetTextLocation(anItem, aClientRect, textSize, out num4, out num5);
         Rectangle layoutRectangle = new Rectangle(aClientRect.X + num4, aClientRect.Y + num5, ((int) textSize.Width) + 1, ((int) textSize.Height) + 1);
         layoutRectangle.Height = (int) height;
         Region region = new Region(aClientRect);
         gr.Clip = region;
         StringFormat stringFormat = this.GetStringFormat(anItem.TextAlignment);
         for (int j = 0; j < strArray.Length; j++)
         {
             gr.DrawString(strArray[j], anItem.Font, brush, layoutRectangle, stringFormat);
             layoutRectangle.Y += (int) height;
         }
         gr.ResetClip();
         region.Dispose();
         region = null;
         brush.Dispose();
         brush = null;
     }
 }
コード例 #17
0
        public Rectangle DrawCentered(Graphics gr, Rectangle aRect, int aScrollBarValue)
        {
            Rectangle rectangle;
            bool      aFocused   = false;
            Rectangle rectangle2 = new Rectangle(0, 0, 0, aRect.Height);
            Point     point      = new Point(aRect.Location.X - aScrollBarValue, aRect.Location.Y);
            int       count      = base.m_ToolbarItems.Count;

            for (int i = 0; i < count; i++)
            {
                ToolbarItem anItem = base.m_ToolbarItems[i];
                if (anItem.Visible)
                {
                    Size itemSize;
                    if (anItem.ItemSizeType == ToolbarItemSizeType.ByImage)
                    {
                        itemSize = base.GetItemSize(anItem);
                        itemSize = new Size((int)(itemSize.Width * ToolbarControl.m_ScaleFactor.Width), (int)(itemSize.Height * ToolbarControl.m_ScaleFactor.Height));
                    }
                    else if (anItem.ItemSizeType == ToolbarItemSizeType.ByImageWithoutScaling)
                    {
                        itemSize = base.GetItemSize(anItem);
                    }
                    else
                    {
                        itemSize = anItem.CustomSize;
                        itemSize = new Size((int)(itemSize.Width * ToolbarControl.m_ScaleFactor.Width), (int)(itemSize.Height * ToolbarControl.m_ScaleFactor.Height));
                    }
                    rectangle = new Rectangle(point.X, point.Y, itemSize.Width, itemSize.Height);
                    anItem.ClientRectangle = rectangle;
                    point             = new Point(rectangle.Right, rectangle.Y);
                    rectangle2.Width += rectangle.Width;
                }
            }
            int offsetX = 0;

            switch (base.m_Alignment)
            {
            case Alignment.TopCenter:
            case Alignment.MiddleCenter:
            case Alignment.BottomCenter:
                offsetX = (aRect.Width - rectangle2.Width) / 2;
                if (rectangle2.Width > base.Width)
                {
                    offsetX += base.MarginAtBegin;
                }
                break;

            case Alignment.TopRight:
            case Alignment.MiddleRight:
            case Alignment.BottomRight:
                offsetX = aRect.Width - rectangle2.Width;
                break;
            }
            if (offsetX < 0)
            {
                offsetX = 0;
            }
            for (int j = 0; j < count; j++)
            {
                ToolbarItem item2 = base.m_ToolbarItems[j];
                if (item2.Visible)
                {
                    rectangle             = this.VerticalAlignItem(item2.ClientRectangle, offsetX, aRect);
                    item2.ClientRectangle = rectangle;
                    if (((rectangle.X <= aRect.Right) && (rectangle.X >= aRect.X)) || ((rectangle.Right >= aRect.X) && (rectangle.Right <= aRect.Right)))
                    {
                        base.DrawToolbarItem(gr, rectangle, item2, aFocused);
                    }
                }
            }
            return(rectangle2);
        }