gpt4 book ai didi

C# - OxyPlot 如何将绘图添加到窗口窗体

转载 作者:可可西里 更新时间:2023-11-01 09:07:19 27 4
gpt4 key购买 nike

试用 OxyPlot、已安装和引用的包。从此处复制并粘贴示例 http://docs.oxyplot.org/en/latest/getting-started/hello-windows-forms.html但它无法识别最后一行的 plot1。我猜是因为控件没有添加到表单中。我该如何添加它?我在工具箱中没有看到它,我尝试将控件添加到工具箱中,但在任何地方都找不到。谢谢。

最佳答案

您可以通过在初始化组件方法下的窗体设计器中附加这些行来手动添加绘图控件。

private void InitializeComponent()
{
this.plot1 = new OxyPlot.WindowsForms.PlotView();
this.SuspendLayout();
//
// plot1
//
this.plot1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.plot1.Location = new System.Drawing.Point(0, 0);
this.plot1.Name = "plot1";
this.plot1.PanCursor = System.Windows.Forms.Cursors.Hand;
this.plot1.Size = new System.Drawing.Size(500,500);
this.plot1.TabIndex = 0;
this.plot1.Text = "plot1";
this.plot1.ZoomHorizontalCursor = System.Windows.Forms.Cursors.SizeWE;
this.plot1.ZoomRectangleCursor = System.Windows.Forms.Cursors.SizeNWSE;
this.plot1.ZoomVerticalCursor = System.Windows.Forms.Cursors.SizeNS;
this.Controls.Add(this.plot1);

//
// other comtrols
//

}
private OxyPlot.WindowsForms.PlotView plot1;

关于C# - OxyPlot 如何将绘图添加到窗口窗体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26746090/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com