简体   繁体   English

我如何将其转换为C#

[英]How do i translate this into c#

I have found aa solution to a problem in one of my reports but its in VB.NET and I am not sure how to convert it to C#, I tried to do it online with one of the tools but it cant determine the events been used or something like that. 我在一份报告中找到了解决问题的方法,但在VB.NET中找到了解决方案,我不确定如何将其转换为C#,我尝试使用其中一种工具在线进行处理,但无法确定已使用的事件或类似的东西。 If there is anyone savy at both languages maybe you can help me figure out its translation? 如果有人在这两种语言上都有精明的表现,也许您可​​以帮助我弄清楚它的翻译? Here is the VB code 这是VB代码

Private Sub XrLabel1_BeforePrint(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintEventArgs)
Handles XrLabel1.BeforePrint

    CType(sender, XRLabel).Tag = GetCurrentColumnValue("ID")

End Sub



Private Sub XrLabel1_HtmlItemCreated(ByVal sender As Object, ByVal e As
DevExpress.XtraReports.UI.HtmlEventArgs) Handles XrLabel1.HtmlItemCreated

    e.ContentCell.InnerHtml =
String.Format("<a href=http://www.testarea.com/property.aspx?id={1}>{0}</a>", e.ContentCell.InnerText,
e.Data.Tag)

PS: I tried to convert it on this site http://www.developerfusion.com/tools/convert/vb-to-csharp/ PS:我试图在此站点上将其转换为http://www.developerfusion.com/tools/convert/vb-to-csharp/

THE ORIGINAL CODE IS FOUND HERE http://www.devexpress.com/Support/Center/KB/p/A1107.aspx 可在此处找到原始代码http://www.devexpress.com/Support/Center/KB/p/A1107.aspx

private void XrLabel1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
    ((XRLabel)sender).Tag = GetCurrentColumnValue("ID");
}

private void XrLabel1_HtmlItemCreated(object sender, DevExpress.XtraReports.UI.HtmlEventArgs e)
{
    e.ContentCell.InnerHtml = String.Format("<a href=http://www.testarea.com/property.aspx?id={1}>{0}</a>", e.ContentCell.InnerText, e.Data.Tag);
}

But the trick here is that you have to subscribe to the event somewhere, so you'll need this upon initialization: 但是这里的窍门是,您必须在某个地方订阅该事件,因此在初始化时将需要此:

XrLabel1.BeforePrint += XrLabel1_BeforePrint;
XrLabel1.HtmlItemCreate += XrLabel1_HtmlItemCreated;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM