C# 从另一个类文件获取变量

C# 从另一个类文件获取变量,c#,C#,我有两个类文件,一个用于我的主窗体和调用对象,另一个用于我的图像处理代码。我的问题是我在Class2中的方法中创建了一个Bitmap,我需要它来设置PictureBox public void呈现(字符串bmpPath、十进制字母、十进制红色、十进制绿色、十进制蓝色) { 位图图像文件=新位图(bmpPath); } 我只需要发送它的位图,但我不知道如何正确地做到这一点。我尝试创建另一个位图,但我需要宽度和高度。您可以从该方法返回位图,而不是void public Bitmap Render(

我有两个类文件,一个用于我的主窗体和调用对象,另一个用于我的图像处理代码。我的问题是我在
Class2
中的方法中创建了一个
Bitmap
,我需要它来设置
PictureBox

public void呈现(字符串bmpPath、十进制字母、十进制红色、十进制绿色、十进制蓝色)
{
位图图像文件=新位图(bmpPath);
}

我只需要发送它的位图,但我不知道如何正确地做到这一点。我尝试创建另一个
位图
,但我需要宽度和高度。

您可以从该方法返回
位图
,而不是
void

public Bitmap Render(string bmpPath, decimal _Alpha, decimal _Red, decimal _Green, decimal _Blue)
{
    Bitmap imageFile = new Bitmap(bmpPath);
    return imageFile;
}
在主叫班(1班)


您可以从该方法返回
Bitmap
,而不是
void

public Bitmap Render(string bmpPath, decimal _Alpha, decimal _Red, decimal _Green, decimal _Blue)
{
    Bitmap imageFile = new Bitmap(bmpPath);
    return imageFile;
}
在主叫班(1班)


您可以从该方法返回
Bitmap
,而不是
void

public Bitmap Render(string bmpPath, decimal _Alpha, decimal _Red, decimal _Green, decimal _Blue)
{
    Bitmap imageFile = new Bitmap(bmpPath);
    return imageFile;
}
在主叫班(1班)


您可以从该方法返回
Bitmap
,而不是
void

public Bitmap Render(string bmpPath, decimal _Alpha, decimal _Red, decimal _Green, decimal _Blue)
{
    Bitmap imageFile = new Bitmap(bmpPath);
    return imageFile;
}
在主叫班(1班)

使该方法成为函数。函数的特点是它返回一个对象供其他人使用,在本例中为class1

public Bitmap Render(string bmpPath, decimal _Alpha, decimal _Red, decimal _Green, decimal _Blue)
{
    Bitmap imageFile = new Bitmap(bmpPath);
    return imagefile;
}
现在从1班开始(表格)

使该方法成为函数。函数的特点是它返回一个对象供其他人使用,在本例中为class1

public Bitmap Render(string bmpPath, decimal _Alpha, decimal _Red, decimal _Green, decimal _Blue)
{
    Bitmap imageFile = new Bitmap(bmpPath);
    return imagefile;
}
现在从1班开始(表格)

使该方法成为函数。函数的特点是它返回一个对象供其他人使用,在本例中为class1

public Bitmap Render(string bmpPath, decimal _Alpha, decimal _Red, decimal _Green, decimal _Blue)
{
    Bitmap imageFile = new Bitmap(bmpPath);
    return imagefile;
}
现在从1班开始(表格)

使该方法成为函数。函数的特点是它返回一个对象供其他人使用,在本例中为class1

public Bitmap Render(string bmpPath, decimal _Alpha, decimal _Red, decimal _Green, decimal _Blue)
{
    Bitmap imageFile = new Bitmap(bmpPath);
    return imagefile;
}
现在从1班开始(表格)


从类2中的类1调用方法
Render
,并更改该方法以返回新图像:

public Bitmap Render(string bmpPath, decimal _Alpha, decimal _Red, decimal _Green, decimal _Blue)
{
     return new Bitmap(bmpPath);
}

从类2中的类1调用方法
Render
,并更改该方法以返回新图像:

public Bitmap Render(string bmpPath, decimal _Alpha, decimal _Red, decimal _Green, decimal _Blue)
{
     return new Bitmap(bmpPath);
}

从类2中的类1调用方法
Render
,并更改该方法以返回新图像:

public Bitmap Render(string bmpPath, decimal _Alpha, decimal _Red, decimal _Green, decimal _Blue)
{
     return new Bitmap(bmpPath);
}

从类2中的类1调用方法
Render
,并更改该方法以返回新图像:

public Bitmap Render(string bmpPath, decimal _Alpha, decimal _Red, decimal _Green, decimal _Blue)
{
     return new Bitmap(bmpPath);
}

decimal
RGB组件的类型?真正地为什么?从另一个类文件获取变量?
decimal
RGB组件的类型?真正地为什么?从另一个类文件获取变量?
decimal
RGB组件的类型?真正地为什么?从另一个类文件获取变量?
decimal
RGB组件的类型?真正地为什么?从另一个类文件中获取变量?我如何调用它?(我是新来的)我该怎么称呼它呢?(我是新来的)我该怎么称呼它呢?(我是新来的)我该怎么称呼它呢?(我是新来的)