请帮助我,在C#.net中打印 [英] please help me, print in C#.net

查看:51
本文介绍了请帮助我,在C#.net中打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
pleeeeeeeease 请帮助我.我在c#.net中有问题.
我有3种表单,其中1种是在Form1中的文本框,1种是在Form2中的文本框.
在form3中:我想要一个打印按钮以在form1&中打印文本框的文本. form2

pleeeeeease 请帮助我,我是C#的新手,请非常感谢您解释 tnx .

hello every body
pleeeeeeeease Please help me . I have problem in c#.net.
I have 3 forms,1 textbox in form1,1 textbox in form2.
In form3: i want to have a print button to print the text of textboxes in form1 & form2

pleeeeeease Please help me I''m new in C# please explain your answer tnx thanks a lot.

推荐答案

在Form1中声明静态字符串;

在Form1
Declare a static string in Form1;

In Form1
public static string SetValueForTextBox1 = "";



然后在按钮中单击;



and in button click;

SetValueForTextBox1 = textBox1.Text;




在Form2中类似地声明另一个静态变量




similaarly declare another static variable in Form2

public static string SetValueForTextBox2 = "";



然后在按钮中单击;



and in button click;

SetValueForTextBox2 = textBox1.Text;




并在Printbuttonclick的form3中,您可以从FOrm1和form2中获取文本框值,例如,




and in the form3 on Printbuttonclick, You can get the textbox values from FOrm1 and form2 like,

Form1.SetValueForTextBox1 ;
Form2.SetValueForTextBox2 ;


嗨siasalar,

通过使用打印对话框,我们可以获取打印.


请参阅下面的网址,我希望这可以达到您的要求.
http://msdn.microsoft.com/en-us/library/aa969773.aspx [ ^ ]

http://www .dreamincode.net/forums/topic/50924-use-a-print-dialog-box-to-print-contents-of-textbox/ [
hi siasalar,

by using print dialog box we can get the print.


see the below url, i hope this achieves u r requirement.
http://msdn.microsoft.com/en-us/library/aa969773.aspx[^]

http://www.dreamincode.net/forums/topic/50924-use-a-print-dialog-box-to-print-contents-of-a-textbox/[^]




创建用于将值存储在form1和form2中的属性
公共静态类实用程序
{
公共静态字符串ValueForm1;
公共静态字符串ValueForm2;

公共静态字符串valueForm1
{
得到{return ValueForm1; }
设置{ValueForm1 =值; }
}

公共静态字符串valueForm2
{
得到{return ValueForm2; }
设置{ValueForm2 =值; }
}
}
将值存储在form1和form2的此属性中,并在form3上调用此ValueForm1,ValueForm2.
Hi,

Create property for storing the value in form1 and form2
public static class Utility
{
public static string ValueForm1;
public static string ValueForm2;

public static string valueForm1
{
get { return ValueForm1; }
set { ValueForm1 = value; }
}

public static string valueForm2
{
get { return ValueForm2; }
set { ValueForm2 = value; }
}
}
Store value in this property from form1 and form2 and call this ValueForm1 ,ValueForm2 on the form3.


这篇关于请帮助我,在C#.net中打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆