protected void DrawTwoRows(Graphics g, LiveSplitState state, float width, float height) { NameLabel.ShadowColor = state.LayoutSettings.ShadowsColor; ValueLabel.ShadowColor = state.LayoutSettings.ShadowsColor; if (InformationName != null && LongestString != null && InformationName.Length > LongestString.Length) { LongestString = InformationName; NameMeasureLabel.Text = LongestString; } NameMeasureLabel.Text = LongestString; NameMeasureLabel.Font = state.LayoutSettings.TextFont; NameMeasureLabel.SetActualWidth(g); MinimumHeight = 0.85f * (g.MeasureString("A", ValueLabel.Font).Height + g.MeasureString("A", NameLabel.Font).Height); NameLabel.Width = width - 10; NameLabel.Height = height; NameLabel.X = 5; NameLabel.Y = 0; ValueLabel.Width = ValueLabel.IsMonospaced ? width - 12 : width - 10; ValueLabel.Height = height; ValueLabel.Y = 0; ValueLabel.X = 5; PrepareDraw(state, LayoutMode.Horizontal); NameLabel.Draw(g); ValueLabel.Draw(g); }
internal ValueLabelRecord(ValueLabel valueLabel, Encoding headerEncoding) { // TODO add this to base constructor Encoding = headerEncoding; LabelCount = valueLabel.Labels.Count; Labels = valueLabel.Labels; VarCount = valueLabel.VariableIndex.Count; Variables = valueLabel.VariableIndex; }
private void StartButton_Click(object sender, EventArgs e) { BankBidLabel.ResetText(); WinLabel.ResetText(); LogLabel.ResetText(); CaseList.Items.Clear(); ValueLabel.ResetText(); LogLabel.Text = "Välj bort väskor"; cases = ge.CreateCases(); foreach (Case c in cases) { if (c.Status == true) { CaseList.Items.Add(c); } } cases3 = new Stack <Case>(new Stack <Case>(cases)); cases2 = ge.ShuffleCases(cases3); button1.Enabled = true; button2.Enabled = true; button3.Enabled = true; button4.Enabled = true; button5.Enabled = true; button6.Enabled = true; button7.Enabled = true; button8.Enabled = true; button9.Enabled = true; button10.Enabled = true; button11.Enabled = true; button12.Enabled = true; button13.Enabled = true; button14.Enabled = true; button15.Enabled = true; button16.Enabled = true; button17.Enabled = true; button18.Enabled = true; button19.Enabled = true; button20.Enabled = true; button21.Enabled = true; button22.Enabled = true; button23.Enabled = true; button24.Enabled = true; StartButton.Enabled = false; }
private void ReadContinuously() { while (true) { if (reader is null) { Thread.Sleep(100); } else { var reading = reader.Read(); values[nextValueIndex++] = reading.value; ValueLabel.BeginInvoke((MethodInvoker) delegate() { ValueLabel.Text = reading.ToString(); }); StatusLabel.Text = string.Format("Read #{0}: {1}", reader.readCount, reading); } } }
public GlyphIconStatAlignRight() { InitializeComponent(); TitleLabel.SetBinding(Label.TextProperty, new Binding(nameof(TitleLabelText), source: this)); TitleLabel.SetBinding(Label.FontSizeProperty, new Binding(nameof(TitleLabelFontSize), source: this)); TitleLabel.SetBinding(Label.FontAttributesProperty, new Binding(nameof(TitleLabelFontAttributes), source: this)); TitleLabel.SetBinding(Label.TextColorProperty, new Binding(nameof(TitleLabelTextColor), source: this)); ValueLabel.SetBinding(Label.TextProperty, new Binding(nameof(ValueLabelText), source: this)); ValueLabel.SetBinding(Label.FontSizeProperty, new Binding(nameof(ValueLabelFontSize), source: this)); ValueLabel.SetBinding(Label.FontAttributesProperty, new Binding(nameof(ValueLabelFontAttributes), source: this)); ValueLabel.SetBinding(Label.TextColorProperty, new Binding(nameof(ValueLabelTextColor), source: this)); GlyphIcon.SetBinding(FontImageSource.GlyphProperty, new Binding(nameof(GlyphIconGlyph), source: this)); GlyphIcon.SetBinding(FontImageSource.FontFamilyProperty, new Binding(nameof(GlyphIconFontFamily), source: this)); GlyphIcon.SetBinding(FontImageSource.SizeProperty, new Binding(nameof(GlyphIconSize), source: this)); GlyphIcon.SetBinding(FontImageSource.ColorProperty, new Binding(nameof(GlyphIconColor), source: this)); }
public Slider(string title, System.Func <float> getValueCallback = null, System.Action <float> setValueCallback = null, float min = 0, float max = 1, float width = 100f) : base(width) { _valueComponent = new ValueComponent <float>(getValueCallback, setValueCallback); _max = max; _min = min; _inactiveBar = new HorizontalGrid(); _activeBar = new EmptySpace(); _verticalLayout = new VerticalLayout(); _valueLabel = new ValueLabel(title, () => string.Format("{0:0.00}", Value)); Value = getValueCallback(); _verticalLayout.Attach( _inactiveBar.Attach( new HorizontalLayout().Attach( _activeBar ) ) ); BuildLayout(); }
public void DrawVertical(Graphics g, LiveSplitState state, float width, Region clipRegion) { if (DisplayTwoRows) { VerticalHeight = 0.9f * (g.MeasureString("A", ValueLabel.Font).Height + g.MeasureString("A", NameLabel.Font).Height); PaddingTop = PaddingBottom = 0; DrawTwoRows(g, state, width, VerticalHeight); } else { VerticalHeight = 31; NameLabel.ShadowColor = state.LayoutSettings.ShadowsColor; NameLabel.OutlineColor = state.LayoutSettings.TextOutlineColor; ValueLabel.ShadowColor = state.LayoutSettings.ShadowsColor; ValueLabel.OutlineColor = state.LayoutSettings.TextOutlineColor; var textHeight = 0.75f * Math.Max(g.MeasureString("A", ValueLabel.Font).Height, g.MeasureString("A", NameLabel.Font).Height); PaddingTop = Math.Max(0, (VerticalHeight - textHeight) / 2f); PaddingBottom = PaddingTop; NameMeasureLabel.Text = LongestString; NameMeasureLabel.SetActualWidth(g); ValueLabel.SetActualWidth(g); NameLabel.Width = width - ValueLabel.ActualWidth - 10; NameLabel.Height = VerticalHeight; NameLabel.X = 5; NameLabel.Y = 0; ValueLabel.Width = ValueLabel.IsMonospaced ? width - 12 : width - 10; ValueLabel.Height = VerticalHeight; ValueLabel.Y = 0; ValueLabel.X = 5; PrepareDraw(state, LayoutMode.Vertical); NameLabel.Draw(g); ValueLabel.Draw(g); } }
private double AddChartAxisMarker(Axis ax) { // Set the annotation method to Mixed so both automatic // Values annotation AND ValueLabels can be used concurrently. ax.AnnoMethod = AnnotationMethodEnum.Mixed; // Set the GridMajor line pattern to solid. This will be // used for the ValueLabel Gridline draw. ax.GridMajor.Pattern = LinePatternEnum.Solid; ax.OnTop = true; // A convenient value for the axes units. ax.UnitMajor = 10; // Create the ValueLabel. Use an arrow, and make it big // and red so it cannot be missed. ValueLabel vl = ax.ValueLabels.AddNewLabel(); vl.Appearance = ValueLabelAppearanceEnum.ArrowMarker; vl.GridLine = true; vl.Moveable = true; vl.MarkerSize = 20; vl.Color = Color.Red; // Put it in the middle of the axis. For this to work // the chart must have been drawn so the axis is properly // scaled. A prior GetImage() will do this. vl.DateTimeValue = sjEnd.Value.AddDays(-2); // Set the event so the data can be recalculated // each time the marker is moved. vl.ValueChanged += new EventHandler(MarkerMoved); //!!VBSubst AddHandler vl.ValueChanged, AddressOf MarkerMoved // return the numeric location. return(vl.NumericValue); }
private void Button_Enter(object sender, EventArgs e) { ValueLabel.Focus(); }
private void ValueLabel_Leave(object sender, EventArgs e) { ValueLabel.Invalidate(); EndEditMode(true); }
private void Form1_Load(object sender, System.EventArgs e) { Form1_Resize(null, null); c1Chart1.ChartArea.AxisY.SetMinMax(0, 30); // using the routine GetPoints defined above, create some // additional data and add it to the chart. PointF[] pfs = GetPoints(3, 201, 1, 5, 1, 7.5); ChartDataSeriesCollection cdsc = c1Chart1.ChartGroups[0].ChartData.SeriesList; ChartDataSeries cds = cdsc.AddNewSeries(); cds.PointData.CopyDataIn(pfs); cds.SymbolStyle.Shape = SymbolShapeEnum.None; // turn on all of the checked listbox items. for (int z = 0; z < zoneSelect.Items.Count; z++) { zoneSelect.SetItemChecked(z, true); } // create the alarm zones. AlarmZonesCollection azs = c1Chart1.ChartArea.PlotArea.AlarmZones; // add the rectangle AlarmZone az = azs.AddNewZone(); az.Name = (string)zoneSelect.Items[0]; az.BackColor = Color.FromArgb(100, Color.Red); az.Shape = AlarmZoneShapeEnum.Rectangle; az.UpperExtent = 20; az.LowerExtent = 16; az.FarExtent = 2.5; az.NearExtent = 1.5; az.Visible = true; // add the ellipse az = azs.AddNewZone(); az.BackColor = Color.FromArgb(100, Color.Blue); az.Shape = AlarmZoneShapeEnum.Ellipse; az.Name = (string)zoneSelect.Items[1]; az.UpperExtent = 24; az.LowerExtent = 16; az.FarExtent = 4.5; az.NearExtent = 3; az.Visible = true; // add a polygon defined by coordinates. Coordinates // are obtained using the GetPoints method defined above. az = azs.AddNewZone(); az.BackColor = Color.FromArgb(100, Color.Green); az.Shape = AlarmZoneShapeEnum.Polygon; az.Name = (string)zoneSelect.Items[2]; az.UpperExtent = 14; az.LowerExtent = 8; az.FarExtent = 4.5; az.NearExtent = 2.5; pfs = GetPoints(1, 15, az.NearExtent, az.FarExtent, az.LowerExtent, az.UpperExtent); az.PolygonData.PointData.CopyDataIn(pfs); az.Visible = true; // add a polygon az = azs.AddNewZone(); az.BackColor = Color.FromArgb(100, Color.Yellow); az.PatternStyle = HatchStyle.DiagonalBrick; az.PatternVisible = true; az.Shape = AlarmZoneShapeEnum.Rectangle; az.Name = (string)zoneSelect.Items[4]; az.UpperExtent = 24; az.LowerExtent = 24; az.FarExtent = 3; az.NearExtent = 3; az.MinHeight = 32; az.MinWidth = 32; az.Visible = true; // add another polygon defined by the DataSeries. az = azs.AddNewZone(); az.BackColor = Color.FromArgb(100, Color.Brown); az.Shape = AlarmZoneShapeEnum.Polygon; az.PolygonData.PolygonSource = PolygonSourceEnum.DataSeries; az.PolygonData.SeriesIndex = 4; az.Name = (string)zoneSelect.Items[3]; az.UpperExtent = 10; az.LowerExtent = 6; az.NearExtent = 1.15; az.FarExtent = 2.25; az.Visible = true; // Add a Header that will be updated to the current AlarmZone // under the cursor. c1Chart1.Header.Text = "-- Mouse is not over an AlarmZone --"; // now select the first alarmzone zoneSelect.SelectedIndex = 0; // Add some marker style ValueLabels. These will be used to // mark the Near and Far extents of the DataSeries AlarmZone Axis ax = c1Chart1.ChartArea.AxisX; ax.AnnoMethod = AnnotationMethodEnum.Mixed; ValueLabel vl = ax.ValueLabels.AddNewLabel(); vl.Appearance = ValueLabelAppearanceEnum.ArrowMarker; vl.Text = "M1"; vl.Color = Color.FromArgb(100, Color.Red); vl.GridLine = true; vl.Moveable = true; vl.NumericValue = az.NearExtent; vl.ValueChanged += new EventHandler(ValueLabelChangedHandler); //!!VBSubst AddHandler vl.ValueChanged, AddressOf ValueLabelChangedHandler vl.MarkerSize = 13; vl = ax.ValueLabels.AddNewLabel(); vl.Appearance = ValueLabelAppearanceEnum.ArrowMarker; vl.Text = "M2"; vl.Color = Color.FromArgb(100, Color.Red); vl.GridLine = true; vl.Moveable = true; vl.NumericValue = az.FarExtent; vl.ValueChanged += new EventHandler(ValueLabelChangedHandler); //!!VBSubst AddHandler vl.ValueChanged, AddressOf ValueLabelChangedHandler vl.MarkerSize = 13; // Call it to get markers and extensions recalculated. ValueLabelChangedHandler(null, null); // Add some instructions about how to use the markers. c1Chart1.Footer.Text = "Drag markers M1 and M2 along the X axis\n" + "to adjust the extents of the DataSeries sourced AlarmZone"; }
protected override void OnEnter(EventArgs e) { base.OnEnter(e); ValueLabel.Focus(); }
public void Hide() { ValueLabel.Hide(); }
/// <summary> /// 设置chart的基本信息 /// </summary> public void SetXyRtChart() { c1Chart1.ChartGroups[0].ChartData.SeriesList.Clear(); Point pLoc = new Point(); pLoc.X = -1; pLoc.Y = -1; c1Chart1.Reset(); c1Chart1.ChartArea.ResetSizeDefault(); c1Chart1.ChartArea.ResetStyle(); // c1Chart1.Style.sho c1Chart1.ChartArea.AxisX.GridMajor.Visible = true; c1Chart1.ChartArea.AxisY.GridMajor.Visible = true; c1Chart1.ToolTip.Enabled = true; c1Chart1.BackColor = Color.White; c1Chart1.Legend.Compass = CompassEnum.East; c1Chart1.Legend.Location = pLoc; c1Chart1.Legend.Visible = true; c1Chart1.ToolTip.Enabled = true; c1Chart1.ToolTip.PlotElement = PlotElementEnum.Series; c1Chart1.ToolTip.SelectAction = SelectActionEnum.MouseOver; c1Chart1.ChartGroups[0].ChartData.SeriesList.Clear(); c1Chart1.ChartGroups[0].ChartType = C1.Win.C1Chart.Chart2DTypeEnum.XYPlot; c1Chart1.ChartArea.AxisX.ScrollBar.Visible = false; //设置图片的显示方式 C1Chart chart = c1Chart1; Area area = chart.ChartArea; Axis ax = area.AxisX; ax.AnnotationRotation = -30; //C1FlexGrid c1Flex = (C1FlexGrid)_tab.TabPages[_tab.SelectedIndex].Controls[0]; var lines = CurrentSection.lines; string sDate = ""; string eDate = ""; foreach (var line in lines) { if (line.dataTable != null && line.dataTable.Rows.Count > 0) { var tsDate = line.dataTable.Rows[0][0].ToString(); var teDate = line.dataTable.Rows[line.dataTable.Rows.Count - 1][0].ToString(); var ti = line.dataTable.Rows.Count - 1; while (string.IsNullOrEmpty(teDate)) { ti--; teDate = line.dataTable.Rows[ti][0].ToString(); } if (sDate == "" || eDate == "") { sDate = tsDate; eDate = teDate; } else { if (DateTime.Parse(sDate) > DateTime.Parse(tsDate)) { sDate = tsDate; } if (DateTime.Parse(teDate) > DateTime.Parse(eDate)) { sDate = tsDate; } } } } string fmt = "yyyy.MM.dd"; var start = DateTime.Parse(sDate); var timespan = DateTime.Parse(eDate).Subtract(start); var j = 1;//时间的小时间隔 if (timespan.TotalDays > 1 && timespan.TotalDays < 2) { j = 2; } else if (timespan.TotalDays >= 2 && timespan.TotalDays < 3) { j = 3; } else if (timespan.TotalDays >= 3 && timespan.TotalDays < 4) { j = 4; } else if (timespan.TotalDays >= 4 && timespan.TotalDays < 6) { j = 5; } else if (timespan.TotalDays >= 6) { j = 12; } for (int i = 0; i < timespan.TotalHours; i = i + j) { ValueLabel vlbl = chart.ChartArea.AxisX.ValueLabels.AddNewLabel(); var end = start.AddHours(i + j); vlbl.NumericValue = (i + j) * 60; //修改前为50 //if (start.Hour == 0) // vlbl.Text = end.ToString(fmt); //else vlbl.Text = end.ToString("yyyy.MM.dd HH:mm"); } //string sDate = ""; //string eDate = ""; //foreach (var line in lines) //{ // if (line.dataTable != null && line.dataTable.Rows.Count > 0) // { // string fmt = "yyyy.MM.dd"; // var tsDate = line.dataTable.Rows[0][0].ToString(); // var start = DateTime.Parse(tsDate); // for (int i = 0; i < line.dataTable.Rows.Count; i++) // { // tsDate = line.dataTable.Rows[i][0].ToString(); // var end= DateTime.Parse(tsDate); // ValueLabel vlbl = chart.ChartArea.AxisX.ValueLabels.AddNewLabel(); // var timespan = end-start; // vlbl.NumericValue = i; //修改前为50 // if (start.Hour == 0) // vlbl.Text = end.ToString(fmt); // else // vlbl.Text = end.ToString("HH:mm"); // } // chart.ChartArea.AxisX.AnnoMethod = C1.Win.C1Chart.AnnotationMethodEnum.ValueLabels; // } //} chart.ChartArea.AxisX.AnnoMethod = C1.Win.C1Chart.AnnotationMethodEnum.ValueLabels; }
public void Show() { ValueLabel.Show(); }
private void Interaction_Load(object sender, EventArgs e) { // Enable interaction c1Chart1.Interaction.Enabled = true; c1Chart1.Interaction.Actions["Zoom"].Modifier = Keys.None; c1Chart1.Interaction.Actions["Scale"].Modifier = Keys.Control; c1Chart1.Interaction.Actions["Translate"].Modifier = Keys.Shift; c1Chart1.Interaction.Actions["Rotate"].Modifier = Keys.Alt; c1Chart1.Interaction.Appearance = InteractionAppearance.FillSelectionArea; // Create chart series c1Chart1.ChartGroups[0].ChartData.SeriesList.Clear(); cdsTemp = c1Chart1.ChartGroups[0].ChartData.SeriesList.AddNewSeries(); cdsPress = c1Chart1.ChartGroups[0].ChartData.SeriesList.AddNewSeries(); cdsCond = c1Chart1.ChartGroups[0].ChartData.SeriesList.AddNewSeries(); cdsPh = c1Chart1.ChartGroups[0].ChartData.SeriesList.AddNewSeries(); cdsTemp.SymbolStyle.Shape = SymbolShapeEnum.None; cdsTemp.LineStyle.Color = Color.FromArgb(150, 32, 132); cdsTemp.LineStyle.Thickness = 2; cdsPress.SymbolStyle.Shape = SymbolShapeEnum.None; cdsPress.LineStyle.Color = Color.FromArgb(42, 2, 153); cdsPress.LineStyle.Thickness = 2; cdsCond.SymbolStyle.Shape = SymbolShapeEnum.None; cdsCond.LineStyle.Color = Color.FromArgb(0, 114, 160); cdsCond.LineStyle.Thickness = 2; cdsPh.SymbolStyle.Shape = SymbolShapeEnum.None; cdsPh.LineStyle.Color = Color.FromArgb(100, 126, 52); cdsPh.LineStyle.Thickness = 2; // Misc settings c1Chart1.UseAntiAliasedGraphics = true; c1Chart1.UseAntiAliasedText = true; // Load initial data source comboLocations.SelectedIndex = 0; // Add ValueLabel event handling // The moveable marker is created at design-time ValueLabel vl = c1Chart1.ChartArea.AxisX.ValueLabels[0]; vl.NumericValue = 140; vl.ValueChanged += new EventHandler(vl_ValueChanged); // Setup chart axes and scrollbar c1Chart1.ChartArea.AxisX.ScrollBar.Scale = 0.1; c1Chart1.ChartArea.AxisY.ScrollBar.Scale = 1.0; c1Chart1.ChartArea.AxisX.ScrollBar.Alignment = StringAlignment.Near; c1Chart1.ChartArea.AxisY.ScrollBar.Alignment = StringAlignment.Near; c1Chart1.ChartArea.AxisX.ScrollBar.Appearance = ScrollBarAppearanceEnum.XP; c1Chart1.ChartArea.AxisY.ScrollBar.Appearance = ScrollBarAppearanceEnum.XP; c1Chart1.ChartArea.AxisX.ScrollBar.Visible = true; c1Chart1.ChartArea.AxisY.ScrollBar.Visible = true; c1Chart1.ChartArea.AxisY.ScrollBar.Max = 80; c1Chart1.ChartArea.AxisY.ScrollBar.Min = 20; c1Chart1.ChartArea.AxisX.ScrollBar.AxisScroll += new AxisScrollEventHandler(ScrollBar_AxisScroll); // Update chart labels UpdateChartLabels(); // Update shaded zones UpdateZones(); }
void SetChart(DataTable table1) { try { c1Chart1.Reset(); c1Chart1.ChartLabels.LabelsCollection.Clear(); c1Chart1.ChartArea.AxisX.ValueLabels.Clear(); c1Chart1.ChartArea.AxisX.Text = "日期"; c1Chart1.ChartArea.AxisY.Text = "数值"; c1Chart1.Legend.Visible = false; c1Chart1.Legend.Orientation = LegendOrientationEnum.Auto; c1Chart1.Legend.Text = "平均时间(分)"; c1Chart1.Legend.Style.Border.BorderStyle = BorderStyleEnum.Solid; //c1Chart1.ChartGroups.Group0.ChartType = Chart2DTypeEnum.Area; c1Chart1.ChartGroups[0].ChartData.SeriesList.Clear(); if (table1 != null) { DataTable objTable = table1; if (objTable == null) { return; } //非饼图的数据加载 for (int j = 1; j < objTable.Columns.Count; j++) { //if (j > 1) // continue; ChartDataSeries tval = new ChartDataSeries(); c1Chart1.ChartArea.AxisX.AnnoMethod = C1.Win.C1Chart.AnnotationMethodEnum.ValueLabels; tval.DataLabel.Visible = true; tval.Label = objTable.Columns[j].ColumnName; for (int i = 0; i < objTable.Rows.Count; i++) { float fvalue = 0; float.TryParse(objTable.Rows[i][j].ToString(), out fvalue); tval.PointData.Add(new PointF(i, fvalue)); #region 具体每一项的值显示 C1.Win.C1Chart.Label lab = c1Chart1.ChartLabels.LabelsCollection.AddNewLabel(); lab.AttachMethod = AttachMethodEnum.DataIndex; AttachMethodData amd = lab.AttachMethodData; amd.GroupIndex = 0; amd.PointIndex = i; amd.SeriesIndex = j - 1; //数据集的索引 lab.Text = objTable.Rows[i][j].ToString(); //标签值 //lab.Visible = chklabVisable.Checked; lab.Visible = true; lab.Compass = LabelCompassEnum.NorthEast; //值显示的位置 lab.Connected = false; lab.Offset = 20; //值显示的位置的偏移量 lab.TooltipText = objTable.Columns[j].ColumnName + ":" + lab.Text; #endregion if (j == 1) { //X轴中的内容标签 ValueLabel vlbl = new ValueLabel(); vlbl.NumericValue = i; vlbl.Text = objTable.Rows[i]["月份"].ToString() + "月"; c1Chart1.ChartArea.AxisX.ValueLabels.Add(vlbl); } } c1Chart1.ChartGroups[0].ChartData.SeriesList.Add(tval); } } } catch (Exception ex) { ex.Message.ToString(); } }