나는이 인터페이스인쇄 사진 및 텍스트
양식이 텍스트 상자에 사용자로부터 데이터를 받아 또한 사용자가 그림 상자에 이미지를로드 할 수있다 양식을 가지고있다. 내 질문은 내가 어떻게 사용자가 텍스트 및 이미지를 함께 양식에있는 방식으로 인쇄 할 수 있습니다.
이 코드를 사용하여 textboxes
및 labels
의 데이터를 인쇄 할 수있었습니다.
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
string fname = txtName.Text;
string lname = txtLname.Text;
string mname = txtMname.Text;
string address = txtAddress.Text;
string gender = cmbGender.SelectedItem.ToString();
string country = cmbCountry.SelectedItem.ToString();
string data = "First Name : \t" + fname + "\n\nLast Name : \t" + lname + "\n\nMiddle Name : \t" + mname + "\n\nAddress : \t" + address + "\n\nGender : \t" + gender + "\n\nNationality : \t" + country;
e.Graphics.DrawString(data, new Font("Arial", 20, FontStyle.Regular), Brushes.Black, 20, 20);
}
Pls 사용자가 텍스트와 함께 그림을 인쇄 할 수있게하려면 무엇을 추가해야합니까?
참고 : 내가 그림 상자에 그림을로드하는 방법
이것은
private void btnLoad_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
picCpic.Image = Image.FromFile(openFileDialog1.FileName);
}
catch (OutOfMemoryException er)
{
MessageBox.Show(er.Message);
}
}
}
'e.Graphics.DrawImage (picCpic.Image , 300, 20);'xy 값으로 재생하십시오. – LarsTech
@LarsTech Pls 내 코드에 어디에 넣어야합니까? –
e.Graphics.DrawString (...) 코드 바로 아래에 있습니다. – LarsTech