C# 按钮未获得正确图像的MouseLeave事件

C# 按钮未获得正确图像的MouseLeave事件,c#,winforms,C#,Winforms,在表单加载中,我将此代码用于所有6个按钮 private void Parent_Load(object sender, EventArgs e) { btnExam.SetBounds(btnExam.Location.X, btnExam.Location.Y, 175, 154); btnResult.SetBounds(btnResult.Location.X, btnResult.Location.Y, 175, 154); btnContactUs.SetBounds(btn

在表单加载中,我将此代码用于所有6个按钮

private void Parent_Load(object sender, EventArgs e) 
{ 
btnExam.SetBounds(btnExam.Location.X, btnExam.Location.Y, 175, 154); 
btnResult.SetBounds(btnResult.Location.X, btnResult.Location.Y, 175, 154); 
btnContactUs.SetBounds(btnContactUs.Location.X, btnContactUs.Location.Y, 175, 154); 
btnClasses.SetBounds(btnClasses.Location.X, btnClasses.Location.Y, 175, 154); 
btnCollegeList.SetBounds(btnCollegeList.Location.X, btnCollegeList.Location.Y,175,154); 
btnAbout.SetBounds(btnAbout.Location.X, btnAbout.Location.Y, 175, 154); 

GraphicsPath polygon_path = new GraphicsPath(FillMode.Winding); 
polygon_path.AddPolygon(GetPoints(btnExam.ClientRectangle)); 
polygon_path.AddPolygon(GetPoints(btnResult.ClientRectangle)); 
polygon_path.AddPolygon(GetPoints(btnContactUs.ClientRectangle)); 
polygon_path.AddPolygon(GetPoints(btnClasses.ClientRectangle)); 
polygon_path.AddPolygon(GetPoints(btnCollegeList.ClientRectangle)); 
polygon_path.AddPolygon(GetPoints(btnAbout.ClientRectangle)); 

// Convert the GraphicsPath into a Region. 
Region polygon_region = new Region(polygon_path); 

// Constrain the button to the region. 
btnExam.Region = polygon_region; 
btnResult.Region = polygon_region; 
btnContactUs.Region = polygon_region; 
btnClasses.Region = polygon_region; 
btnCollegeList.Region = polygon_region; 
btnAbout.Region = polygon_region; 

}
以及所有按钮的“鼠标事件”中的以下代码

现在,如果我试图在“MouseLeave_事件”中使用下面的代码,那么我没有得到指定的图像,我没有得到以下图像

private void genericButtonLeave_event(object sender, EventArgs e) 
{ 
var btn = (Button)sender; 
var imageName = btn.Name + "L"; 
btn.Image = (Bitmap)Properties.Resources.ResourceManager.GetObject(imageName); 
}
这就是我为按钮悬停图像所做的全部更改
请确实建议我如何在
mouseLeave事件
上获取图像,错误在哪里

错误信息是什么?你如何将你的
图像
存储在
资源
中?@KingKing我只是从文件夹中复制图像并将它们粘贴到
资源.resx
c#项目的文件中,我没有收到任何错误,在
鼠标删除事件
中,我没有看到那个按钮的图像,我可以在加载表单时看到它
private void genericButtonLeave_event(object sender, EventArgs e) 
{ 
var btn = (Button)sender; 
var imageName = btn.Name + "L"; 
btn.Image = (Bitmap)Properties.Resources.ResourceManager.GetObject(imageName); 
}