gpt4 book ai didi

c# - Horizo​​ntalLineAnnotation 调整大小

转载 作者:太空宇宙 更新时间:2023-11-03 10:43:01 25 4
gpt4 key购买 nike

以下是问题 Win Form Charting 的回复我正在尝试在 Windows 窗体图表上使用 Horizo​​ntalLineAnnotation。使用代码:

 private void MainForm_Load(object sender, EventArgs e)
{
Series series = SampleChart.Series.First();
ChartArea area = SampleChart.ChartAreas[series.ChartArea];
HorizontalLineAnnotation line = new HorizontalLineAnnotation()
{
AxisX = area.AxisX,
AxisY = area.AxisY,
ClipToChartArea = area.Name,
X = 50,
Width = 15,
Y = 120,
Height = 40,
LineWidth = 1,
LineColor = Color.Red,
LineDashStyle = ChartDashStyle.Dot,
AllowMoving = true,
AllowResizing = true
};
SampleChart.Annotations.Add(line);
}

根据 MSDN 属性,AllowMoving 和 AllowResizing 应该允许我使用鼠标移动和调整注释的大小。不幸的是,虽然 AllowMoving 很有魅力,但 AllowResizing 似乎被忽略了。或者,也许它没有像我认为的那样工作。有人对此控件有任何经验吗?

最佳答案

您需要在 Horizo​​ntalLineAnnotation 上设置 AllowSelecting = true。这允许用户选择该线并在选择该线时在每一端提供抓握 handle (小方 block )以允许根据下面的屏幕截图调整大小。

enter image description here

关于c# - Horizo​​ntalLineAnnotation 调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24594588/

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