有哪位朋友懂得通过MouseDown、MouseMove以及MouseUp这三步实现图像的裁切功能?或者可以在多一步MouseDoubleClick或MouseLeave急求!
解决方案 »
- CreateFile打不开COM10以上的串口,有没有大神清楚怎么回事。。
- C#菜鸟求助
- 关于编码问题(高手帮帮我吧~~~)
- 如何把一个汉字变成2个字节?
- 求教C#跟托管C++混合编程的问题
- 急急急急急(tableLayoutPanel1;怎么把tableLayoutPanel1的第二行设置为1)
- 怎样使新打开的窗口是全屏,连标题栏也不要(没分了)
- 关于C#封装播放器的问题!
- help:c#,datagrid 主从表,从表的样式不起作用,why?
- 大牛们请问一下:WPF中DataGrid怎么样可以增加列并删除列,可以任意选中一列删除?
- 求助:如何将一张位图转换为三色64级灰度
- 如何根据英文字符返回unicode编码值和根据unicode的数字编码值返回字符
/// </summary>
/// <param name="xPosition">X起始点</param>
/// <param name="yPosition">Y起始点</param>
/// <param name="width">宽</param>
/// <param name="height">高</param>
public void DrawOutCropArea(int xPosition, int yPosition, int width, int height)
{
_bitmapPrevCropArea = (Bitmap)_currentBitmap;
Bitmap bmap = (Bitmap)_bitmapPrevCropArea.Clone();
Graphics gr = Graphics.FromImage(bmap);
Brush cBrush = new Pen(Color.FromArgb(150, Color.White)).Brush;
Rectangle rect1 = new Rectangle(0, 0, _currentBitmap.Width, yPosition);
Rectangle rect2 = new Rectangle(0, yPosition, xPosition, height);
Rectangle rect3 = new Rectangle(0, (yPosition + height), _currentBitmap.Width, _currentBitmap.Height);
Rectangle rect4 = new Rectangle((xPosition + width), yPosition, (_currentBitmap.Width - xPosition - width), height);
gr.FillRectangle(cBrush, rect1);
gr.FillRectangle(cBrush, rect2);
gr.FillRectangle(cBrush, rect3);
gr.FillRectangle(cBrush, rect4);
_currentBitmap = (Bitmap)bmap.Clone();
}