选择合适的组件 [英] Select a suitable component

查看:81
本文介绍了选择合适的组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

首先抱歉我的英语不好,

我正在进行图像处理项目,我需要有两张并排图片。什么是siutable组件为了那个吗?

谢谢。

i我正在使用picturebox(在autoscroll = true的面板中)为该项目,我有以下代码用于放大和缩小y图片在鼠标滚轮事件。但它有一个问题:

第一次(运行我的项目后)当我使用Ctrl +鼠标滚轮它工作,然后当我使用鼠标滚轮没有

Ctrl每个东西都可以。我可以滚动浏览我的图片。

但是当我第一次使用ctrl + wheel(必须缩放我的图片)时不会work.It也没有错误。

  private   void  Form6_Load( object  sender,EventArgs e)
{
tmpsize.Height = baseimg.Height;
tmpsize.Width = baseimg.Width;
pictureBox1.Height = tmpsize.Height;
pictureBox1.Width = tmpsize.Width;
pictureBox1.Image = baseimg;
pictureBox1.SizeMode = PictureBoxSizeMode.Normal;

}
私有 void Form6_MouseWheel( object sender,MouseEventArgs e)
{
if (Control.ModifierKeys == Keys.Control)
{
尝试
{

tmpsize.Height + = e.Delta;
tmpsize.Width + = e.Delta;
位图nbpm = 位图(baseimg,tmpsize);
pictureBox1.Height = tmpsize.Height;
pictureBox1.Width = tmpsize.Width;
pictureBox1.Image = nbpm;
}
catch
{
}
}
else
{
panel1.Focus();
}
}



theks。

解决方案

'  m使用WinForm。 
实际上我想在我的项目中加载两个图像并将它们并排显示。
我需要将它们放大和缩小并使用图像处理过滤器对它们进行操作。我希望它们在我的表单最大化和最小化时保持分歧。


取决于很多因素:如果你将它们作为单独的图像,那么你可以使用一对PictureBoxes。或者您可能希望自己在Form.Paint事件中绘制它们。我将使用哪个将取决于我对他们做了什么 - 我们不能给你一个这是最好的答案,因为对所有情况都没有。


hello
first sorry for my bad english,
I am on an Image Processing project and i need to have two side by side pictures.what is the siutable component for that please?
thanks.
i am using picturebox (which is inside a panel with autoscroll=true) for that project,and i have following code for zoom in and out y picture in mouse wheel event.but it has a problem :
for the first time (after run my project) when i use Ctrl + mouse wheel it works and then when i use mouse wheel without
Ctrl every thing is ok.And i can scrolll through my picture.
but when i use ctrl+wheel for the first time (which must zoom my picture) doesn''n work.It also doesn''t have error.

private void Form6_Load(object sender, EventArgs e)
       {
           tmpsize.Height = baseimg.Height;
           tmpsize.Width = baseimg.Width;
           pictureBox1.Height = tmpsize.Height;
           pictureBox1.Width = tmpsize.Width;
           pictureBox1.Image = baseimg;
           pictureBox1.SizeMode = PictureBoxSizeMode.Normal;

       }
 private void Form6_MouseWheel(object sender, MouseEventArgs e)
       {
           if (Control.ModifierKeys == Keys.Control)
           {
               try
               {

                   tmpsize.Height += e.Delta;
                   tmpsize.Width += e.Delta;
                   Bitmap nbpm = new Bitmap(baseimg, tmpsize);
                   pictureBox1.Height = tmpsize.Height;
                   pictureBox1.Width = tmpsize.Width;
                   pictureBox1.Image = nbpm;
                                  }
               catch
               {
               }
           }
           else
           {
               panel1.Focus();
           }
       }


thenks.

解决方案

I'm using WinForm s.
Actually i want to load two images in my project and show them side by side.
And i need them to be zoomed in and out and manipulate them with Image Processing filters.And i want them to stay divide when my form maximize and minimize.


Depends on a lot of factors: if you have them as separate Images, then you could use a pair of PictureBoxes. Or you might want to draw them yourself in the Form.Paint event. Which I would use would depend on what else I was doing with them - we can''t give you a "this is best" answer, becasue there really isn''t one for all situations.


这篇关于选择合适的组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆