English 中文(简体)
显示图像的习惯控制
原标题:Custom control for displaying images

我有自己的课程,代表图像数据。 她们有各种基本结构,但所有财产都有指数化,可回归一,j-th图像元素。 我需要以一种形式展示这种形象。 现在,我先将其更改为<代码>System.Drawing.Bitmap,然后在标准Winforms 代码上展示。 我的想法是建立一种习惯控制,这种控制将具有我形象的特性,并显示一种情况,而不将其初步改为<条码>。 图像/编码。

我建议,这一问题的cl点正在产生一种由用户撤出的控制和凌驾于当地的奥巴特事件。

protected override void  OnPaint(PaintEventArgs e)
    {
        for(int i=e.ClipRectangle.Left; i<=e.ClipRectangle.Right; i++)
        {
            for (int j = e.ClipRectangle.Top; j <= e.ClipRectangle.Bottom; j++)
            {
                //do something with i and j here
                //calculate the corresponding k and l indices
                //assign _myCustomClassImage[k,l] somewhere
            }
        }

    }

是的,我的理解是,我可以绘制一下单壳左侧大小的比图,并利用SetaPixel来分配其要素,但SetaPixel的工作非常缓慢。

另一种想法是利用摩托车分配比图象,但在整个奥潘特活动手里制作一个比图的想法似乎很 la。

我是否在继续工作方面提出任何建议?

最佳回答

如果你想要显示的数据以某种方式成为病媒,则建立习惯控制和压倒“OnPaint”方法具有价值。 如果你有显示形象的话,那么比制造一个比图标没有什么更好的选择。

我知道Setas是缓慢的,我不相信你在分配比照地图时使用摩托车的含义是什么,但使用<密码>有一个快的选择。 系统.Drawing.Imaging.BitmapData 等和Bitmap.LockBits。 见http://msdn.microsoft.com/en-us/library/system.drawing.imaging.bitmapdata.aspx”rel=“nofollow”>here。

因此,你为什么需要在“奥潘特”方法中制造比特马物体? 难道不是仅仅创造和分配它吗?

问题回答

暂无回答




相关问题
Bring window to foreground after Mutex fails

I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...

How to start WinForm app minimized to tray?

I ve successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

Handle DataTable.DataRow cell change event

I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#?

Apparent Memory Leak in DataGridView

How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

WPF-XAML window in Winforms Application

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.

热门标签