我正在制作一个小型油漆程序.我在位图上使用SetPixel来绘制线条.当画笔大小变大时,如同25个像素一样,会有明显的性能下降.我想知道是否有更快的方法来绘制位图.以下是该项目的背景:
我将包括我的绘图代码,以防万一这是缓慢而不是Set-Pixel位.
这是在绘画发生的窗口:
private void canvas_MouseMove(object sender, MouseEventArgs e)
{
m_lastPosition = m_currentPosition;
m_currentPosition = e.Location;
if(m_penDown && m_pointInWindow)
m_currentTool.MouseMove(m_lastPosition, m_currentPosition, m_layer);
canvas.Invalidate();
}
Run Code Online (Sandbox Code Playgroud)
MouseMove的实现:
public override void MouseMove(Point lastPos, Point currentPos, Layer currentLayer)
{
DrawLine(lastPos, currentPos, currentLayer);
}
Run Code Online (Sandbox Code Playgroud)
DrawLine的实现:
// The primary drawing code for most tools. A line is drawn from the last position to the current position
public override void DrawLine(Point lastPos, Point currentPos, Layer currentLayer)
{
// Creat a line vector
Vector2D vector …Run Code Online (Sandbox Code Playgroud) 这是针对 C# 的,我在使用 Visual Studio Express 2010 的 Windows 7 环境中工作。我有一个应用程序,我在其中设置了一个工具条容器停靠栏来填充,以便用户可以在任何边缘添加工具条。问题是 toolstripcontainer 已经覆盖了我想用来保存子窗口的东西。包含 toolstripcontainer 的主窗体已设置为 mdi 父窗体。我发现这篇文章对于将子窗口放入容器很有用: 如何在 MDI 父级上使用带有 Dock=Fill 的 ToolStripContainer?
但是,以这种方式完成的子窗口在“本机”MDI 环境中的行为似乎并不像它们应有的那样。寄宿生看起来好像 Windows 7 Aero 效果已被禁用,最小化子窗口使其完全消失。
本质上,我想要一个 MDI 区域用于由工具条停靠区域包围的子窗口。
非常感谢你的帮助