用户控件的 C# Chart.MarkerImage 路径错误

本文关键字:MarkerImage 路径 错误 Chart 控件 用户 | 更新日期: 2023-09-27 18:37:18

对不起,伙计们。谢谢来。

我有一个奇怪的错误。

现在我使用 Windows 窗体用户控件在 MFC 对话框中通过 msdn htmlhttp://msdn.microsoft.com/en-us//library/94t3ebxz(v=vs.90).aspx

这是工作,很好!

但是我尝试使用Chart.MarkerImage,它不能扭曲;

(1)这是我的项目职位

+project
    -Debug
    +MFCApplication
         -res
         -Debug
    +WindowsFormsControlLibrary
         -obj
         -Properties
         +Bin
             -Debug

(2)这里是用户控件1.设计器.cs

series.Points[m_nCurrentRecordPoints - 1].MarkerImage = "test.bmp";

首先,当我将WindowsFormsControlLibrary设置为启动项目并进行测试时.bmp到 ''project''WindowsFormsControlLibrary''bin''Debug''test.bmp 中。运行这个,它可以显示正确。

问题在这里。我将MFCApplication设置为启动项目。无论我把测试放在哪里.bmp进入。行不通!! ''项目''调试''测试.bmp ?''project''WindowsFormsControlLibrary''bin''Debug''test.bmp ?''project''MFCApplication''Debug''test.bmp ?

多谢!!

我想使用相对路径.Chart.MarkerImage 可以使用 BIT map 吗?

ps当我使用绝对路径(例如:D:/test.bmp)时,就可以了。

用户控件的 C# Chart.MarkerImage 路径错误

获取模块文件路径并构造完整路径。(Assembly.GetExecutingAssembly()。位置)仅当当前目录为 ''project''WindowsFormsControlLibrary''bin''Debug 时,代码才有效,但即使此设置也可能在程序执行期间更改。始终尝试对此类资源使用完整路径,