本文整理汇总了C#中Form2.Form2GetImage方法的典型用法代码示例。如果您正苦于以下问题:C# Form2.Form2GetImage方法的具体用法?C# Form2.Form2GetImage怎么用?C# Form2.Form2GetImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Form2
的用法示例。
在下文中一共展示了Form2.Form2GetImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessButton_Click
//.........这里部分代码省略.........
MessageBox.Show(YOffset.ToString() + " " + YofRightTop.ToString());
}
else if(91 <= theta & theta <= 269)
{
XOffset = Math.Abs(0 - SmallestX);
YOffset = Math.Abs(0 - SmallestY);
}
else
{
XOffset = Math.Abs(0 - SmallestX);
YOffset = 0;
}
*/
//往回位移量 = 新陣列中心點旋轉前 - 舊陣列中心點
XOffset = -Convert.ToInt32(Math.Floor((NewPictureWidth / 2) * CosTheta)) + Convert.ToInt32(Math.Floor((NewPictureHeight / 2) * SinTheta)) + OriXMid;
YOffset = -Convert.ToInt32(Math.Floor((NewPictureWidth / 2) * SinTheta)) - Convert.ToInt32(Math.Floor((NewPictureHeight / 2) * CosTheta)) + OriYMid;
for (int i = 0; i < NewPictureWidth; i++)
{
for(int j = 0; j < NewPictureHeight; j++)
{
if(Resize.Checked == false)
{
int OriginalXPos = Convert.ToInt32(Math.Floor((i - OriXMid) * CosTheta - (j - OriYMid) * SinTheta)) + OriXMid;
int OriginalYPos = Convert.ToInt32(Math.Floor((i - OriXMid) * SinTheta + (j - OriYMid) * CosTheta)) + OriYMid;
if (OriginalXPos >= 0 & OriginalXPos < SafeWidth & OriginalYPos >= 0 & OriginalYPos < SafeHeight)
{
HeHeBitmap.SetPixel(i, j, NewBitmap.GetPixel(OriginalXPos, OriginalYPos));
}
else
{
HeHeBitmap.SetPixel(i, j, Black);
}
}
else
{
int OriginalXPos = Convert.ToInt32(Math.Floor((i) * CosTheta - (j) * SinTheta)) + XOffset;
int OriginalYPos = Convert.ToInt32(Math.Floor((i) * SinTheta + (j) * CosTheta)) + YOffset;
if (OriginalXPos >= 0 & OriginalXPos < SafeWidth & OriginalYPos >= 0 & OriginalYPos < SafeHeight)
{
HeHeBitmap.SetPixel(i, j, NewBitmap.GetPixel(OriginalXPos, OriginalYPos));
}
else
{
HeHeBitmap.SetPixel(i, j, Black);
}
}
}
}
/*for(int i = 0; i < SafeWidth; i++)
{
for(int j = 0; j < SafeHeight; j++)
{
int NewXPos = Convert.ToInt32(Math.Floor(i * CosTheta + j* SinTheta));
int NewYPos = Convert.ToInt32(Math.Floor(-i * SinTheta + j * CosTheta));
if (NewXPos >= 0 & NewXPos < NewPictureWidth & NewYPos >= 0 & NewYPos < NewPictureHeight)
{
HeHeBitmap.SetPixel(NewXPos, NewYPos, NewBitmap.GetPixel(i, j));
}
}
}*/
}
else
{
HeHeBitmap = NewBitmap;
}
//平移
int XMovementData = 0;
int YMovementData = 0;
if (XMovement.Text != "")
{
XMovementData = Convert.ToInt32(XMovement.Text);
}
if (YMovement.Text != "")
{
YMovementData = Convert.ToInt32(XMovement.Text);
}
NewPictureWidth = NewPictureWidth + XMovementData;
NewPictureHeight = NewPictureHeight + YMovementData;
Bitmap HaHaBitmap = new Bitmap(NewPictureWidth, NewPictureHeight);
for(int i = 0; i < NewPictureWidth; i++)
{
for(int j = 0; j < NewPictureHeight; j++)
{
if((i - XMovementData) < 0 | (j - YMovementData < 0))
{
HaHaBitmap.SetPixel(i,j,Black);
}
else
{
HaHaBitmap.SetPixel(i, j, HeHeBitmap.GetPixel(i - XMovementData, j - YMovementData));
}
}
}
/*Send image to form2*/
Form2 newForm = new Form2();
newForm.Form2GetImage(HaHaBitmap);
newForm.Show();
}