protected override void Draw(Graphics gr, int yOffset, int parentWidth) { Resco.Controls.DetailView.DetailView parent = base.Parent; if (parent != null) { Rectangle rectangle = parent.CalculateClientRect(); int height = this.Height; if (height > 0) { yOffset = rectangle.Y + ((parent.PagesLocation == RescoPagesLocation.Top) ? 0 : (rectangle.Height - height)); if ((base.LabelBackColor != Color.Transparent) || !parent.UseGradient) { gr.FillRectangle(base.m_LabelBackBrush, rectangle.X, yOffset, rectangle.Width, height); } else if (parent.UseGradient) { Rectangle dstrc = new Rectangle(rectangle.X, yOffset, rectangle.Width, height); Rectangle srcrc = rectangle; GradientFill.Fill(gr, dstrc, srcrc, base.Parent.GradientBackColor); } switch (this.PageStyle) { case RescoPageStyle.TabStrip: this.DrawTabStrip(gr, rectangle.X, yOffset, rectangle.Width, height); return; case RescoPageStyle.Dots: this.DrawDots(gr, rectangle.X, yOffset, rectangle.Width, height); return; } this.DrawArrows(gr, rectangle.X, yOffset, rectangle.Width, height); } } }
private void ClickDots(int left, int width) { Resco.Controls.DetailView.DetailView parent = base.Parent; Rectangle rectangle = parent.CalculateClientRect(); PageCollection pages = parent.Pages; int height = this.Height; bool pagesRightToLeft = this.PagesRightToLeft; int pageCount = parent.PageCount; int num3 = 0; foreach (Page page in pages) { if (page.PagingItem.Visible) { num3++; } } int num4 = height / 4; int num5 = (rectangle.X + ((width - (num3 * height)) / 2)) + num4; for (int i = 0; i < pageCount; i++) { int num6 = pagesRightToLeft ? ((pageCount - i) - 1) : i; if (pages[num6].PagingItem.Visible) { if ((left > num5) && (left < (num5 + height))) { parent.CurrentPageIndex = num6; return; } num5 += height; } } }
protected override void Click(int yOffset, int parentWidth) { if (this.Enabled) { if (this.EditControl != null) { this.EditControl.Focus(); this.OnGotFocus(this, new ItemEventArgs(this, 0, base.Name)); } else { base.DisableEvents = true; Resco.Controls.DetailView.DetailView parent = base.Parent; if (parent != null) { Resco.Controls.NumericUpDown.NumericUpDown control = parent.GetControl(typeof(Resco.Controls.NumericUpDown.NumericUpDown)) as Resco.Controls.NumericUpDown.NumericUpDown; if (control != null) { control.DecimalPlaces = this.DecimalPlaces; control.Font = base.TextFont; control.Minimum = this.Minimum; control.Maximum = this.Maximum; control.Increment = this.Increment; control.TextAlign = base.TextAlign; control.UpDownWidth = this.UpDownWidth; control.UpDownAlign = this.ShowArrows ? this.UpDownAlign : UpDownAlignment.None; control.UpDownStyle = this.UpDownStyle; control.NoneText = this.NoneText; control.AllowNoneValue = this.AllowNoneValue; if (this.Value == null) { control.NoneValue = true; } else { control.NoneValue = false; } control.Value = this.NumericValue; control.ValueChanged += new EventHandler(this.OnValueChanged); this.EditControl = control; this.EditControl.Bounds = this.GetActivePartBounds(yOffset); base.DisableEvents = false; this.OnGotFocus(this, new ItemEventArgs(this, 0, base.Name)); base.DisableEvents = true; if (this.EditControl != null) { this.EditControl.BringToFront(); this.EditControl.Show(); this.EditControl.Focus(); } } base.DisableEvents = false; base.Click(yOffset, parentWidth); } } } }
private void UpdateStartDrawPage(int index, int dir) { PageCollection pages = base.Parent.Pages; int pageCount = base.Parent.PageCount; base.Parent.m_StartDrawPage = index; do { Resco.Controls.DetailView.DetailView parent = base.Parent; parent.m_StartDrawPage += dir; index += dir; }while (((index < pageCount) && (index > 0)) && !pages[index].PagingItem.Visible); }
internal Page(Resco.Controls.DetailView.DetailView parent, int iFirst, int iPageBreak) { this.m_parent = parent; this.m_iFirst = iFirst; if (iPageBreak >= 0) { this.m_Item = (ItemPageBreak)this.m_parent.Items[iPageBreak]; this.m_count = iPageBreak - iFirst; } else { this.m_count = this.m_parent.Items.Count - iFirst; this.m_Item = null; } }
protected internal override bool HandleKey(Keys key) { if (key == Keys.Left) { Resco.Controls.DetailView.DetailView parent = base.Parent; parent.CurrentPageIndex--; return(true); } if (key == Keys.Right) { Resco.Controls.DetailView.DetailView view2 = base.Parent; view2.CurrentPageIndex++; return(true); } return(false); }
internal override void SetParent(Resco.Controls.DetailView.DetailView o) { this.cm = null; if (o == null) { base.SetParent(o); } else { int selectedIndex = this.SelectedIndex; if (selectedIndex != -1) { this.m_SelectedIndex = -1; } base.SetParent(o); this.SelectedIndex = selectedIndex; } }
public Item() { this.m_border = Resco.Controls.DetailView.ItemBorder.Underline; this.m_dataMember = ""; this.m_bVisible = true; this.m_LabelWidth = -1; this.m_Name = ""; this.m_Parent = null; this.Changed = null; this.DisableEvents = false; this.DisableRefresh = false; this.Tag = null; this.m_Style = RescoItemStyle.LabelLeft; this.m_lineAlign = VerticalAlignment.Top; this.m_roundedCorner = RoundedCornerStyles.None; this.Label = ""; this.LabelToolTip = false; this.m_LabelTooLong = false; this.Enabled = true; this.EditValue = null; this.m_Size = new Size(-1, 0x10); this.m_NewLine = true; this.m_LabelHeight = 0x10; this.m_LabelAutoHeight = false; this.ErrorMessage = null; this.m_LabelAlignment = HorizontalAlignment.Right; this.m_LabelFont = DefaultFont; this.m_TextFont = DefaultFont; this.m_LabelBackColor = Color.Transparent; this.m_LabelForeColor = Color.Black; this.m_TextBackColor = Color.Transparent; this.m_PreviousColor = Color.Transparent; this.m_TextForeColor = Color.Black; this.m_TextAlign = HorizontalAlignment.Left; this.m_LabelBackBrush = new SolidBrush(Color.Transparent); this.m_LabelForeBrush = new SolidBrush(Color.Black); this.m_TextBackBrush = new SolidBrush(Color.Transparent); this.m_TextForeBrush = new SolidBrush(Color.Black); this.m_Pen = new Pen(Color.Gray); this.m_RedColor = Color.Red; this.m_RedBrush = new SolidBrush(this.m_RedColor); this.m_ErrorBackground = Resco.Controls.DetailView.ErrorBackground.Background; this.m_Text = ""; }
private void DrawDots(Graphics gr, int left, int top, int width, int height) { Resco.Controls.DetailView.DetailView parent = base.Parent; PageCollection pages = parent.Pages; bool pagesRightToLeft = this.PagesRightToLeft; int currentPageIndex = parent.CurrentPageIndex; int pageCount = parent.PageCount; int num2 = 0; foreach (Page page in pages) { if (page.PagingItem.Visible) { num2++; } } int num3 = height / 2; int num4 = height / 4; int x = (left + ((width - (num2 * height)) / 2)) + num4; int y = top + num4; for (int i = 0; i < pageCount; i++) { int num7 = pagesRightToLeft ? ((pageCount - i) - 1) : i; if (pages[num7].PagingItem.Visible) { if (parent.CurrentPageIndex == num7) { gr.FillEllipse(base.GetTextForeBrush(), x, y, num3, num3); } else { gr.FillEllipse((base.TextBackColor == Color.Transparent) ? this.m_GrayBrush : base.m_TextBackBrush, x, y, num3, num3); } x += height; } } }
internal void Draw(Graphics gr, int xOffset, int yOffset, int ctrlWidth, int ctrlHeight) { int num = yOffset; int pagerHeight = 0; Resco.Controls.DetailView.DetailView parent = this.Parent; Rectangle rectangle = parent.CalculateClientRect(); int currentPageIndex = parent.CurrentPageIndex; while (parent.HasPages && !parent.Pages[currentPageIndex].PagingItem.Visible) { currentPageIndex++; if (currentPageIndex >= parent.PageCount) { currentPageIndex = 0; } if (currentPageIndex == parent.CurrentPageIndex) { return; } } parent.CurrentPageIndex = currentPageIndex; IList currentPage = parent.CurrentPage; if (this.Parent.HasPages && (parent.PagesLocation == RescoPagesLocation.Top)) { num += this.Parent.PagerHeight; ctrlHeight += this.Parent.PagerHeight; pagerHeight = this.Parent.PagerHeight; } int num4 = 0; for (int i = 0; i < currentPage.Count; i++) { Item item = (Item)currentPage[i]; if (item != null) { if (num > (ctrlHeight + rectangle.Y)) { break; } int itemHeight = item.ItemHeight; if ((i == 0) || item.NewLine) { num4 = itemHeight; } if ((num + itemHeight) >= pagerHeight) { item._Draw(gr, num, ctrlWidth); } if (itemHeight > num4) { num4 = itemHeight; } if ((i == (currentPage.Count - 1)) || ((Item)currentPage[i + 1]).NewLine) { num += num4; } } } if (this.Parent.HasPages) { this.Parent.CurrentPage.PagingItem._Draw(gr, num, ctrlWidth); } }
internal virtual void SetParent(Resco.Controls.DetailView.DetailView o) { this.m_Parent = o; }
public Item(Item toCopy) { this.m_border = Resco.Controls.DetailView.ItemBorder.Underline; this.m_dataMember = ""; this.m_bVisible = true; this.m_LabelWidth = -1; this.m_Name = ""; this.m_Parent = null; this.Changed = null; this.DisableEvents = false; this.DisableRefresh = false; this.Tag = null; this.Style = toCopy.Style; this.m_lineAlign = toCopy.LineAlign; this.m_roundedCorner = toCopy.RoundedCorner; this.Label = toCopy.Label; this.Enabled = toCopy.Enabled; this.m_Size = toCopy.m_Size; this.m_NewLine = toCopy.m_NewLine; this.m_AutoHeight = toCopy.AutoHeight; this.m_LabelHeight = toCopy.LabelHeight; this.m_LabelWidth = toCopy.m_LabelWidth; this.m_LabelAutoHeight = toCopy.m_LabelAutoHeight; this.ErrorMessage = null; this.m_LabelAlignment = toCopy.LabelAlignment; this.m_LabelFont = toCopy.LabelFont; this.m_TextFont = toCopy.TextFont; this.m_LabelBackColor = toCopy.LabelBackColor; this.m_LabelForeColor = toCopy.LabelForeColor; this.m_TextBackColor = toCopy.TextBackColor; this.m_PreviousColor = this.m_TextBackColor; this.m_TextForeColor = toCopy.TextForeColor; this.m_TextAlign = toCopy.TextAlign; this.m_RedColor = toCopy.m_RedColor; this.m_ErrorBackground = toCopy.ErrorBackground; this.m_LabelBackBrush = new SolidBrush(this.m_LabelBackColor); this.m_LabelForeBrush = new SolidBrush(this.m_LabelForeColor); this.m_TextBackBrush = new SolidBrush(this.m_TextBackColor); this.m_TextForeBrush = new SolidBrush(this.m_TextForeColor); this.m_Pen = new Pen(Color.Gray); this.m_RedBrush = new SolidBrush(this.m_RedColor); this.m_dataMember = toCopy.DataMember; this.m_Name = toCopy.Name; this.m_border = toCopy.m_border; }
protected override void Click(int yOffset, int parentWidth) { if (this.Enabled) { if (this.EditControl != null) { this.EditControl.Focus(); this.OnGotFocus(this, new ItemEventArgs(this, 0, base.Name)); } else { base.DisableEvents = true; Resco.Controls.DetailView.DetailView parent = base.Parent; System.Windows.Forms.Control control = base.Parent.GetControl(this.GetDateTimePickerType()); if (control != null) { control.ForeColor = base.GetTextForeColor(); control.BackColor = base.GetTextBackColor(); control.Font = base.TextFont; control.Enabled = true; DateTimePickerInterface.SetFormat(control, Resco.Controls.DetailView.DateTimePickerFormat.CustomTime); DateTimePickerInterface.SetCustomFormat(control, this.m_Format); DateTimePickerInterface.SetShowNone(control, this.AllowNoneTime); DateTimePickerInterface.SetShowUpDown(control, this.ShowTimeUpDown); DateTimePickerInterface.SetShowDropDown(control, this.ShowDropDown); DateTimePickerInterface.SetShowTimeNone(control, this.ShowTimeNone); DateTimePickerInterface.SetNoneText(control, this.NoneText); DateTimePickerInterface.SetTimePickerStartTime(control, new DateTime(1, 1, 1, this.m_startTime.Hours, this.m_startTime.Minutes, this.m_startTime.Seconds)); DateTimePickerInterface.SetTimePickerEndTime(control, new DateTime(1, 1, 1, this.m_endTime.Hours, this.m_endTime.Minutes, this.m_endTime.Seconds)); DateTimePickerInterface.SetTimePickerMinuteInterval(control, this.m_minuteInterval); DateTimePickerInterface.SetChecked(control, true); try { if (this.EditValue == null) { DateTimePickerInterface.SetValue(control, DateTime.Now); if (this.AllowNoneTime) { DateTimePickerInterface.SetChecked(control, false); } } else { DateTimePickerInterface.SetValue(control, DateTime.Today.AddTicks(this.TimeSpan.Ticks)); } } catch { DateTimePickerInterface.SetValue(control, DateTime.Now); } this.EditControl = control; DateTimePickerInterface.AddValueChangedEvent(control, new EventHandler(this.OnValueChanged)); DateTimePickerInterface.AddNoneSelectedEvent(control, new EventHandler(this.OnValueChanged)); control.Bounds = this.GetActivePartBounds(yOffset); base.DisableEvents = false; this.OnGotFocus(this, new ItemEventArgs(this, 0, base.Name)); base.DisableEvents = true; if (this.EditControl != null) { this.EditControl.Show(); this.EditControl.Focus(); if (this.DropDownClicked(parentWidth, yOffset)) { DateTimePickerInterface.SetDroppedDown(this.EditControl, true); } } } base.DisableEvents = false; base.Click(yOffset, parentWidth); } } }
protected override void Click(int yOffset, int parentWidth) { Rectangle rectangle; bool pagesRightToLeft; Point lastMousePosition; int num2; PageCollection pages; int pageCount; int num4; int left = yOffset; if (base.Parent != null) { rectangle = base.Parent.CalculateClientRect(); pagesRightToLeft = this.PagesRightToLeft; switch (this.PageStyle) { case RescoPageStyle.TabStrip: lastMousePosition = base.Parent.LastMousePosition; lastMousePosition.X -= rectangle.X; lastMousePosition.Y -= rectangle.Y; num2 = pagesRightToLeft ? rectangle.Width : 0; pages = base.Parent.Pages; pageCount = base.Parent.PageCount; num4 = 0; goto Label_06FA; case RescoPageStyle.Dots: this.ClickDots(left, parentWidth); return; } if (((base.Parent.CurrentPageIndex != 0) && (left > this.m_RightArrow)) && (left < (this.m_RightArrow + Resco.Controls.DetailView.DetailView.ArrowImageSize.Width))) { Resco.Controls.DetailView.DetailView parent = base.Parent; parent.CurrentPageIndex--; } if (base.Parent.CurrentPageIndex != (base.Parent.PageCount - 1)) { if (pagesRightToLeft) { if ((left - rectangle.X) < Resco.Controls.DetailView.DetailView.ArrowImageSize.Width) { Resco.Controls.DetailView.DetailView view2 = base.Parent; view2.CurrentPageIndex++; return; } return; } if ((left - rectangle.X) <= (rectangle.Width - Resco.Controls.DetailView.DetailView.ArrowImageSize.Width)) { return; } Resco.Controls.DetailView.DetailView view3 = base.Parent; view3.CurrentPageIndex++; } } return; Label_01AE: if ((((lastMousePosition.X > (pagesRightToLeft ? Resco.Controls.DetailView.DetailView.TabImageSize.Width : (rectangle.Width - (2 * Resco.Controls.DetailView.DetailView.TabImageSize.Width)))) && (lastMousePosition.X < (pagesRightToLeft ? (2 * Resco.Controls.DetailView.DetailView.TabImageSize.Width) : (rectangle.Width - Resco.Controls.DetailView.DetailView.TabImageSize.Width)))) && (lastMousePosition.Y > ((base.Parent.PagesLocation == RescoPagesLocation.Bottom) ? (rectangle.Height - (2 * Resco.Controls.DetailView.DetailView.TabImageSize.Height)) : 0))) && (lastMousePosition.Y < ((base.Parent.PagesLocation == RescoPagesLocation.Bottom) ? (rectangle.Height - Resco.Controls.DetailView.DetailView.TabImageSize.Height) : Resco.Controls.DetailView.DetailView.TabImageSize.Height))) { if ((base.Parent.m_StartDrawPage > 0) && this.CheckStartDrawPage(num4, -1)) { if (pagesRightToLeft) { base.Parent.m_RightArrowClicked = true; } else { base.Parent.m_LeftArrowClicked = true; } base.Parent.Refresh(); Thread.Sleep(50); if (pagesRightToLeft) { base.Parent.m_RightArrowClicked = false; } else { base.Parent.m_LeftArrowClicked = false; } this.UpdateStartDrawPage(num4, -1); base.Parent.Refresh(); } return; } if ((((lastMousePosition.X > (pagesRightToLeft ? 0 : (rectangle.Width - Resco.Controls.DetailView.DetailView.TabImageSize.Width))) && (lastMousePosition.X < (pagesRightToLeft ? Resco.Controls.DetailView.DetailView.TabImageSize.Width : rectangle.Width))) && (lastMousePosition.Y > ((base.Parent.PagesLocation == RescoPagesLocation.Bottom) ? (rectangle.Height - (2 * Resco.Controls.DetailView.DetailView.TabImageSize.Height)) : 0))) && (lastMousePosition.Y < ((base.Parent.PagesLocation == RescoPagesLocation.Bottom) ? (rectangle.Height - Resco.Controls.DetailView.DetailView.TabImageSize.Height) : Resco.Controls.DetailView.DetailView.TabImageSize.Height))) { if ((base.Parent.m_StartDrawPage < (base.Parent.PageCount - 1)) && this.CheckStartDrawPage(num4, 1)) { if (pagesRightToLeft) { base.Parent.m_LeftArrowClicked = true; } else { base.Parent.m_RightArrowClicked = true; } base.Parent.Refresh(); Thread.Sleep(50); if (pagesRightToLeft) { base.Parent.m_LeftArrowClicked = false; } else { base.Parent.m_RightArrowClicked = false; } this.UpdateStartDrawPage(num4, 1); base.Parent.Refresh(); } return; } Label_0633: if (pagesRightToLeft) { if ((lastMousePosition.X > (num2 - (pages[num4].PagingItem.m_TextWidth + 10))) && (lastMousePosition.X < num2)) { base.Parent.CurrentPageIndex = num4; return; } num2 -= pages[num4].PagingItem.m_TextWidth + 10; if (num2 < 0) { return; } } else { if ((lastMousePosition.X > num2) && (lastMousePosition.X < ((num2 + pages[num4].PagingItem.m_TextWidth) + 10))) { base.Parent.CurrentPageIndex = num4; return; } num2 += pages[num4].PagingItem.m_TextWidth + 10; if (num2 > rectangle.Width) { return; } } Label_06F4: num4++; Label_06FA: if (num4 < pageCount) { if ((num4 < base.Parent.m_StartDrawPage) || !pages[num4].PagingItem.Visible) { goto Label_06F4; } if (!base.Parent.m_PagesOverWidth) { goto Label_0633; } switch (this.ArrowStyle) { case RescoArrowStyle.LeftRight: goto Label_01AE; case RescoArrowStyle.UpDown: if ((((lastMousePosition.X <= (pagesRightToLeft ? 0 : (rectangle.Width - Resco.Controls.DetailView.DetailView.TabImageSize.Width))) || (lastMousePosition.X >= (pagesRightToLeft ? Resco.Controls.DetailView.DetailView.TabImageSize.Width : rectangle.Width))) || (lastMousePosition.Y <= ((base.Parent.PagesLocation == RescoPagesLocation.Bottom) ? (rectangle.Height - (2 * Resco.Controls.DetailView.DetailView.TabImageSize.Height)) : 0))) || (lastMousePosition.Y >= ((base.Parent.PagesLocation == RescoPagesLocation.Bottom) ? (rectangle.Height - Resco.Controls.DetailView.DetailView.TabImageSize.Height) : Resco.Controls.DetailView.DetailView.TabImageSize.Height))) { if ((((lastMousePosition.X > (pagesRightToLeft ? 0 : (rectangle.Width - Resco.Controls.DetailView.DetailView.TabImageSize.Width))) && (lastMousePosition.X < (pagesRightToLeft ? Resco.Controls.DetailView.DetailView.TabImageSize.Width : rectangle.Width))) && (lastMousePosition.Y > ((base.Parent.PagesLocation == RescoPagesLocation.Bottom) ? (rectangle.Height - Resco.Controls.DetailView.DetailView.TabImageSize.Height) : Resco.Controls.DetailView.DetailView.TabImageSize.Height))) && (lastMousePosition.Y < ((base.Parent.PagesLocation == RescoPagesLocation.Bottom) ? rectangle.Height : (2 * Resco.Controls.DetailView.DetailView.TabImageSize.Height)))) { if ((base.Parent.m_StartDrawPage < (base.Parent.PageCount - 1)) && this.CheckStartDrawPage(num4, 1)) { base.Parent.m_RightArrowClicked = true; base.Parent.Refresh(); Thread.Sleep(50); base.Parent.m_RightArrowClicked = false; this.UpdateStartDrawPage(num4, 1); base.Parent.Refresh(); } return; } goto Label_0633; } if ((base.Parent.m_StartDrawPage > 0) && this.CheckStartDrawPage(num4, -1)) { base.Parent.m_LeftArrowClicked = true; base.Parent.Refresh(); Thread.Sleep(50); base.Parent.m_LeftArrowClicked = false; this.UpdateStartDrawPage(num4, -1); base.Parent.Refresh(); } return; } goto Label_01AE; } }
private void DrawTabStrip(Graphics gr, int left, int top, int width, int height) { Resco.Controls.DetailView.DetailView parent = base.Parent; PageCollection pages = parent.Pages; int num = (parent.PagesLocation == RescoPagesLocation.Top) ? height : 0; int pageCount = parent.PageCount; bool pagesRightToLeft = this.PagesRightToLeft; int num3 = left; if (parent.PagesLocation == RescoPagesLocation.Top) { top--; } left += pagesRightToLeft ? width : 0; int num4 = 0; for (int i = 0; i < pageCount; i++) { if (pages[i].PagingItem.Visible) { string text = pages[i].Text; ItemPageBreak pagingItem = pages[i].PagingItem; SizeF ef = gr.MeasureString(text, pagingItem.TextFont); pagingItem.m_TextWidth = Convert.ToInt32(Math.Ceiling((double)ef.Width)); pagingItem.m_TextHeight = Convert.ToInt32(Math.Ceiling((double)ef.Height)); num4 += pagingItem.m_TextWidth + 10; parent.m_PagesOverWidth = (parent.m_StartDrawPage != 0) || (num4 >= width); if (i >= parent.m_StartDrawPage) { int x = left - (pagesRightToLeft ? (pagingItem.m_TextWidth + 10) : 0); if (parent.CurrentPageIndex == i) { if ((base.TextBackColor != Color.Transparent) || !base.Parent.UseGradient) { gr.FillRectangle(base.m_TextBackBrush, x, top, pagingItem.m_TextWidth + 10, height); } } else { gr.FillRectangle(this.m_GrayBrush, x, top, pagingItem.m_TextWidth + 10, height); } if (parent.CurrentPageIndex != i) { gr.DrawLine(this.m_BlackPen, x, top + num, ((x + pagingItem.m_TextWidth) + 10) - 1, top + num); } gr.DrawLine(this.m_BlackPen, x + (pagesRightToLeft ? 0 : ((pagingItem.m_TextWidth + 10) - 1)), top, x + (pagesRightToLeft ? 0 : ((pagingItem.m_TextWidth + 10) - 1)), top + height); gr.DrawString(text, pagingItem.TextFont, pagingItem.GetTextForeBrush(), new Rectangle(x + 5, top + ((height - pagingItem.m_TextHeight) / 2), pagingItem.m_TextWidth, pagingItem.m_TextHeight)); if (pagesRightToLeft) { left -= pagingItem.m_TextWidth + 10; if (left < 0) { break; } } else { left += pagingItem.m_TextWidth + 10; if (left > width) { break; } } } } } if (pagesRightToLeft) { if (left > 0) { gr.DrawLine(this.m_BlackPen, num3, top + num, left, top + num); } } else if (left < width) { gr.DrawLine(this.m_BlackPen, left, top + num, num3 + width, top + num); } if (parent.m_PagesOverWidth) { bool isLeftRight = this.ArrowStyle == RescoArrowStyle.LeftRight; Image image = Resco.Controls.DetailView.DetailView.GetArrow(true, isLeftRight, parent.m_RightArrowClicked, true); Image image2 = Resco.Controls.DetailView.DetailView.GetArrow(false, isLeftRight, parent.m_LeftArrowClicked, true); if (isLeftRight) { Rectangle destRect = new Rectangle(num3 + (pagesRightToLeft ? 0 : (width - (Resco.Controls.DetailView.DetailView.TabImageSize.Width * 2))), top, Resco.Controls.DetailView.DetailView.TabImageSize.Width, Resco.Controls.DetailView.DetailView.TabImageSize.Height); Rectangle srcRect = new Rectangle(0, 0, image2.Width, image2.Height); gr.DrawImage(image2, destRect, srcRect, GraphicsUnit.Pixel); destRect.X = num3 + (pagesRightToLeft ? Resco.Controls.DetailView.DetailView.TabImageSize.Width : (width - Resco.Controls.DetailView.DetailView.TabImageSize.Width)); srcRect = new Rectangle(0, 0, image.Width, image.Height); gr.DrawImage(image, destRect, srcRect, GraphicsUnit.Pixel); } else { Rectangle rectangle3 = new Rectangle(num3 + (pagesRightToLeft ? 0 : (width - Resco.Controls.DetailView.DetailView.TabImageSize.Width)), top, Resco.Controls.DetailView.DetailView.TabImageSize.Width, Resco.Controls.DetailView.DetailView.TabImageSize.Height); Rectangle rectangle4 = new Rectangle(0, 0, image2.Width, image2.Height); gr.DrawImage(image2, rectangle3, rectangle4, GraphicsUnit.Pixel); rectangle3.Y = top + Resco.Controls.DetailView.DetailView.TabImageSize.Height; rectangle4 = new Rectangle(0, 0, image.Width, image.Height); gr.DrawImage(image, rectangle3, rectangle4, GraphicsUnit.Pixel); } } }
private void DrawArrows(Graphics gr, int left, int top, int width, int height) { Image image; Image image2; Resco.Controls.DetailView.DetailView parent = base.Parent; Font labelFont = base.LabelFont; string text = null; int currentPageIndex = parent.CurrentPageIndex; int pageCount = parent.PageCount; int y = top + ((height - Resco.Controls.DetailView.DetailView.ArrowImageSize.Height) / 2); int num6 = top; bool pagesRightToLeft = this.PagesRightToLeft; bool splitArrows = this.SplitArrows; int num7 = left; if (parent.PagesLocation == RescoPagesLocation.Top) { gr.DrawLine(this.m_BlackPen, left, (top + height) - 1, left + width, (top + height) - 1); } else { gr.DrawLine(this.m_BlackPen, left, top - 1, left + width, top - 1); } left += pagesRightToLeft ? 0 : (width - Resco.Controls.DetailView.DetailView.ArrowImageSize.Width); bool isLeftRight = this.ArrowStyle == RescoArrowStyle.LeftRight; if (pagesRightToLeft) { image = Resco.Controls.DetailView.DetailView.GetArrow(false, isLeftRight, currentPageIndex == (pageCount - 1), false); image2 = Resco.Controls.DetailView.DetailView.GetArrow(true, isLeftRight, currentPageIndex == 0, false); } else { image = Resco.Controls.DetailView.DetailView.GetArrow(true, isLeftRight, currentPageIndex == (pageCount - 1), false); image2 = Resco.Controls.DetailView.DetailView.GetArrow(false, isLeftRight, currentPageIndex == 0, false); } Rectangle destRect = new Rectangle(left, y, Resco.Controls.DetailView.DetailView.ArrowImageSize.Width, Resco.Controls.DetailView.DetailView.ArrowImageSize.Height); if (this._ia == null) { Color pixel = ((Bitmap)image).GetPixel(0, 0); this._ia = new ImageAttributes(); this._ia.SetColorKey(pixel, pixel); } gr.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, this._ia); left += pagesRightToLeft ? 10 : -10; switch (this.PageNumberStyle) { case RescoPageNumberStyle.None: break; case RescoPageNumberStyle.Current: text = string.Format("{0}", currentPageIndex + 1); break; default: if (pagesRightToLeft) { text = string.Format("{1}/{0}", currentPageIndex + 1, pageCount); } else { text = string.Format("{0}/{1}", currentPageIndex + 1, pageCount); } break; } int num2 = left; int num = 0; if (text != null) { SizeF ef = gr.MeasureString(text, labelFont); num = Convert.ToInt32(Math.Ceiling((double)ef.Width)); if (splitArrows) { left = num7 + ((width - num) / 2); } else { left += num * (pagesRightToLeft ? 1 : -1); } height = Convert.ToInt32(Math.Ceiling((double)ef.Height)); num6 += (this.Height - height) / 2; gr.DrawString(text, labelFont, base.m_LabelForeBrush, (float)left, (float)num6); if (!splitArrows) { left += pagesRightToLeft ? (num + 10) : -10; } num2 = left; } if (splitArrows) { left = num7 + (pagesRightToLeft ? (width - Resco.Controls.DetailView.DetailView.ArrowImageSize.Width) : Resco.Controls.DetailView.DetailView.ArrowImageSize.Width); } left += pagesRightToLeft ? 0 : -Resco.Controls.DetailView.DetailView.ArrowImageSize.Width; destRect.X = left; gr.DrawImage(image2, destRect, 0, 0, image2.Width, image2.Height, GraphicsUnit.Pixel, this._ia); this.m_RightArrow = left; if (this.ShowPageText) { text = this.Text; labelFont = base.TextFont; if (pagesRightToLeft) { if (splitArrows) { base.DrawAlignmentString(gr, text, labelFont, base.GetTextForeBrush(), new Rectangle((num7 + num2) + num, num6, ((width - num2) - num) - Resco.Controls.DetailView.DetailView.ArrowImageSize.Width, height), HorizontalAlignment.Right, VerticalAlignment.Top); } else { base.DrawAlignmentString(gr, text, labelFont, base.GetTextForeBrush(), new Rectangle((num7 + left) + 8, num6, (width - left) - 8, height), HorizontalAlignment.Right, VerticalAlignment.Top); } } else if (splitArrows) { gr.DrawString(text, labelFont, base.GetTextForeBrush(), new Rectangle((num7 + 8) + Resco.Controls.DetailView.DetailView.ArrowImageSize.Width, num6, Math.Max(0, (num2 - 8) - Resco.Controls.DetailView.DetailView.ArrowImageSize.Width), height)); } else { gr.DrawString(text, labelFont, base.GetTextForeBrush(), new Rectangle(num7 + 8, num6, Math.Max(8, left - 8), height)); } } }