首先,我想说我还是ASP.NET开发的初学者.我认为这是一个简单的问题,但我无法在任何地方找到答案.以下是我的问题:
我有一个开发.NET 2.0的大型ASP.NET项目.现在我必须将此项目更新为.NET 4.0.我认为当我加载并使用VS2010将其转换为.NET 4.0时它运行得很好,但是缺少这个参考.
缺少的引用是MSutil.dll,我不知道该引用是什么,我无法在任何地方找到dll.在cs代码中使用如下:
using LogQuery = MSUtil.LogQueryClassClass;
using IisW3cLogInputClass = MSUtil.COMIISW3CInputContextClassClass;
using LogRecordSet = MSUtil.ILogRecordset;
using LogRecord = MSUtil.ILogRecord;
Run Code Online (Sandbox Code Playgroud)
谁能告诉我......
我正在寻找一种简单的方法来打印DIN-A4纸,上面有数据库中的数据.应将数据填充到带边框的多个表中.某些数据应采用不同的文本格式,如粗体或带下划线.我还应该能够在该表上打印多个图像.
该程序应该是Windows窗体应用程序或用C#编写的控制台应用程序.
哪种格式化数据并将其打印出来的最简单/最常用的方法是什么?
任何建议apreciated :)
编辑:
这是我目前的代码几乎没有成功.它实际上打印但我得到的只是打印的xml文件.
private void printButton_Click(object sender, EventArgs e)
{
string printPath = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
fileToPrint = new System.IO.StreamReader(printPath + @"\test.xml");
printFont = new System.Drawing.Font("Arial", 10);
PrintDocument printDocument1 = new PrintDocument();
printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
printDocument1.Print();
fileToPrint.Close();
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
float yPos = 0f;
int count = 0;
float leftMargin = e.MarginBounds.Left;
float topMargin = e.MarginBounds.Top;
string line = null;
float linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics);
while (count < linesPerPage)
{
line …Run Code Online (Sandbox Code Playgroud) 我在运行时在我的窗口中生成一个 WPF 网格,例如如下所示:
<Grid Height="500" Width="1000" ShowGridLines="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="1*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
</Grid>
Run Code Online (Sandbox Code Playgroud)
所以第一、第三和第四列的宽度是第二列的一半。
我想要做的是在具有相同布局的 ASP.NET Webforms 应用程序中生成一个 css 布局,并且最好针对智能手机和平板电脑进行优化。我通常使用 bootstap,它提供了一种非常有效的生成布局的方法。例如:
<div class="row">
<div class="col-1">col</div>
<div class="col-2">col</div>
<div class="col-1">col</div>
<div class="col-1">col</div>
</div>
Run Code Online (Sandbox Code Playgroud)
不幸的是,在这个例子中没有办法做到这一点,因为引导程序布局有一个 12 列的网格,并且如上例所示,宽度永远不会被填充,因为列与网格布局绑定。如何实现这一目标?是否需要其他库并不重要。
编辑:
列数可能会有所不同,并且一个页面上可能会有多个具有不同列数的网格。此外,宽度 1*,2*,1*,1* 只是一个例子。它也可能是 5*,2*,2*,1*,1*(第一列是最后两列宽度的 5 倍,第二列和第三列是最后两列宽度的两倍)
我有以下代码:
private void fileSystemWatcher_Changed(object sender, System.IO.FileSystemEventArgs e)
{
System.Diagnostics.Process execute = new System.Diagnostics.Process();
execute.StartInfo.FileName = e.FullPath;
execute.Start();
//Process now started, detect exit here
}
Run Code Online (Sandbox Code Playgroud)
FileSystemWatcher正在观看保存.exe文件的文件夹.保存到该文件夹的文件正确执行.但是当打开的exe关闭时,应该触发另一个函数.
有一个简单的方法吗?
我正在尝试在我的ASP.NET MVC应用程序中创建一个ul/li菜单.菜单应该有4到5个顶级菜单项,每个topmenu项应该有一个带有一些子菜单项的悬停/下拉菜单.完成的菜单结构应该看起来像带有下拉列表的常用ul/li菜单:
<ul>
<li class="active">
<a>Topmenu 1</a>
<ul>
<li>Submenu1</li>
<li>Submenu2</li>
<li>Submenu3</li>
</ul>
</li>
<li class="inactive">
<a>Topmenu 2</a>
<ul>
<li>Submenu4</li>
<li>Submenu5</li>
<li>Submenu6</li>
</ul>
</li>
And so on...
</ul>
Run Code Online (Sandbox Code Playgroud)
顶部菜单项应具有"活动"和"非活动"的类.我通过制作生成topmenu项目的自定义HtmlHelper解决了这个问题.看起来像这样:
public static MvcHtmlString MenuItem(
this HtmlHelper htmlHelper,
string text,
string action,
string controller
)
{
var li = new TagBuilder("li");
var routeData = htmlHelper.ViewContext.RouteData;
var currentAction = routeData.GetRequiredString("action");
var currentController = routeData.GetRequiredString("controller");
if (string.Equals(currentAction, action, StringComparison.OrdinalIgnoreCase) &&
string.Equals(currentController, controller, StringComparison.OrdinalIgnoreCase))
{
li.AddCssClass("tab active");
}
else {
li.AddCssClass("tab inactive");
}
li.InnerHtml = htmlHelper.ActionLink(text, …Run Code Online (Sandbox Code Playgroud) 我有以下代码:
string date = "13.04.2012";
string date2 = (DateTime.Parse(date).AddDays(1)).ToString();
Run Code Online (Sandbox Code Playgroud)
这是正常工作没有问题,但在DateTime.Parse函数后变量date2是'14 .04.2012 00:00:00'但我想只有日期'14 .04.2012'没有时间戳.
我想过使用像这样的子字符串函数:
string sub = date2.Substring(0, 10);
Run Code Online (Sandbox Code Playgroud)
这会像这样工作,但是没有更好的方法来获得这个结果?