ActiveX controls for C# ASP.net

J

Jayender

Hello People,
i have placed the ocx control in the web page , what i need to do is add
the image in that control (Dicom Viewer) , how to do it ?
is there any specific headers (like using System. ...) that is to be added
when using OLE controls or ActiveX controls ?
Code:
private void Button3_Click(object sender, System.EventArgs e)
{

DicomObjects.DicomImage Dicom = new DicomObjects.DicomImage();
Dicom.FileImport("C:\\pcinfo.bmp", "", "");
this.Viewer.Images.Add(Dicom);
} This is the code i have used in code bihind (C#)

here Viewer is the ocx object and i need to use that in my code behind to
add the image in it.
Please help me dude..

waiting for ur reply

Thanks,
jayender
 
V

Victor Dorofeyev

Use something like this:

protected void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if(!Page.IsPostBack)
{
this.sqlConnection1.ConnectionString=ConfigurationSettings.AppSettings
..Get("ConnectionString");
string s="<HTML>";
s+=" <OBJECT id=\"OCXVIEWER\"
codeBase=\"http://"+ConfigurationSettings.AppSettings.Get("AtrisServer")
+"/ActiveX/View.ocx\"";
s+=" height=\"100%\" hspace=\"0\" width=\"100%\" align=\"center\"
vspace=\"0\" classid=\"clsid:10644926-365B-4B09-AA85-43A0C4BF86B9\"";
s+=" VIEWASTEXT>";
#region SQL
string bildnr=Page.Request.QueryString[0];// bildnr="10211";
SqlCommand ordersCMD =
new SqlCommand("SELECT bildname FROM Dicbild where bildnr="+bildnr,
this.sqlConnection1);
this.sqlConnection1.Open();
string bildname = (string)ordersCMD.ExecuteScalar().ToString();
//Íàèìåíîâàíèå ïåðâîãî ôàéëà â ñåðèè áåç ðàñøèðåíèÿ
string s0, s7=bildname.Substring(6,1), s8=bildname.Substring(7,1);

SqlCommand myCMD = new SqlCommand("SELECT FileExt FROM single Where
Pnr="
+Int32.Parse(bildnr),this.sqlConnection1); // ñíèìêè ñåðèè

SqlDataReader myReader = myCMD.ExecuteReader();
s0="";
do
{
string sv;
while (myReader.Read())
{
sv=myReader.GetSqlString(0).Value;
s0+=
"http://"+ConfigurationSettings.AppSettings.Get("AtrisServer")+"/Hipax/G
etDicom?ImagePath=\\\\"+ConfigurationSettings.AppSettings.Get("PicServer
")+"\\Hipax\\pic\\"+s7+"\\"+s8+"\\"+bildname.Substring(0,8)+"."+sv.Subst
ring(0,3)+";";
}

} while (myReader.NextResult());

myReader.Close();
this.sqlConnection1.Close();
#endregion
s+=" <PARAM NAME=\"URLList\" VALUE=\""+s0+"\"";
s+=" <PARAM NAME=\"_ExtentX\" VALUE=\"0\">";
s+=" <PARAM NAME=\"_ExtentY\" VALUE=\"0\">";
s+=" </OBJECT>";

s+="</HTML>";
Page.Response.Write(s);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,048
Members
48,769
Latest member
Clifft

Latest Threads

Top