小编Yog*_*hav的帖子

使用鼠标滚轮缩放图像。

在下面的代码中,我试图通过鼠标滚轮缩放图像。但是代码不能正常工作,它只是刷新面板但没有调整它的大小。实际上,我正在从另一个称为解密的类创建的内存流中获取图像。完整图像显示正确,但我无法使用鼠标滚轮事件执行图像缩放。请帮助我。

private void Form2_Load(object sender, EventArgs e)
{
    this.Width = Screen.PrimaryScreen.WorkingArea.Width;
    this.Height = Screen.PrimaryScreen.WorkingArea.Height;
    this.CenterToScreen();
    PicturePanel= new PictureBox();

    PicturePanel.Dock = DockStyle.Fill;
    //PicturePanel.SizeMode = PictureBoxSizeMode.AutoSize;

    //PicturePanel.SizeMode = PictureBoxSizeMode.CenterImage;
    PicturePanel.Focus();
    //PicturePanel.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.OnMouseWheel);
    this.Controls.Add(PicturePanel);


    View_codee v = new View_codee();

    try
    {
        PicturePanel.Image = Image.FromStream(Decrypt.ms1);
    }
    catch (Exception ee)
    {
        MessageBox.Show(ee.Message);
    }
    this.Name = "";
} 



protected override void OnMouseWheel(MouseEventArgs mea)
{
    // Override OnMouseWheel event, for zooming in/out with the scroll wheel
    if (PicturePanel.Image != null)
    {
        // If the mouse …
Run Code Online (Sandbox Code Playgroud)

c# mousewheel zooming

4
推荐指数
1
解决办法
2万
查看次数

使用Castle Windsor注入依赖关系

考虑我有一个界面.

interface Interface<A> {}  
Run Code Online (Sandbox Code Playgroud)

现在我有2个实现此接口的类:

class ClassOne<A>: I<A> {}
class ClassTwo<A>: I<A> {}  
Run Code Online (Sandbox Code Playgroud)

现在我想在第三个类中使用这两个类.

class child
{
    child(Interface<A> objCA,Interface<A> objCB)
    {}
}  
Run Code Online (Sandbox Code Playgroud)

我无法使用Castle Windsor为子类注入依赖项.即使我注入它,它只传递一个对象到它们所有.那么如何使用Castle Windsor解决这个问题呢?

c# castle-windsor

0
推荐指数
1
解决办法
231
查看次数

标签 统计

c# ×2

castle-windsor ×1

mousewheel ×1

zooming ×1