/// <summary> /// Panel Slot Paint /// </summary> private void PnlSlotPaint(object sender, PaintEventArgs e) { var pnl = (ContextPanel)sender; Graphics g = e.Graphics; var slot = (int)pnl.Tag; int width = pnl.ClientSize.Width; SlotTypes slotType = _strategy.GetSlotType(slot); Color colorBackground = LayoutColors.ColorSlotBackground; Color colorCaptionText = LayoutColors.ColorSlotCaptionText; Color colorCaptionBackOpen = LayoutColors.ColorSlotCaptionBackOpen; Color colorCaptionBackOpenFilter = LayoutColors.ColorSlotCaptionBackOpenFilter; Color colorCaptionBackClose = LayoutColors.ColorSlotCaptionBackClose; Color colorCaptionBackCloseFilter = LayoutColors.ColorSlotCaptionBackCloseFilter; Color colorIndicatorNameText = LayoutColors.ColorSlotIndicatorText; Color colorLogicText = LayoutColors.ColorSlotLogicText; Color colorParamText = LayoutColors.ColorSlotParamText; Color colorValueText = LayoutColors.ColorSlotValueText; Color colorDash = LayoutColors.ColorSlotDash; // Caption string stringCaptionText = string.Empty; Color colorCaptionBack = LayoutColors.ColorSignalRed; switch (slotType) { case SlotTypes.Open: stringCaptionText = Language.T("Opening Point of the Position"); colorCaptionBack = colorCaptionBackOpen; break; case SlotTypes.OpenFilter: stringCaptionText = Language.T("Opening Logic Condition"); colorCaptionBack = colorCaptionBackOpenFilter; break; case SlotTypes.Close: stringCaptionText = Language.T("Closing Point of the Position"); colorCaptionBack = colorCaptionBackClose; break; case SlotTypes.CloseFilter: stringCaptionText = Language.T("Closing Logic Condition"); colorCaptionBack = colorCaptionBackCloseFilter; break; } var penBorder = new Pen(Data.GetGradientColor(colorCaptionBack, -LayoutColors.DepthCaption), Border); var fontCaptionText = new Font(Font.FontFamily, 9); float captionHeight = Math.Max(fontCaptionText.Height, 18); float captionWidth = width; Brush brushCaptionText = new SolidBrush(colorCaptionText); var stringFormatCaption = new StringFormat { LineAlignment = StringAlignment.Center, Trimming = StringTrimming.EllipsisCharacter, FormatFlags = StringFormatFlags.NoWrap, Alignment = StringAlignment.Center }; var rectfCaption = new RectangleF(0, 0, captionWidth, captionHeight); Data.GradientPaint(g, rectfCaption, colorCaptionBack, LayoutColors.DepthCaption); if (ShowRemoveSlotButtons && slot != _strategy.OpenSlot && slot != _strategy.CloseSlot) { int buttonDimentions = (int)captionHeight - 2; int buttonX = width - buttonDimentions - 1; float captionTextWidth = g.MeasureString(stringCaptionText, fontCaptionText).Width; float captionTextX = Math.Max((captionWidth - captionTextWidth) / 2f, 0); var pfCaptionText = new PointF(captionTextX, 0); var sfCaptionText = new SizeF(buttonX - captionTextX, captionHeight); rectfCaption = new RectangleF(pfCaptionText, sfCaptionText); stringFormatCaption.Alignment = StringAlignment.Near; } g.DrawString(stringCaptionText, fontCaptionText, brushCaptionText, rectfCaption, stringFormatCaption); // Border g.DrawLine(penBorder, 1, captionHeight, 1, pnl.Height); g.DrawLine(penBorder, pnl.Width - Border + 1, captionHeight, pnl.Width - Border + 1, pnl.Height); g.DrawLine(penBorder, 0, pnl.Height - Border + 1, pnl.Width, pnl.Height - Border + 1); // Paints the panel var rectfPanel = new RectangleF(Border, captionHeight, pnl.Width - 2 * Border, pnl.Height - captionHeight - Border); Data.GradientPaint(g, rectfPanel, colorBackground, LayoutColors.DepthControl); int vPosition = (int)captionHeight + 3; // Padlock image if (ShowPadlockImg) { if (_strategy.Slot[slot].SlotStatus == StrategySlotStatus.Locked) { g.DrawImage(Resources.padlock_img, 1, 1, 16, 16); } else if (_strategy.Slot[slot].SlotStatus == StrategySlotStatus.Open) { g.DrawImage(Resources.open_padlock, 1, 1, 16, 16); } else if (_strategy.Slot[slot].SlotStatus == StrategySlotStatus.Linked) { g.DrawImage(Resources.linked, 1, 1, 16, 16); } } // Indicator name var stringFormatIndicatorName = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center, FormatFlags = StringFormatFlags.NoWrap }; var fontIndicator = new Font(Font.FontFamily, 11f, FontStyle.Regular); Brush brushIndName = new SolidBrush(colorIndicatorNameText); float indNameHeight = fontIndicator.Height; float fGroupWidth = 0; if (Configs.UseLogicalGroups && (slotType == SlotTypes.OpenFilter || slotType == SlotTypes.CloseFilter)) { string sLogicalGroup = "[" + _strategy.Slot[slot].LogicalGroup + "]"; fGroupWidth = g.MeasureString(sLogicalGroup, fontIndicator).Width; var rectGroup = new RectangleF(0, vPosition, fGroupWidth, indNameHeight); g.DrawString(sLogicalGroup, fontIndicator, brushIndName, rectGroup, stringFormatIndicatorName); } stringFormatIndicatorName.Trimming = StringTrimming.EllipsisCharacter; string indicatorName = _strategy.Slot[slot].IndicatorName; float nameWidth = g.MeasureString(indicatorName, fontIndicator).Width; RectangleF rectIndName = width >= 2 * fGroupWidth + nameWidth ? new RectangleF(0, vPosition, width, indNameHeight) : new RectangleF(fGroupWidth, vPosition, width - fGroupWidth, indNameHeight); g.DrawString(indicatorName, fontIndicator, brushIndName, rectIndName, stringFormatIndicatorName); vPosition += (int)indNameHeight; if (slotType == SlotTypes.OpenFilter || slotType == SlotTypes.CloseFilter) { pnl.CloseButton.ColorBack = colorCaptionBack; pnl.CloseButton.ColorFore = colorCaptionText; pnl.CloseButton.Visible = ShowRemoveSlotButtons; } if (SlotMinMidMax == SlotSizeMinMidMax.min) { return; } // Logic var stringFormatLogic = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center, Trimming = StringTrimming.EllipsisCharacter, FormatFlags = StringFormatFlags.NoClip }; float padding = Space; if (_strategy.Slot[slot].IndParam.ListParam[0].Enabled) { string value = _strategy.Slot[slot].IndParam.ListParam[0].Text; var fontLogic = new Font(Font.FontFamily, 10.5f, FontStyle.Regular); SizeF sizeValue = g.MeasureString(value, fontLogic, (int)(width - 2 * padding), stringFormatLogic); var rectValue = new RectangleF(padding, vPosition, width - 2 * padding, sizeValue.Height); Brush brushLogic = new SolidBrush(colorLogicText); g.DrawString(value, fontLogic, brushLogic, rectValue, stringFormatLogic); vPosition += (int)sizeValue.Height; } if (SlotMinMidMax == SlotSizeMinMidMax.mid) { return; } // Parameters var stringFormat = new StringFormat { Trimming = StringTrimming.EllipsisCharacter, FormatFlags = StringFormatFlags.NoWrap }; var fontParam = new Font(Font.FontFamily, 9f, FontStyle.Regular); var fontValue = new Font(Font.FontFamily, 9f, FontStyle.Regular); Brush brushParam = new SolidBrush(colorParamText); Brush brushValue = new SolidBrush(colorValueText); var penDash = new Pen(colorDash); // Find Maximum width of the strings float maxParamWidth = 0; float maxValueWidth = 0; for (int i = 1; i < 5; i++) { if (!_strategy.Slot[slot].IndParam.ListParam[i].Enabled) { continue; } string caption = _strategy.Slot[slot].IndParam.ListParam[i].Caption; string value = _strategy.Slot[slot].IndParam.ListParam[i].Text; SizeF sizeParam = g.MeasureString(caption, fontParam); SizeF sizeValue = g.MeasureString(value, fontValue); if (maxParamWidth < sizeParam.Width) { maxParamWidth = sizeParam.Width; } if (maxValueWidth < sizeValue.Width) { maxValueWidth = sizeValue.Width; } } foreach (NumericParam numericParam in _strategy.Slot[slot].IndParam.NumParam) { if (!numericParam.Enabled) { continue; } string caption = numericParam.Caption; string value = numericParam.ValueToString; SizeF sizeParam = g.MeasureString(caption, fontParam); SizeF sizeValue = g.MeasureString(value, fontValue); if (maxParamWidth < sizeParam.Width) { maxParamWidth = sizeParam.Width; } if (maxValueWidth < sizeValue.Width) { maxValueWidth = sizeValue.Width; } } foreach (CheckParam checkParam in _strategy.Slot[slot].IndParam.CheckParam) { if (!checkParam.Enabled) { continue; } string param = checkParam.Caption; string value = checkParam.Checked ? "Yes" : "No"; SizeF sizeParam = g.MeasureString(param, fontParam); SizeF sizeValue = g.MeasureString(value, fontValue); if (maxParamWidth < sizeParam.Width) { maxParamWidth = sizeParam.Width; } if (maxValueWidth < sizeValue.Width) { maxValueWidth = sizeValue.Width; } } // Padding Parameter Padding Dash Padding Value Padding const float dashWidth = 5; float necessaryWidth = 4 * padding + maxParamWidth + maxValueWidth + dashWidth; padding = width > necessaryWidth ? Math.Max((pnl.ClientSize.Width - maxParamWidth - maxValueWidth - dashWidth) / 6, padding) : 2; float tabParam = 2 * padding; float tabDash = tabParam + maxParamWidth + padding; float tabValue = tabDash + dashWidth + padding; // List Parameters for (int i = 1; i < 5; i++) { if (!_strategy.Slot[slot].IndParam.ListParam[i].Enabled) { continue; } string caption = _strategy.Slot[slot].IndParam.ListParam[i].Caption; string value = _strategy.Slot[slot].IndParam.ListParam[i].Text; var pointParam = new PointF(tabParam, vPosition); var pointDash1 = new PointF(tabDash, vPosition + fontParam.Height / 2 + 2); var pointDash2 = new PointF(tabDash + dashWidth, vPosition + fontParam.Height / 2 + 2); var pointValue = new PointF(tabValue, vPosition); var sizefValue = new SizeF(Math.Max(width - tabValue, 0), fontValue.Height + 2); var rectfValue = new RectangleF(pointValue, sizefValue); g.DrawString(caption, fontParam, brushParam, pointParam); g.DrawLine(penDash, pointDash1, pointDash2); g.DrawString(value, fontValue, brushValue, rectfValue, stringFormat); vPosition += fontValue.Height; } // Num Parameters foreach (NumericParam numericParam in _strategy.Slot[slot].IndParam.NumParam) { if (!numericParam.Enabled) { continue; } string caption = numericParam.Caption; string value = numericParam.ValueToString; var pointParam = new PointF(tabParam, vPosition); var pointDash1 = new PointF(tabDash, vPosition + fontParam.Height / 2 + 2); var pointDash2 = new PointF(tabDash + dashWidth, vPosition + fontParam.Height / 2 + 2); var pointValue = new PointF(tabValue, vPosition); var sizefValue = new SizeF(Math.Max(width - tabValue, 0), fontValue.Height + 2); var rectfValue = new RectangleF(pointValue, sizefValue); g.DrawString(caption, fontParam, brushParam, pointParam); g.DrawLine(penDash, pointDash1, pointDash2); g.DrawString(value, fontValue, brushValue, rectfValue, stringFormat); vPosition += fontValue.Height; } // Check Parameters foreach (CheckParam checkParam in _strategy.Slot[slot].IndParam.CheckParam) { if (!checkParam.Enabled) { continue; } string param = checkParam.Caption; string salue = checkParam.Checked ? "Yes" : "No"; var pointParam = new PointF(tabParam, vPosition); var pointDash1 = new PointF(tabDash, vPosition + fontParam.Height / 2 + 2); var pointDash2 = new PointF(tabDash + dashWidth, vPosition + fontParam.Height / 2 + 2); var pointValue = new PointF(tabValue, vPosition); var sizefValue = new SizeF(Math.Max(width - tabValue, 0), fontValue.Height + 2); var rectfValue = new RectangleF(pointValue, sizefValue); g.DrawString(param, fontParam, brushParam, pointParam); g.DrawLine(penDash, pointDash1, pointDash2); g.DrawString(salue, fontValue, brushValue, rectfValue, stringFormat); vPosition += fontValue.Height; } }
/// <summary> /// Panel Slot Paint /// </summary> void PnlSlot_Paint(object sender, PaintEventArgs e) { Panel pnl = (Panel)sender; Graphics g = e.Graphics; int slot = (int)pnl.Tag; int width = pnl.ClientSize.Width; SlotTypes slotType = strategy.GetSlotType(slot); Color colorBackground = LayoutColors.ColorSlotBackground; Color colorCaptionText = LayoutColors.ColorSlotCaptionText; Color colorCaptionBackOpen = LayoutColors.ColorSlotCaptionBackOpen; Color colorCaptionBackOpenFilter = LayoutColors.ColorSlotCaptionBackOpenFilter; Color colorCaptionBackClose = LayoutColors.ColorSlotCaptionBackClose; Color colorCaptionBackCloseFilter = LayoutColors.ColorSlotCaptionBackCloseFilter; Color colorIndicatorNameText = LayoutColors.ColorSlotIndicatorText; Color colorLogicText = LayoutColors.ColorSlotLogicText; Color colorParamText = LayoutColors.ColorSlotParamText; Color colorValueText = LayoutColors.ColorSlotValueText; Color colorDash = LayoutColors.ColorSlotDash; // Caption string stringCaptionText = string.Empty; Color colorCaptionBack = LayoutColors.ColorSignalRed; switch (slotType) { case SlotTypes.Open: stringCaptionText = Language.T("Opening Point of the Position"); colorCaptionBack = colorCaptionBackOpen; break; case SlotTypes.OpenFilter: stringCaptionText = Language.T("Opening Logic Condition"); colorCaptionBack = colorCaptionBackOpenFilter; break; case SlotTypes.Close: stringCaptionText = Language.T("Closing Point of the Position"); colorCaptionBack = colorCaptionBackClose; break; case SlotTypes.CloseFilter: stringCaptionText = Language.T("Closing Logic Condition"); colorCaptionBack = colorCaptionBackCloseFilter; break; default: break; } Pen penBorder = new Pen(Data.GetGradientColor(colorCaptionBack, -LayoutColors.DepthCaption), border); Font fontCaptionText = new Font(Font.FontFamily, 9); float fCaptionHeight = (float)Math.Max(fontCaptionText.Height, 18); float fCaptionWidth = width; Brush brushCaptionText = new SolidBrush(colorCaptionText); StringFormat stringFormatCaption = new StringFormat(); stringFormatCaption.LineAlignment = StringAlignment.Center; stringFormatCaption.Trimming = StringTrimming.EllipsisCharacter; stringFormatCaption.FormatFlags = StringFormatFlags.NoWrap; stringFormatCaption.Alignment = StringAlignment.Center; RectangleF rectfCaption = new RectangleF(0, 0, fCaptionWidth, fCaptionHeight); Data.GradientPaint(g, rectfCaption, colorCaptionBack, LayoutColors.DepthCaption); if (showRemoveSlotButtons && slot != strategy.OpenSlot && slot != strategy.CloseSlot) { int iButtonDimentions = (int)fCaptionHeight - 2; int iButtonX = width - iButtonDimentions - 1; abtnRemoveSlot[slot].Size = new Size(iButtonDimentions, iButtonDimentions); abtnRemoveSlot[slot].Location = new Point(iButtonX, 1); float fCaptionTextWidth = g.MeasureString(stringCaptionText, fontCaptionText).Width; float fCaptionTextX = (float)Math.Max((fCaptionWidth - fCaptionTextWidth) / 2f, 0); PointF pfCaptionText = new PointF(fCaptionTextX, 0); SizeF sfCaptionText = new SizeF(iButtonX - fCaptionTextX, fCaptionHeight); rectfCaption = new RectangleF(pfCaptionText, sfCaptionText); stringFormatCaption.Alignment = StringAlignment.Near; } g.DrawString(stringCaptionText, fontCaptionText, brushCaptionText, rectfCaption, stringFormatCaption); // Border g.DrawLine(penBorder, 1, fCaptionHeight, 1, pnl.Height); g.DrawLine(penBorder, pnl.Width - border + 1, fCaptionHeight, pnl.Width - border + 1, pnl.Height); g.DrawLine(penBorder, 0, pnl.Height - border + 1, pnl.Width, pnl.Height - border + 1); // Paints the panel RectangleF rectfPanel = new RectangleF(border, fCaptionHeight, pnl.Width - 2 * border, pnl.Height - fCaptionHeight - border); Data.GradientPaint(g, rectfPanel, colorBackground, LayoutColors.DepthControl); int iVPosition = (int)fCaptionHeight + 3; // Padlock image if (showPadlockImg) { if (strategy.Slot[slot].SlotStatus == StrategySlotStatus.Locked) { g.DrawImage(Properties.Resources.padlock_img, 1, 1, 16, 16); } else if (strategy.Slot[slot].SlotStatus == StrategySlotStatus.Open) { g.DrawImage(Properties.Resources.open_padlock, 1, 1, 16, 16); } else if (strategy.Slot[slot].SlotStatus == StrategySlotStatus.Linked) { g.DrawImage(Properties.Resources.linked, 1, 1, 16, 16); } } // Indicator name StringFormat stringFormatIndicatorName = new StringFormat(); stringFormatIndicatorName.Alignment = StringAlignment.Center; stringFormatIndicatorName.LineAlignment = StringAlignment.Center; stringFormatIndicatorName.FormatFlags = StringFormatFlags.NoWrap; Font fontIndicator = new Font(Font.FontFamily, 11f, FontStyle.Regular); Brush brushIndName = new SolidBrush(colorIndicatorNameText); float fIndNameHeight = fontIndicator.Height; float fGroupWidth = 0; if (Configs.UseLogicalGroups && (slotType == SlotTypes.OpenFilter || slotType == SlotTypes.CloseFilter)) { string sLogicalGroup = "[" + strategy.Slot[slot].LogicalGroup + "]"; fGroupWidth = g.MeasureString(sLogicalGroup, fontIndicator).Width; RectangleF rectGroup = new RectangleF(0, iVPosition, fGroupWidth, fIndNameHeight); g.DrawString(sLogicalGroup, fontIndicator, brushIndName, rectGroup, stringFormatIndicatorName); } stringFormatIndicatorName.Trimming = StringTrimming.EllipsisCharacter; string sIndicatorName = strategy.Slot[slot].IndicatorName; float fIndicatorWidth = g.MeasureString(sIndicatorName, fontIndicator).Width; RectangleF rectIndName; if (width >= 2 * fGroupWidth + fIndicatorWidth) { rectIndName = new RectangleF(0, iVPosition, width, fIndNameHeight); } else { rectIndName = new RectangleF(fGroupWidth, iVPosition, width - fGroupWidth, fIndNameHeight); } g.DrawString(sIndicatorName, fontIndicator, brushIndName, rectIndName, stringFormatIndicatorName); iVPosition += (int)fIndNameHeight; if (slotMinMidMax == SlotSizeMinMidMax.min) { return; } // Logic StringFormat stringFormatLogic = new StringFormat(); stringFormatLogic.Alignment = StringAlignment.Center; stringFormatLogic.LineAlignment = StringAlignment.Center; stringFormatLogic.Trimming = StringTrimming.EllipsisCharacter; stringFormatLogic.FormatFlags = StringFormatFlags.NoClip; float padding = space; if (strategy.Slot[slot].IndParam.ListParam[0].Enabled) { string sValue = strategy.Slot[slot].IndParam.ListParam[0].Text; Font fontLogic = new Font(Font.FontFamily, 10.5f, FontStyle.Regular); SizeF sizeValue = g.MeasureString(sValue, fontLogic, (int)(width - 2 * padding), stringFormatLogic); RectangleF rectValue = new RectangleF(padding, iVPosition, width - 2 * padding, sizeValue.Height); Brush brushLogic = new SolidBrush(colorLogicText); g.DrawString(sValue, fontLogic, brushLogic, rectValue, stringFormatLogic); iVPosition += (int)sizeValue.Height; } if (slotMinMidMax == SlotSizeMinMidMax.mid) { return; } // Parameters StringFormat stringFormat = new StringFormat(); stringFormat.Trimming = StringTrimming.EllipsisCharacter; stringFormat.FormatFlags = StringFormatFlags.NoWrap; Font fontParam = new Font(Font.FontFamily, 9f, FontStyle.Regular); Font fontValue = new Font(Font.FontFamily, 9f, FontStyle.Regular); Brush brushParam = new SolidBrush(colorParamText); Brush brushValue = new SolidBrush(colorValueText); Pen penDash = new Pen(colorDash); // Find Maximum width of the strings float maxParamWidth = 0; float maxValueWidth = 0; for (int i = 1; i < 5; i++) { if (!strategy.Slot[slot].IndParam.ListParam[i].Enabled) { continue; } string sParam = strategy.Slot[slot].IndParam.ListParam[i].Caption; string sValue = strategy.Slot[slot].IndParam.ListParam[i].Text; SizeF sizeParam = g.MeasureString(sParam, fontParam); SizeF sizeValue = g.MeasureString(sValue, fontValue); if (maxParamWidth < sizeParam.Width) { maxParamWidth = sizeParam.Width; } if (maxValueWidth < sizeValue.Width) { maxValueWidth = sizeValue.Width; } } foreach (NumericParam numericParam in strategy.Slot[slot].IndParam.NumParam) { if (!numericParam.Enabled) { continue; } string sParam = numericParam.Caption; string sValue = numericParam.ValueToString; SizeF sizeParam = g.MeasureString(sParam, fontParam); SizeF sizeValue = g.MeasureString(sValue, fontValue); if (maxParamWidth < sizeParam.Width) { maxParamWidth = sizeParam.Width; } if (maxValueWidth < sizeValue.Width) { maxValueWidth = sizeValue.Width; } } foreach (CheckParam checkParam in strategy.Slot[slot].IndParam.CheckParam) { if (!checkParam.Enabled) { continue; } string param = checkParam.Caption; string value = checkParam.Checked ? "Yes" : "No"; SizeF sizeParam = g.MeasureString(param, fontParam); SizeF sizeValue = g.MeasureString(value, fontValue); if (maxParamWidth < sizeParam.Width) { maxParamWidth = sizeParam.Width; } if (maxValueWidth < sizeValue.Width) { maxValueWidth = sizeValue.Width; } } // Padding Param Padding Dash Padding Value Padding float dashWidth = 5; float necessaryWidth = 4 * padding + maxParamWidth + maxValueWidth + dashWidth; if (width > necessaryWidth) { // 2*Padding Param Padding Dash Padding Value 2*Padding padding = (float)Math.Max((pnl.ClientSize.Width - maxParamWidth - maxValueWidth - dashWidth) / 6, padding); } else { padding = 2; } float tabParam = 2 * padding; float tabDash = tabParam + maxParamWidth + padding; float tabValue = tabDash + dashWidth + padding; // List Params for (int i = 1; i < 5; i++) { if (!strategy.Slot[slot].IndParam.ListParam[i].Enabled) { continue; } string sParam = strategy.Slot[slot].IndParam.ListParam[i].Caption; string sValue = strategy.Slot[slot].IndParam.ListParam[i].Text; PointF pointParam = new PointF(tabParam, iVPosition); PointF pointDash1 = new PointF(tabDash, iVPosition + fontParam.Height / 2 + 2); PointF pointDash2 = new PointF(tabDash + dashWidth, iVPosition + fontParam.Height / 2 + 2); PointF pointValue = new PointF(tabValue, iVPosition); SizeF sizefValue = new SizeF(Math.Max(width - tabValue, 0), fontValue.Height + 2); RectangleF rectfValue = new RectangleF(pointValue, sizefValue); g.DrawString(sParam, fontParam, brushParam, pointParam); g.DrawLine(penDash, pointDash1, pointDash2); g.DrawString(sValue, fontValue, brushValue, rectfValue, stringFormat); iVPosition += fontValue.Height; } // Num Params foreach (NumericParam numericParam in strategy.Slot[slot].IndParam.NumParam) { if (!numericParam.Enabled) { continue; } string sParam = numericParam.Caption; string sValue = numericParam.ValueToString; PointF pointParam = new PointF(tabParam, iVPosition); PointF pointDash1 = new PointF(tabDash, iVPosition + fontParam.Height / 2 + 2); PointF pointDash2 = new PointF(tabDash + dashWidth, iVPosition + fontParam.Height / 2 + 2); PointF pointValue = new PointF(tabValue, iVPosition); SizeF sizefValue = new SizeF(Math.Max(width - tabValue, 0), fontValue.Height + 2); RectangleF rectfValue = new RectangleF(pointValue, sizefValue); g.DrawString(sParam, fontParam, brushParam, pointParam); g.DrawLine(penDash, pointDash1, pointDash2); g.DrawString(sValue, fontValue, brushValue, rectfValue, stringFormat); iVPosition += fontValue.Height; } // Check Params foreach (CheckParam checkParam in strategy.Slot[slot].IndParam.CheckParam) { if (!checkParam.Enabled) { continue; } string param = checkParam.Caption; string salue = checkParam.Checked ? "Yes" : "No"; PointF pointParam = new PointF(tabParam, iVPosition); PointF pointDash1 = new PointF(tabDash, iVPosition + fontParam.Height / 2 + 2); PointF pointDash2 = new PointF(tabDash + dashWidth, iVPosition + fontParam.Height / 2 + 2); PointF pointValue = new PointF(tabValue, iVPosition); SizeF sizefValue = new SizeF(Math.Max(width - tabValue, 0), fontValue.Height + 2); RectangleF rectfValue = new RectangleF(pointValue, sizefValue); g.DrawString(param, fontParam, brushParam, pointParam); g.DrawLine(penDash, pointDash1, pointDash2); g.DrawString(salue, fontValue, brushValue, rectfValue, stringFormat); iVPosition += fontValue.Height; } return; }