如何使用sql server2008在c#windows窗体中创建时显示picturebox数据 [英] How to show picturebox datas upon creation in c# windows forms with sql server2008

查看:88
本文介绍了如何使用sql server2008在c#windows窗体中创建时显示picturebox数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的名字是vishal。

2周以来,我一直在试图用sql server2008在c#windows窗体中创建图片框数据时如何?

我有一个图片框控件名称:pictureBox1 ,启用: true 和可见: true

在图片框内是

标签控件名称:lblPID ,已启用: true 且可见:是真

此标签控件位于StrokeScribe控件之上但是里面图片框控件

StrokeScribe 控件名称:barCOrg ,已启用: true 和可见:是真的

下面给出了如何使用sql serverS8控件(barCOrg)在c#server窗体中使用sql server2008生成条形码的代码:

hi my name is vishal.
For 2weeks i have been breaking my head on how to show picturebox datas upon creation in c# windows forms with sql server2008?
I have a picturebox control name:pictureBox1, enabled:true and visible:true
Inside the picturebox are
label control name:lblPID,enabled:true and visible:true
This label control is on top of StrokeScribe control but inside picturebox control
StrokeScribe control name:barCOrg,enabled:true and visible:true
Given below is code on how i generate barcode using StrokeScribe control(barCOrg) in c# windows forms with sql server2008.:

namespace DRRS_CSharp
{
   public partial class frmDialyzer : Form
   {
      int pUserID;
      public frmDialyzer()
      {
         InitializeComponent();
SqlConnection conn = new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
            if (conn.State != ConnectionState.Open)
            {
                conn.Open();
            }
            string PatientPull = ("select p.patient_id as patient_id,n.patient_first_name as patient_fname,n.patient_last_name as patient_lname from patient_name n,patient_id p where n.patient_id=p.patient_id and n.status =1 and p.patient_id not in (select d.patient_id from dialyser d where d.deleted_status=0)");
            SqlCommand cmd = new SqlCommand(PatientPull);
            cmd.Connection = conn;
            cmd.CommandType = CommandType.Text;
            SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                PatientPull = dr[1].ToString() + "_" + dr[2].ToString() + "(" + "0000" + dr[0].ToString() + ")";
                  cboPatientID.Items.Add(PatientPull);
            }
            dr.Close(); 
      }
      private void button1_Click(object sender, EventArgs e)
      {
         barCOrg.Alphabet = STROKESCRIBELib.enumAlphabet.CODE128;
         barCOrg.CtlText = txtDID.Text;
lblPID.Text = cboPatientID.Text;
         int rc = 0;
         rc = barCOrg.SavePicture("bar2.bmp", STROKESCRIBELib.enumFormats.BMP, barCOrg.Width, barCOrg.Height);
         if (rc > 0)
         {
            MessageBox.Show(barCOrg.ErrorDescription);
         }
         if (MessageBox.Show("Dialyzer detail was added successfully.Do you want to print the barcode dialyzerID?", "DRRS", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
         {
            System.Diagnostics.Process.Start("bar2.bmp");
         }
         this.Close();
      }
   }
}



上面的代码执行得很好,没有任何问题。



如您所见,我将创建的条形码图像保存为bar2.bmp。我使用System.Diagnostics.Process.Start(bar2.bmp)在c#windows窗体中打开我创建的条形码图像;



但是当打开我的条形码图像时,我得到了只创建了我的StrokeScribe控件(barCOrg)的图像,但我还应该获得标签控件(lblPID)的数据以及位于StrokeScribe控件(barCOrg)之上的bar2.bmp,两者都在picturebox控件(pictureBox1)中。

我知道为了完成这个必需的结果,我必须使用Shell函数。但我不知道在哪里以及在哪里使用它。我知道我必须在我的c#代码中做一些修改。

任何人都可以帮助我吗?任何帮助/指导解决这个问题都将不胜感激。


The above code executes well with no problem at all.

As you can see i save my created barcode image as bar2.bmp. I open my created barcode image in c# windows forms using System.Diagnostics.Process.Start("bar2.bmp");

But when opened my barcode image i get only created image of my StrokeScribe control(barCOrg) but i should also get data of label control(lblPID) along with bar2.bmp which is on top of StrokeScribe control(barCOrg) and both are inside picturebox control(pictureBox1).
I am aware that in order to accomplish this required result i have to use Shell functions.But i dont know what and where to use it.I know i have to do some modifications in my c# code.
Can anyone help me please?Any help/guidance in solving this problem would be greatly appreciated.

推荐答案

这篇关于如何使用sql server2008在c#windows窗体中创建时显示picturebox数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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