protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); Graphics g = pe.Graphics; // рамка SmallHelper.DrawRect(g, m_pen_BorderBounds, m_rect_BorderBounds); // стрелка if (!_lock_) { if (triangle_bounds > 0) { if (this.Focused || SelectorOpened) { SmallHelper.DrawRect(g, SelectorOpened ? m_pen_ArrowRectBounds_Pressed : m_pen_ArrowRectBounds, m_rect_ArrowRect); } SmallHelper.FillRectInside(g, SelectorOpened ? m_brush_ArrowRect_Pressed : m_brush_ArrowRect, m_rect_ArrowRect); } else { if (this.Focused || SelectorOpened) { for (int i = 0; i < splitter_width; i++) { g.DrawLine(m_pens_Splitter[i >= m_pens_Splitter.Length ? m_pens_Splitter.Length - 1 : i], m_rect_ArrowRect.X - 1 - i, m_rect_BorderBounds.Top, m_rect_ArrowRect.X - 1 - i, m_rect_BorderBounds.Bottom - 1); } } g.FillRectangle(SelectorOpened ? m_brush_ArrowRect_Pressed : m_brush_ArrowRect, m_rect_ArrowRect); } g.FillPolygon(SelectorOpened ? m_brush_Arrow_Pressed : m_brush_Arrow, m_points_Arrow); } }
protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); Graphics g = pe.Graphics; // рамка SmallHelper.DrawRect(g, ContractSelector.m_pen_MainBounds2, m_rect_MainBorderBounds); m_rect_MainBorderBounds.Inflate(-1, -1); SmallHelper.DrawRect(g, ContractSelector.m_pen_MainBounds1, m_rect_MainBorderBounds); m_rect_MainBorderBounds.Inflate(1, 1); if (m_result == null) { return; } if (!this.m_result.IsDefined() || this.m_result.IsContractNo()) { // надпись [контракт не определён] или [контракт не установлен] String s1 = "Контракт"; String s2 = (!this.m_result.IsDefined() ? "не определён!" : "не установлен"); SizeF sf1 = g.MeasureString(s1, font2); SizeF sf2 = g.MeasureString(s2, font2); int y_distance = -8; g.DrawString(s1, font2, (!this.m_result.IsDefined() ? ContractSelector.m_brush_String_RED : ContractSelector.m_brush_String_BLACK), m_rect_MainBorderBounds.X + (m_rect_MainBorderBounds.Width - sf1.Width) / 2, m_rect_MainBorderBounds.Y + (m_rect_MainBorderBounds.Height - sf1.Height - sf2.Height - y_distance) / 2); g.DrawString(s2, font2, (!this.m_result.IsDefined() ? ContractSelector.m_brush_String_RED : ContractSelector.m_brush_String_BLACK), m_rect_MainBorderBounds.X + (m_rect_MainBorderBounds.Width - sf2.Width) / 2, m_rect_MainBorderBounds.Y + (m_rect_MainBorderBounds.Height - sf1.Height - sf2.Height - y_distance) / 2 + sf1.Height + y_distance); } else { // кнопка [<] SmallHelper.DrawRect(g, (!this.m_result.IsMin) ? (CapturedArea == Area.ArrowLeft && StickArea == CapturedArea ? ContractSelector.m_pen_Arrows_SELECTED : ContractSelector.m_pen_Arrows_ACTIVE) : ContractSelector.m_pen_Arrows_NONACTIVE, m_rect_QuantityDecreaseBounds); SmallHelper.FillRectInside(g, (!this.m_result.IsMin) ? (CapturedArea == Area.ArrowLeft && StickArea == CapturedArea ? ContractSelector.m_brush_Arrows_SELECTED : ContractSelector.m_brush_Arrows_ACTIVE) : ContractSelector.m_brush_Arrows_NONACTIVE, m_rect_QuantityDecreaseBounds); SmallHelper.DrawBmpTransp(g, (!this.m_result.IsMin) ? ContractSelector.m_bmp_Arrow_Left : ContractSelector.m_bmp_Arrow_Left_Passive, new Point(m_rect_QuantityDecreaseBounds.Right - arrow_offset - ContractSelector.m_bmp_Arrow_Left.Width, m_rect_QuantityDecreaseBounds.Top + (m_rect_QuantityDecreaseBounds.Height - ContractSelector.m_bmp_Arrow_Left.Height) / 2)); // кнопка [>] SmallHelper.DrawRect(g, (!this.m_result.IsMax) ? (CapturedArea == Area.ArrowRight && StickArea == CapturedArea ? ContractSelector.m_pen_Arrows_SELECTED : ContractSelector.m_pen_Arrows_ACTIVE) : ContractSelector.m_pen_Arrows_NONACTIVE, m_rect_QuantityIncreaseBounds); SmallHelper.FillRectInside(g, (!this.m_result.IsMax) ? (CapturedArea == Area.ArrowRight && StickArea == CapturedArea ? ContractSelector.m_brush_Arrows_SELECTED : ContractSelector.m_brush_Arrows_ACTIVE) : ContractSelector.m_brush_Arrows_NONACTIVE, m_rect_QuantityIncreaseBounds); SmallHelper.DrawBmpTransp(g, (!this.m_result.IsMax) ? ContractSelector.m_bmp_Arrow_Right : ContractSelector.m_bmp_Arrow_Right_Passive, new Point(m_rect_QuantityIncreaseBounds.Left + arrow_offset, m_rect_QuantityIncreaseBounds.Top + (m_rect_QuantityIncreaseBounds.Height - ContractSelector.m_bmp_Arrow_Right.Height) / 2)); // цифра RectangleF rf = SmallHelper.StringInMiddle(g, new Rectangle(m_rect_QuantityDecreaseBounds.Right, m_rect_QuantityDecreaseBounds.Top, m_rect_QuantityIncreaseBounds.Left - m_rect_QuantityDecreaseBounds.Right, m_rect_QuantityDecreaseBounds.Height), this.m_result.ToString(), this.Font); g.DrawString(this.m_result.ToString(), this.Font, this.m_result.Quantity >= 0 ? ContractSelector.m_brush_String_GREEN : ContractSelector.m_brush_String_RED, rf /*m_rect_QuantityNumber.X, m_rect_QuantityNumber.Y*/); } }
protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); Graphics g = pe.Graphics; // [delme!!!] Заполнить чем-то всю область g.FillRectangle(new SolidBrush(Color.Gray), this.ClientRectangle); // Граница SmallHelper.DrawRect(g, m_pen_Black, new Rectangle(0, 0, total_width, total_height)); SmallHelper.FillRectInside(g, m_brush, new Rectangle(0, 0, total_width, total_height)); // Элементы Rectangle r = new Rectangle(); RectangleF rf; int jw = 1, jh = 1; bool jf = false; object o; for (int i = 0; i < DATA__arr.Count; i++) { for (int j = 0; j < DATA__columns; j++) { if (GetJoinInfo(j, i, out jf, out jw, out jh) == true) { if (!jf) { continue; } } r.Width = (jw - 1) * PAINT__border_delay + 2 * jw; for (int x = j; x < (j + jw); x++) { r.Width += PAINT__columns_widths[x]; } r.Height = (jh - 1) * PAINT__border_delay + 2 * jh; for (int x = i; x < (i + jh); x++) { r.Height += (x < PAINT__columns_heights.Count ? PAINT__columns_heights[x] : PAINT__data_height); } r.X = (1 + PAINT__border_delay); for (int x = 0; x < j; x++) { r.X += (PAINT__columns_widths[x] + 1 + PAINT__border_delay + 1); } r.Y = (1 + PAINT__border_delay); for (int x = 0; x < i; x++) { r.Y += (x < PAINT__columns_heights.Count ? PAINT__columns_heights[x] : PAINT__data_height) + 1 + PAINT__border_delay + 1; } SmallHelper.DrawRect(g, m_pen_Black, r); bool isHeader = (i < PAINT__headerLinesUp) || (j < PAINT__headerLinesLeft); SmallHelper.FillRectInside(g, (isHeader ? m_brushH : ((i - PAINT__headerLinesUp) % 2 == 0 ? m_brush1 : m_brush2)), r); o = ((ArrayList)DATA__arr[i])[j]; rf = SmallHelper.StringInMiddle(g, r, (o == null ? "" : o.ToString()), (isHeader ? this.FontBold : this.Font)); SmallHelper.DrawMultiString(g, r, (o == null ? "" : o.ToString()), (isHeader ? this.FontBold : this.Font), m_brush_Font, StringAlignment.Center, StringAlignment.Center, StringAlignment.Center, 0, 0, -5); //g.DrawString((o == null ? "" : o.ToString()), (isHeader ? this.FontBold : this.Font), m_brush_Font, rf); } } g.Dispose(); }
protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); Graphics g = pe.Graphics; RectangleF rf, rf2; // рамка SmallHelper.DrawRect(g, m_pen_MainBounds2, m_rect_MainBorderBounds); m_rect_MainBorderBounds.Inflate(-1, -1); SmallHelper.DrawRect(g, m_pen_MainBounds1, m_rect_MainBorderBounds); m_rect_MainBorderBounds.Inflate(1, 1); if (this.m_contract == null) { return; } // кнопка [<] SmallHelper.DrawRect(g, (this.m_contract.Quantity > 1) ? (CapturedArea == Area.ArrowLeft && StickArea == CapturedArea ? m_pen_Arrows_SELECTED : m_pen_Arrows_ACTIVE) : m_pen_Arrows_NONACTIVE, m_rect_QuantityDecreaseBounds); SmallHelper.FillRectInside(g, (this.m_contract.Quantity > 1) ? (CapturedArea == Area.ArrowLeft && StickArea == CapturedArea ? m_brush_Arrows_SELECTED : m_brush_Arrows_ACTIVE) : m_brush_Arrows_NONACTIVE, m_rect_QuantityDecreaseBounds); SmallHelper.DrawBmpTransp(g, (this.m_contract.Quantity > 1) ? m_bmp_Arrow_Left : m_bmp_Arrow_Left_Passive, new Point(m_rect_QuantityDecreaseBounds.Right - arrow_offset - m_bmp_Arrow_Left.Width, m_rect_QuantityDecreaseBounds.Top + (m_rect_QuantityDecreaseBounds.Height - m_bmp_Arrow_Left.Height) / 2)); // кнопка [>] SmallHelper.DrawRect(g, (this.m_contract.Quantity < 7 && this.m_contract.Quantity != 0) ? (CapturedArea == Area.ArrowRight && StickArea == CapturedArea ? m_pen_Arrows_SELECTED : m_pen_Arrows_ACTIVE) : m_pen_Arrows_NONACTIVE, m_rect_QuantityIncreaseBounds); SmallHelper.FillRectInside(g, (this.m_contract.Quantity < 7 && this.m_contract.Quantity != 0) ? (CapturedArea == Area.ArrowRight && StickArea == CapturedArea ? m_brush_Arrows_SELECTED : m_brush_Arrows_ACTIVE) : m_brush_Arrows_NONACTIVE, m_rect_QuantityIncreaseBounds); SmallHelper.DrawBmpTransp(g, (this.m_contract.Quantity < 7 && this.m_contract.Quantity != 0) ? m_bmp_Arrow_Right : m_bmp_Arrow_Right_Passive, new Point(m_rect_QuantityIncreaseBounds.Left + arrow_offset, m_rect_QuantityIncreaseBounds.Top + (m_rect_QuantityIncreaseBounds.Height - m_bmp_Arrow_Right.Height) / 2)); // цифра rf = SmallHelper.StringInMiddle(g, new Rectangle(m_rect_QuantityDecreaseBounds.Right, m_rect_QuantityDecreaseBounds.Top, m_rect_QuantityIncreaseBounds.Left - m_rect_QuantityDecreaseBounds.Right, m_rect_QuantityDecreaseBounds.Height), this.m_contract.GetString1(), quantityNum_font); g.DrawString(this.m_contract.GetString1(), quantityNum_font, m_brush_String, rf /*m_rect_QuantityNumber.X, m_rect_QuantityNumber.Y*/); // козыри rf = SmallHelper.StringInMiddle(g, new Rectangle(m_rect_ClubsBounds.X, m_rect_ClubsBounds.Y, m_bmp_CuteBtn.Width, m_bmp_CuteBtn.Height), "♣", suits_font); SmallHelper.DrawBmpTransp(g, (this.m_contract.Trump == CardTrump.Clubs || CapturedArea == Area.Clubs && StickArea == CapturedArea) ? m_bmp_CuteBtn_Selected : m_bmp_CuteBtn, m_rect_ClubsBounds.Location); g.DrawString("♣", suits_font, (this.m_contract.Trump == CardTrump.Clubs || CapturedArea == Area.Clubs && StickArea == CapturedArea) ? m_brush_String_ANTIBLACK : m_brush_String_BLACK, rf.X, rf.Y); rf = SmallHelper.StringInMiddle(g, new Rectangle(m_rect_SpadesBounds.X, m_rect_SpadesBounds.Y, m_bmp_CuteBtn.Width, m_bmp_CuteBtn.Height), "♠", suits_font); SmallHelper.DrawBmpTransp(g, (this.m_contract.Trump == CardTrump.Spades || CapturedArea == Area.Spades && StickArea == CapturedArea) ? m_bmp_CuteBtn_Selected : m_bmp_CuteBtn, m_rect_SpadesBounds.Location); g.DrawString("♠", suits_font, (this.m_contract.Trump == CardTrump.Spades || CapturedArea == Area.Spades && StickArea == CapturedArea) ? m_brush_String_ANTIBLACK : m_brush_String_BLACK, rf.X, rf.Y); rf = SmallHelper.StringInMiddle(g, new Rectangle(m_rect_HeartsBounds.X, m_rect_HeartsBounds.Y, m_bmp_CuteBtn.Width, m_bmp_CuteBtn.Height), "♥", suits_font); SmallHelper.DrawBmpTransp(g, (this.m_contract.Trump == CardTrump.Hearts || CapturedArea == Area.Hearts && StickArea == CapturedArea) ? m_bmp_CuteBtn_Selected : m_bmp_CuteBtn, m_rect_HeartsBounds.Location); g.DrawString("♥", suits_font, (this.m_contract.Trump == CardTrump.Hearts || CapturedArea == Area.Hearts && StickArea == CapturedArea) ? m_brush_String_ANTIRED : m_brush_String_RED, rf.X, rf.Y); rf = SmallHelper.StringInMiddle(g, new Rectangle(m_rect_DiamondsBounds.X, m_rect_DiamondsBounds.Y, m_bmp_CuteBtn.Width, m_bmp_CuteBtn.Height), "♦", suits_font); SmallHelper.DrawBmpTransp(g, (this.m_contract.Trump == CardTrump.Diamonds || CapturedArea == Area.Diamonds && StickArea == CapturedArea) ? m_bmp_CuteBtn_Selected : m_bmp_CuteBtn, m_rect_DiamondsBounds.Location); g.DrawString("♦", suits_font, (this.m_contract.Trump == CardTrump.Diamonds || CapturedArea == Area.Diamonds && StickArea == CapturedArea) ? m_brush_String_ANTIRED : m_brush_String_RED, rf.X, rf.Y); rf = SmallHelper.StringInMiddle(g, new Rectangle(m_rect_NTBounds.X, m_rect_NTBounds.Y, m_bmp_CuteBtn_Twice.Width, m_bmp_CuteBtn_Twice.Height), "N", nt_font); rf2 = SmallHelper.StringInMiddle(g, new Rectangle(m_rect_NTBounds.X, m_rect_NTBounds.Y, m_bmp_CuteBtn_Twice.Width, m_bmp_CuteBtn_Twice.Height), "T", nt_font); float nt_height = rf.Height + n_t_distance + rf2.Height; float n_y = m_rect_NTBounds.Y + (m_bmp_CuteBtn_Twice.Height - nt_height) / 2; float t_y = n_y + rf.Height + n_t_distance; SmallHelper.DrawBmpTransp(g, (this.m_contract.Trump == CardTrump.NT || CapturedArea == Area.NT && StickArea == CapturedArea) ? m_bmp_CuteBtn_Twice_Selected : m_bmp_CuteBtn_Twice, m_rect_NTBounds.Location); g.DrawString("N", nt_font, (this.m_contract.Trump == CardTrump.NT || CapturedArea == Area.NT && StickArea == CapturedArea) ? m_brush_String_ANTIBLACK : m_brush_String_BLACK, rf.X, n_y /*m_rect_NTBounds.X + nt_offset[0].X, m_rect_NTBounds.Y + nt_offset[0].Y*/); g.DrawString("T", nt_font, (this.m_contract.Trump == CardTrump.NT || CapturedArea == Area.NT && StickArea == CapturedArea) ? m_brush_String_ANTIBLACK : m_brush_String_BLACK, rf2.X, t_y /*m_rect_NTBounds.X + nt_offset[1].X, m_rect_NTBounds.Y + nt_offset[1].Y*/); // контра SmallHelper.DrawBmpTransp(g, (CapturedArea == Area.Contra && StickArea == CapturedArea) ? m_bmp_Check_Half : (this.m_contract.Contra ? m_bmp_Check_True : m_bmp_Check_False), new Point(m_rect_ContraBounds.Left + check_offset_img.X, m_rect_ContraBounds.Top + check_offset_img.Y)); g.DrawString("Double", re_contra_font, m_brush_String, m_rect_ContraBounds.Left + check_offset_img.X + m_bmp_Check_False.Width + check_offset_text.X, m_rect_ContraBounds.Top + check_offset_text.Y); // реконтра SmallHelper.DrawBmpTransp(g, (CapturedArea == Area.ReContra && StickArea == CapturedArea) ? m_bmp_Check_Half : (this.m_contract.ReContra ? m_bmp_Check_True : m_bmp_Check_False), new Point(m_rect_ReContraBounds.Left + check_offset_img.X, m_rect_ReContraBounds.Top + check_offset_img.Y)); g.DrawString("Redouble", re_contra_font, m_brush_String, m_rect_ReContraBounds.Left + check_offset_img.X + m_bmp_Check_False.Width + check_offset_text.X, m_rect_ReContraBounds.Top + check_offset_text.Y); // неконтракт rf = SmallHelper.StringInMiddle(g, m_rect_NOCONTRACT, "ВСЕ ПАС", NO_font); SmallHelper.DrawBmpTransp(g, (CapturedArea == Area.NOCONTRACT && StickArea == CapturedArea) ? (this.m_contract.NoContract == true ? m_bmp_CuteBtn_Long : m_bmp_CuteBtn_Long_Selected) : (this.m_contract.NoContract == true ? m_bmp_CuteBtn_Long_Selected : m_bmp_CuteBtn_Long), m_rect_NOCONTRACT.Location); g.DrawString("ВСЕ ПАС", NO_font, (CapturedArea == Area.NOCONTRACT && StickArea == CapturedArea) ? (this.m_contract.NoContract == true ? m_brush_String_RED : m_brush_String_ANTIRED) : (this.m_contract.NoContract == true ? m_brush_String_ANTIRED : m_brush_String_RED), rf.X, rf.Y); }