AjaxControlToolkit控件,当然是在Ajax下应用。在aspx页面或母版页中应该要写上:
</asp:ScriptManager>
TargetControlID指定要显示信息的控件,PopupControlID指定鼠标移动上时显示的信息。
<cc1:HoverMenuExtender ID="HoverMenuExtender1" runat="server" TargetControlID="Label30" PopupControlID="pMessage" PopupPosition="Right" OffsetX="0" OffsetY="15">
</cc1:HoverMenuExtender>
以下为显示信息的Panel。
<div>
<div ><strong>
使用帮助</strong></div>
...
</div>
</asp:Panel>
Css如下:
{
filter:alpha(opacity=70); /*IE*/
-moz-opacity:0.7; /*MOZ , FF*/
opacity:0.7; /*CSS3, FF1.5*/
background: #fff6bf;
text-align: left;
padding: 5px;
border: 1px solid #ffd324;
z-index: 1;
color:MenuText;
}
效果图:
本文链接
来自懒人张:RDLC报表(七)
有关LocalReport、DeviceInfo和PrintDocument的内容已经介绍得差不多了,稍后会给出一个继承自 System.Drawing.Printing.PrintDocument的组件EMFStreamPrintDocument。但是现在,来看一下 如何进行自定义纸张票据打印时的页面设置。页面设置窗体如下图所示:
如何添加、删除自定义大小的纸张、枚举系统的打印机?以前在博客园的一篇随笔中参加过讨论,见http://wormday.cnblogs.com/archive/2005/12/22/302635.aspx。 当然还是使用Win32 API,以下是我封装的一个关于打印机控制的类[以前用VB实现过比这个类还要多的关于打印机控制的功能,但是在C#中感到还是挺困难的,所以这次只给出 了够用的功能:获取当前指定打印机的状态、删除已经存在的自定义纸张、指定的打印机设置以mm为单位的自定义纸张(Form)、获取本地打印机列表、获取 本机的默认打印机名称、设置默认打印机、判断打印机是否在系统可用的打印机列表中、判断表单是否在指定的打印机所支持的纸张列表中、判断指定纸张的宽度和 高度和在文本框中指定的宽度和高度是否匹配、英尺到厘米的转换]:
using System.Text;
using System.Runtime.InteropServices;
using System.Security;
using System.ComponentModel;
using System.Drawing.Printing;
namespace RDLCReport
{
public class Printer
{
private Printer()
{
}
#region API声明
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
internal struct structPrinterDefaults
{
[MarshalAs(UnmanagedType.LPTStr)]
public String pDatatype;
public IntPtr pDevMode;
[MarshalAs(UnmanagedType.I4)]
public int DesiredAccess;
};
[DllImport("winspool.Drv", EntryPoint = "OpenPrinter", SetLastError = true,
CharSet = CharSet.Unicode, ExactSpelling = false, CallingConvention = CallingConvention.StdCall),
SuppressUnmanagedCodeSecurityAttribute()]
internal static extern bool OpenPrinter([MarshalAs(UnmanagedType.LPTStr)]
string printerName,
out IntPtr phPrinter,
ref structPrinterDefaults pd);
[DllImport("winspool.Drv", EntryPoint = "ClosePrinter", SetLastError = true,
CharSet = CharSet.Unicode, ExactSpelling = false,
CallingConvention = CallingConvention.StdCall), SuppressUnmanagedCodeSecurityAttribute()]
internal static extern bool ClosePrinter(IntPtr phPrinter);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
internal struct structSize
{
public Int32 width;
public Int32 height;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
internal struct structRect
{
public Int32 left;
public Int32 top;
public Int32 right;
public Int32 bottom;
}
[StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)]
internal struct FormInfo1
{
[FieldOffset(0), MarshalAs(UnmanagedType.I4)]
public uint Flags;
[FieldOffset(4), MarshalAs(UnmanagedType.LPWStr)]
public String pName;
[FieldOffset(8)]
public structSize Size;
[FieldOffset(16)]
public structRect ImageableArea;
};
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
internal struct structDevMode
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public String
dmDeviceName;
[MarshalAs(UnmanagedType.U2)]
public short dmSpecVersion;
[MarshalAs(UnmanagedType.U2)]
public short dmDriverVersion;
[MarshalAs(UnmanagedType.U2)]
public short dmSize;
[MarshalAs(UnmanagedType.U2)]
public short
一、首先新建一个静态类,将命名空间在改在System.Web.Mvc下,代码如下
代码 复制 - 运行
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace System.Web.Mvc
{
public static class MyHelpler
{
public static MvcHtmlString ActionLinkWithImage(this HtmlHelper html, string imgSrc, string actionName)
{
var urlHelper = new UrlHelper(html.ViewContext.RequestContext);
string imgUrl = urlHelper.Content(imgSrc);
TagBuilder imgTagBuilder = new TagBuilder("img");
imgTagBuilder.MergeAttribute("src", imgUrl);
string img = imgTagBuilder.ToString(TagRenderMode.SelfClosing);
string url = urlHelper.Action(actionName);
TagBuilder tagBuilder = new TagBuilder("a")
{
InnerHtml = img
};
tagBuilder.MergeAttribute("href", url);
return new MvcHtmlString(tagBuilder.ToString(TagRenderMode.Normal));
}
public static MvcHtmlString ActionLinkWithImage(this HtmlHelper html, string imgSrc, string actionName,string controllerName,object routeValue=null)
{
var urlHelper = new UrlHelper(html.ViewContext.RequestContext);
string imgUrl = urlHelper.Content(imgSrc);
TagBuilder imgTagBuilder = new TagBuilder("img");
imgTagBuilder.MergeAttribute("src", imgUrl);
string img = imgTagBuilder.ToString(TagRenderMode.SelfClosing);
string url = urlHelper.Action(actionName, controllerName, routeValue);
TagBuilder tagBuilder = new TagBuilder("a")
{
InnerHtml = img
};
tagBuilder.MergeAttribute("href", url);
return new MvcHtmlString(tagBuilder.ToString(TagRenderMode.Normal));
}
}
}
二、在view下使用:
代码 复制 - 运行
@Html.ActionLinkWithImage(Url.Content("~/Content/images/index_1.gif"), "Index")
@Html.ActionLinkWithImage(Url.Content("~/Content/images/index_2.gif"), "List","Admin", new { id=1})
原文地址:http://www.cnblogs.com/princeoicq/articles/2405914.html
本文链接