国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

關于"C# Applet"

2024-07-21 02:18:24
字體:
來源:轉載
供稿:網友

商業源碼熱門下載www.html.org.cn

下面一段文字來自c# expert,

i am wondering how to build a c# applet. i built a class library with a custom control. but the browser (ie6) fails to render it as an object. do you have some examples to show how to achieve this? by the way, can a c# applet be run under platforms without the .net framework pre-installed?

there's no such concept as a c# "applet". at most, there are custom windows forms controls that are embedded on a page. of course, just like in java, you can't run it if you don't have the corresponding runtime on the client machine. you can use the <object> tag to add it to an html page: (zzj0820注:其實并沒有所謂的c# applet的概念,通常所說的c# applet指的是嵌入到瀏覽器里的窗體控件。當然,跟java類似,必須在客戶端機器上安裝相應的運行時庫才能使用嵌入在html頁面里的object標簽控件)

<object id="mycontrol" classid="http://mywebsite/myclasslibrary.dll#fullnamespace.mycontrolclass" height="480 "width="640"></object>

the class id contains the url of the dll for downloading and the fully qualified name of the class that implements the control. the library must not be placed on the /bin folder of a web application in order to be served by iis/asp.net

下面有兩個簡單的例子,希望有所幫助j

eg1: 原文鏈接

/*

* a simple c# program that displays some text in a webpage.

* compile with: "csc /t:library hello-world-applet.cs"

* run byte deploying in a webpage with:

* <object classid="http:hello-world-applet.dll#helloworldapplet" width="200" height="100"></object>

* ben bederson, january 16, 2002

*/

using system;

using system.drawing;

using system.windows.forms;

public class helloworldapplet : system.windows.forms.control {

public helloworldapplet() {

// create a "label" control

label label = new label();

label.text = "hello world!";

label.forecolor = color.blue;

label.font = new font("arial", 24, fontstyle.bold);

label.autosize = true;

// insert the label

controls.add(label);

}

}

eg2: 原文鏈接

c# applet
by lloyd dupont

i want to tell you how to write c# applet, display it in a web page and the requirement.

the requirement first, your c# applet won't work anywhere nor from anywhere. you should put (and test) it on iis, for unknown reason (at last unknown to me) this won't work locally or with apache. btw http://www.brinkster.com make free ".net" hosting.

not any client could display a c# applet, you surely need ie6 and probably .net sdk (at last with these configuration this work everywhere i know).

after you wrote your custom system.windows.forms.control, create it with a parameterless constructor (which will be called by ie) and wrap it in an assembly.

after you could display it very easily in a web page like this:

<object

id=anid

classid="http:myassemblydll.dll#controlclasstoinstantiate"

height=300 width=300>

</object>

and with id you could call it public method vis javascript like this

<script> <!--

myid.aproperty = avalue;

myid.refresh()

//--></script>

here is an example you could see at http://www24.brinkster.com/superlloyd/un.htm

-- un.html --

<html>

<head>

<title>c# web control i</title>

</head>

<body>

and now...<br>

<object id=t

classid="http:un.dll#wt.t"

height=300 width=300 viewastext>

</object>

<br>

<a href=un.cs>source</a>

</body>

</html>

-- un.cs --

using system;

using system.drawing;

using system.windows.forms;

// csc un.cs

// csc /t:library /out:un.dll un.cs

namespace wt

{

public class t : control

{

protected override void onpaint(painteventargs e)

{

e.graphics.fillrectangle(new solidbrush(color.azure), clientrectangle);

e.graphics.drawline(pens.darksalmon,

new point(0, 0),

new point(clientrectangle.width, clientrectangle.height));

}

public static void main(string[] m)

{

form f = new form();

t t = new t();

t.dock = dockstyle.fill;

f.controls.add(t);

application.run(f);

}

}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 荥经县| 黄平县| 托克逊县| 闵行区| 介休市| 达尔| 于田县| 新丰县| 弥勒县| 西宁市| 千阳县| 镇安县| 临江市| 平阳县| 汝城县| 永寿县| 衢州市| 买车| 汉阴县| 镶黄旗| 全州县| 黄浦区| 民乐县| 溧阳市| 蓬溪县| 南安市| 扶沟县| 常德市| 临桂县| 漳平市| 泾源县| 滨州市| 靖远县| 巴马| 额敏县| 富源县| 屯昌县| 墨江| 东乌| 武平县| 历史|