我正在制作一个winforms应用程序.我希望实现的功能之一是在家庭形式上的旋转装置.
装载主页时,应将鼠标悬停在齿轮图片上,并应将其旋转到位.
但到目前为止,我所拥有的只是RotateFlip而且只是翻转图片.
当鼠标悬停在齿轮上时,有没有办法让齿轮转动到位?
我到目前为止的代码是:
Bitmap bitmap1;
public frmHome()
{
InitializeComponent();
try
{
bitmap1 = (Bitmap)Bitmap.FromFile(@"gear.jpg");
gear1.SizeMode = PictureBoxSizeMode.AutoSize;
gear1.Image = bitmap1;
}
catch (System.IO.FileNotFoundException)
{
MessageBox.Show("There was an error." +
"Check the path to the bitmap.");
}
}
private void frmHome_Load(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(5000);
}
private void frmHome_FormClosed(object sender, FormClosedEventArgs e)
{
Application.Exit();
}
private void pictureBox1_MouseHover(object sender, EventArgs e)
{
bitmap1.RotateFlip(RotateFlipType.Rotate180FlipY);
gear1.Image = bitmap1;
}
Run Code Online (Sandbox Code Playgroud)
就像我说的,我只是想转动装备.我试图在Windows窗体应用程序中执行此操作.使用C#.框架4
我当然有一个objetcs汽车列表其中的变量是:
使
模型
服务成本
让我们说清单填满了:
法拉利,F50,300
保时捷,911,700
丰田,Camary,300
保时捷,911,400
宝马,Z4,1200
保时捷,911,900
保时捷,356A,700
如您所见,我的列表包含保时捷911有服务费用的三条记录.
我如何遍历我的列表,找到重复的911并将它们组合成一个单独的记录?所以我最终得到:
法拉利,F50,300
保时捷,911,2000
丰田,Camary,300
宝马,Z4,1200
保时捷,356A,700
我到目前为止所做的事情是行不通的,因为我的记录可能最终会出现在错误的区域:
List<Car> CombinedCarRecords = new List<Car>(CarDetailRecords); //Original list here being used
List<Car> NormalList = new List<Car>();
List<Car> NewList = new List<Car>();//Making new lists to keep the records in
Car normalRecord = new Car();
Car combinedRecord = new Car();//new objects to keep the values in and add the others
string oldVal = "";
string newVal = "";//used to find the same cars …Run Code Online (Sandbox Code Playgroud)