GDI+入门(C#高速处理版本)
首先感谢CSDN的朋友laviewpbt为我给我的建议。
laviewpbt提出使用getpixel处理速度太慢,上不了档次。
这里我再给大家写两种处理速度更快的图形处理方式。
下面是个内存操作灰度的程序:
bmp = new Bitmap(Application.StartupPath + "\\1.jpg");
Bitmap bmp2 = (Bitmap)bmp.Clone();
int width = bmp2.Width;
int height = bmp2.Height;
Rectangle rect = new Rectangle(0, 0, width, height);
//用可读写的方式锁定全部位图像素
BitmapData bmpData = bmp2.LockBits(rect, ImageLockMode.ReadWrite, bmp2.PixelFormat);
//得到首地址
IntPtr ptr = bmpData.Scan0;
//24位bmp位图字节数
int bytes = width * height * 3;
byte[] rgbValues = new byte[bytes];
Marshal.Copy(ptr, rgbValues, 0, bytes);
//灰度化
double colorTemp = 0;
for (int i = 0; i < bytes; i += 3)
{
colorTemp = rgbValues[i + 2] * 0.299 + rgbValues[i + 1] * 0.587 + rgbValues[i] * 0.114;
&
相关文档:
C#实现Windows Form的透明背景用下面这段代码能实现非常有意思真正的透明背景,透明的地方不仅能显示其下一层的图案,而且能让鼠标穿越过去,成为真正的透明化。
注释掉的3行中,前2行代码是实现透明效果的另外第一个办法,最后1行是第三种办法。
但第一个方法根本不起作用,因为Windows Form所用“调色板”是&l ......
c#事务回滚(转)
作者:xue5ya 来源:博客园 发布时间:2009-03-20 16:08 阅读:263 次 原文链接 [收藏]
Code
public void UpdateContactTableByDataSet(DataSet ds,string strTblName)
{
......
C-#入门经典(第三版).pdf
using System;
using System.Data;
using System.Data.SqlClient;
namespace My_Student
{
static class Program
{
static void Main()
&n ......
DotNetBar正式版8.4.0.2,通过中国控件网采购。与试用版有明显的区别。主要是启动速度,正式版启动速度很快。另外有个问题提醒大家。
1、在工具栏中添加竖条,在DotNetBar中只需将需要添加这个竖条后面的控件的BeginGroup属性为true即可。
2、ComboBoxItem,使用。当DropDownStyle为DropDown时,不能在设计界面添加item否 ......