我有一个字符串,声明为:
string text = "THIS IS LINE ONE "+(Char)(13)+" this is line 2";
Run Code Online (Sandbox Code Playgroud)
然而,当我写作时Console.WriteLine(text);,
的输出是:
this is line 2E
Run Code Online (Sandbox Code Playgroud)
为什么会发生这种情况?或者是因为我是愚蠢的并且缺少明显的东西?
为什么不打印:
THIS IS LINE ONE [CR] //where the CR is a non printed character
this is line 2
Run Code Online (Sandbox Code Playgroud)
编辑
请注意:这不是 '如何添加回车'问题.
当鼠标悬停在图像上时,我正试图将字体上的字体真棒图标居中.这是我的HTML:
<div class="profile-img-container">
<img src="http://s3.amazonaws.com/37assets/svn/765-default-avatar.png" class="img-thumbnail img-circle img-responsive" />
<i class="fa fa-upload fa-5x"></i>
</div>
Run Code Online (Sandbox Code Playgroud)
我的CSS:
.profile-img-container {
position: relative;
}
.profile-img-container img:hover {
opacity: 0.5;
}
.profile-img-container img:hover + i {
display: block;
z-index: 500;
}
.profile-img-container i {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
}
Run Code Online (Sandbox Code Playgroud)
但是,字体真棒图标会一直显示在左侧,当我悬停图像时图标会保持闪烁.这是我的JSFiddle:http: //jsfiddle.net/fns8byfj/1/
我在vba中开发了下一个userform,它从工作表中获取信息以显示信息

我想通过Segment以字母方式订购所有信息,这是代码:
Function llenarDatosTabla()
Dim vList As Variant
Dim ws As Worksheet: Set ws = Worksheets(BD_PRODXSIST)
ListBox1.Clear
With ws
If (IsEmpty(.Range("AA2").Value) = False) Then
Dim ultimoRenglon As Long: ultimoRenglon = devolverUltimoRenglonDeColumna("A1", BD_PRODXSIST)
vList = ws.Range("AA2:AA" & ultimoRenglon & ":AL2").Value
If IsArray(vList) Then
Me.ListBox1.List = vList
Else
Me.ListBox1.AddItem (vList)
End If
End If
Me.ListBox1.ListIndex = -1
End With
Set vList = Nothing
Set ws = Nothing
End Function
Run Code Online (Sandbox Code Playgroud)
如何通过'AD'(SEGMENTO)专栏订购???
首先,这是我使用 Xaml 的第一天,所以这个问题对你来说可能是虚拟的,但我完全迷路了。
我的技术是我有 MainWindow.xaml ,它分为三个区域(使用网格列),列宽度自动设置。
根据右列中的一些操作,中间列显示一个页面,假设 Page.xaml 存在于不同的命名空间中。
问题是我需要将此页面的宽度和高度设置为等于中间列的宽度和高度,因为它将适合该区域。
我对 xaml 和绑定技术的经验很少。
主窗口.Xaml
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
WindowState="Maximized"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
Title="MainWindow" d:DesignWidth="1366" d:DesignHeight="768">
<Grid x:Name="MainGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.2*" x:Name="LeftColoumn" />
<ColumnDefinition Width="3*" x:Name="CenterColoumn" />
<ColumnDefinition Width=".8*" x:Name="RightColoumn" />
</Grid.ColumnDefinitions>
<ScrollViewer Grid.Column="2">
<StackPanel Orientation="Vertical" x:Name="RightStackPanel" Background="LightGray" >
<Border BorderBrush="{x:Null}" Height="50" >
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap" FontWeight="SemiBold" FontStyle="Normal" Margin="3" FontSize="20" >Others</TextBlock>
</Border>
<Expander x:Name="Expander1" Header="Others" Margin="0,0,10,0">
<Button Margin="0,0,0,0" Width="{Binding ActualWidth, ElementName=RightStackPanel}" Background="White" Content="Add" Height="50" Click="Button_Click" ></Button> …Run Code Online (Sandbox Code Playgroud) 我在下面有这个代码会自动选择一个范围.有谁知道如何添加代码来创建所选范围的表?
谢谢!
Sub DynamicRange()
'Best used when first column has value on last row and first row has a value in the last column
Dim sht As Worksheet
Dim LastRow As Long
Dim LastColumn As Long
Dim StartCell As Range
Set sht = Worksheets("Sheet1")
Set StartCell = Range("D9")
'Find Last Row and Column
LastRow = sht.Cells(sht.Rows.Count, StartCell.Column).End(xlUp).Row
LastColumn = sht.Cells(StartCell.Row, sht.Columns.Count).End(xlToLeft).Column
'Select Range
sht.Range(StartCell, sht.Cells(LastRow, LastColumn)).Select
End Sub
Run Code Online (Sandbox Code Playgroud) 问题:如何在WPF/XAML中创建带圆角的超链接图像?
到目前为止,超链接图像的现有代码(没有圆角)正在工作(见下文):
超链接图像(WPF XAML)
<TextBlock Name="txtbFooterRight" >
<Hyperlink Name="lnkImg" TextDecorations="None"
NavigateUri="http://webinfocentral.com"
ToolTip="Navigate to web page">
<Image Name="someName" Source="some url" />
</Hyperlink>
</TextBlock>
Run Code Online (Sandbox Code Playgroud)
后面的超链接图像代码(C#):
lnkImg.RequestNavigate += (s, e) => {Process.Start(e.Uri.ToString()); };
Run Code Online (Sandbox Code Playgroud)
带圆角的图像控制(无超链接)实现为:
带圆角的图像(WPF/XAML):
<Border Name="brdRounded" BorderThickness="0" CornerRadius="10">
<Border.Background >
<ImageBrush>
<ImageBrush.ImageSource>
<BitmapImage UriSource="some Uri to .jpg" />
</ImageBrush.ImageSource>
</ImageBrush>
</Border.Background>
</Border>
Run Code Online (Sandbox Code Playgroud)
我需要"覆盖超链接图像的角落"(WPF/XAML),可能结合上述技术.感谢致敬,
注意:我已经接受了用户@lisp发布的答案,只需稍加修复:边框背景颜色应与周围颜色相匹配,以避免轻微的"颜色泄漏".感谢作者!
另外还有一个注意事项:与HTML5/CSS3相比,使用WPF/XAML实现如此简单的效果是多么令人大开眼界的经验(参见示例,对圆角图像的效果基本相同:http:http ://infosoft.biz/SlideShowCSS.aspx).似乎微软的WPF人员应该注意......
我正在使用Outlook2013,它有来自交换服务器和pop服务器的多个邮箱.(Rob@mydomain.com [默认交换],rob @ somethingdifferent.com [POP],support@mydomain.com [交换])
我正在尝试使用Outlook自动化使用support@mydomain.com帐户发送电子邮件.
我遇到的问题是下面的代码在支持发件箱中创建了一个邮件项目,但是from字段是rob@mydomain.com而不是support@mydomain.com.这会阻止它被发送.
我想将发件人地址更改为support@mydomain.com.我认为通过设置Sendusingaccount属性就可以了.
任何帮助是极大的赞赏.
public static string Send_Email_Outlook(string _recipient, string _message, string _subject, string _cc, string _bcc, string accountname)
{
try
{
Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();
// Get the NameSpace and Logon information.
Microsoft.Office.Interop.Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
// Log on by using a dialog box to choose the profile.
oNS.Logon(Missing.Value, Missing.Value, true, true);
// Create a new mail item.
Microsoft.Office.Interop.Outlook.MailItem oMsg = (Microsoft.Office.Interop.Outlook.MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
// Set the subject.
oMsg.Subject = _subject;
// Set HTMLBody. …Run Code Online (Sandbox Code Playgroud) 我需要将所有文件从一个文件夹复制(Source)到另一个文件夹(Destination).我还需要比较两个文件夹并增加一个计数器,如果两个文件夹的内容与名称完全匹配,则计数器停止在100.
我不需要比较每个文件的大小,只需要比较名称.
这是我尝试过但我没有得到如上所述的欲望结果.
我在这里引用一些资源:http: //msdn.microsoft.com/en-us/library/bb546137.aspx
class Program
{
class FileCompare : System.Collections.Generic.IEqualityComparer<System.IO.FileInfo>
{
public FileCompare() { }
public bool Equals(System.IO.FileInfo f1, System.IO.FileInfo f2)
{
return (f1.Name == f2.Name &&
f1.Length == f2.Length);
}
public int GetHashCode(System.IO.FileInfo fi)
{
string s = String.Format("{0}{1}", fi.Name, fi.Length);
return s.GetHashCode();
}
}
static void Main(string[] args)
{
int i = 1;
string sourcePath = @"C:\Users\Administrator\Desktop\Source";
string destinationPath = @"C:\Users\Administrator\Desktop\Dest";
string fileName = System.IO.Path.GetFileName(sourcePath);
string source = System.IO.Path.Combine(sourcePath, fileName); …Run Code Online (Sandbox Code Playgroud) 我创建了一个简单的库存界面,它将从我的界面上的数据网格视图中访问和显示数据,然后通过按钮点击将信息发送到Excel.此部分根据需要工作,但我想在发送信息后删除未使用的列和行.我目前正在使用VS 2015.我无法弄清楚要添加什么来实现这一目标.
//send to excel
private void btnExport_Click(object sender, EventArgs e)
{
ActiveControl = txtSerial;
// creating Excel Application
Microsoft.Office.Interop.Excel._Application app = new Microsoft.Office.Interop.Excel.Application();
// creating new WorkBook within Excel application
Microsoft.Office.Interop.Excel._Workbook workbook = app.Workbooks.Add(Type.Missing);
// creating new Excelsheet in workbook
Microsoft.Office.Interop.Excel._Worksheet worksheet = null;
// see the excel sheet behind the program
app.Visible = true;
// get the reference of first sheet. By default its name is Sheet1.
// store its reference to worksheet
worksheet = workbook.Sheets["Sheet1"];
worksheet = …Run Code Online (Sandbox Code Playgroud) 所以我有两个切换按钮,我试图结合 - 有点.所以第一个按钮根据IsChecked是真还是假来切换图像,但是这个按钮周围有一个我无法摆脱的边框.
第二个切换按钮没有边框,单击时不闪烁,但也不会根据图像的状态更改图像.
我想要的是两个世界中最好的.更改图像并摆脱边框.我已经尝试了23件事,但没有一件工作.
这是我正在使用的代码:
<ToggleButton x:Name="changeButBorderedBlinky" Margin="0,12,194,0" Width="82" Height="82" Background="Transparent" Padding="-1" Focusable="false" VerticalAlignment="Top" HorizontalAlignment="Right">
<ToggleButton.Style>
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="Content">
<Setter.Value>
<Border BorderThickness="0" >
<Image Source="images/buttonimages/back2.png" Stretch="Fill" />
</Border>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Content">
<Setter.Value>
<Border BorderThickness="0" >
<Image Source="images/buttonimages/back.png" Stretch="fill" />
</Border>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
</ToggleButton>
<ToggleButton x:Name="noChangeNoBorder" Margin="0,12,104,0" VerticalAlignment="Top" HorizontalAlignment="Right" Height="80" Width="80" >
<ToggleButton.Template>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border x:Name="border" >
<Image x:Name="img" Source="images/buttonimages/back2.png" />
</Border>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助.这让我疯了.