0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

cscの作法 その558

Posted at

概要

cscの作法、調べてみた。
練習問題やってみた。

練習問題

chartをドッキングせよ。

写真

image.png

サンプルコード


using System;
using System.Data;
using System.Linq;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using System.Drawing;
using System.Globalization;
using System.Windows.Forms.DataVisualization.Charting;

namespace Dock
{
	public partial class Win1: WeifenLuo.WinFormsUI.Docking.DockContent {
		public TextBox bo1;
		public Win1() {
			bo1 = new TextBox();
			bo1.Text = "";
			bo1.Multiline = true;
			bo1.Font = new Font("MS Pゴシック", 12);
			bo1.Dock = DockStyle.Fill;
			Controls.AddRange(new Control[] {
				bo1
			});
		}
	}
	public partial class Win2: WeifenLuo.WinFormsUI.Docking.DockContent {
		public Win2() {
			Chart chart1 = new Chart();
			chart1.ChartAreas.Clear();
			chart1.Series.Clear();
			chart1.Legends.Clear();
			chart1.Dock = DockStyle.Fill;
			chart1.ChartAreas.Add(new ChartArea());
			ChartArea chartArea = chart1.ChartAreas[0];
			chartArea.AxisX.IsMarginVisible = false;
			chartArea.AxisY.IsMarginVisible = false;
			chartArea.CursorX.IsUserSelectionEnabled = true;
			chartArea.CursorY.IsUserSelectionEnabled = true;
			chartArea.CursorX.Interval = 0;
			chartArea.CursorY.Interval = 0;
			chartArea.InnerPlotPosition.Auto = false;
			chartArea.InnerPlotPosition.X = 8.0f;
			chartArea.InnerPlotPosition.Y = 4.0f;
			chartArea.InnerPlotPosition.Width = 84.0f;
			chartArea.InnerPlotPosition.Height = 84.0f;
			this.Controls.Add(chart1);
			Series series = new Series {
				Color = Color.Blue,
				MarkerColor = Color.Blue,
				MarkerSize = 7,
				MarkerStyle = MarkerStyle.Circle,
				ChartType = SeriesChartType.Line
			};
			for (double i = 0; i < 720; i++)
			{
				double v = Math.Sin(i / 360 * 3.14 * 2);
				series.Points.AddXY(i, v);
			}
			chart1.Series.Add(series);
		}
	}
	public partial class Form1: Form {
		public Form1() {
			ClientSize = new Size(900, 600);
			Text = "dock";
			Test1();
		}
		private void Test1() {
			var dockPanel1 = new DockPanel();
			dockPanel1.ShowDocumentIcon = true;
			dockPanel1.Dock = DockStyle.Fill;
			dockPanel1.DocumentStyle = DocumentStyle.DockingWindow;
			Controls.Add(dockPanel1);
			var left1 = new Win1();
			left1.TabText = "left1";
			left1.Show(dockPanel1, DockState.DockLeft);
			var right1 = new Win1();
			right1.TabText = "right1";
			right1.Show(dockPanel1, DockState.DockRight);
			var bottom1 = new Win1();
			bottom1.TabText = "bottom1";
			bottom1.Show(dockPanel1, DockState.DockBottom);
			var center1 = new Win2();
			center1.TabText = "center1";
			center1.Show(dockPanel1, DockState.Document);
		}
		[STAThread]
		public static void Main() {
			Application.Run(new Form1());
		}
	}
}





以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?