我在我的格式化PC上运行Visual Studio 2013 Pro(RTM版本)(Windows 8.1全新安装).
我不知道为什么但Visual Studio 2013 Pro非常慢!在IDE中进行构建,调试,导航的速度很慢...我的硬盘驱动器根本没有点亮!
我正在使用Boost库进行一个小型MFC(C++)项目.
有任何想法吗?
我使用Bing地图WPF控件创建了一个WPF应用程序.我希望能够只截取Bing地图控件.
使用此代码制作屏幕截图:
// Store the size of the map control
int Width = (int)MyMap.RenderSize.Width;
int Height = (int)MyMap.RenderSize.Height;
System.Windows.Point relativePoint = MyMap.TransformToAncestor(Application.Current.MainWindow).Transform(new System.Windows.Point(0, 0));
int X = (int)relativePoint.X;
int Y = (int)relativePoint.Y;
Bitmap Screenshot = new Bitmap(Width, Height);
Graphics G = Graphics.FromImage(Screenshot);
// snip wanted area
G.CopyFromScreen(X, Y, 0, 0, new System.Drawing.Size(Width, Height), CopyPixelOperation.SourceCopy);
string fileName = "C:\\myCapture.bmp";
System.IO.FileStream fs = System.IO.File.Open(fileName, System.IO.FileMode.OpenOrCreate);
Screenshot.Save(fs, System.Drawing.Imaging.ImageFormat.Bmp);
fs.Close();
Run Code Online (Sandbox Code Playgroud)
我的问题:
在Width
和Height
似乎是坏的(假值).生成的屏幕截图似乎使用了不良坐标.
我的截图:
我期待的是:
为什么我得到这个结果?我尝试在发布模式下,没有Visual Studio,结果是一样的.
有没有办法对WPF DataGrid programmaticaly进行排序(例如,如果我点击我的第一列).
有没有办法模拟这个点击?还是最好的方式?
这是我的代码:
Collection_Evenements = new ObservableCollection<Evenement>();
Collection_Evenements = myEvenement.GetEvenementsForCliCode(App.obj_myClient.m_strCode);
Collection_Evenements.CollectionChanged += Collection_Evenements_CollectionChanged;
myDataGridEvenements.ItemsSource = Collection_Evenements;
System.Data.DataView dv = (System.Data.DataView)myDataGridEvenements.ItemsSource;
dv.Sort = "strEvtType";
myDataGridEvenements.Focus();
myDataGridEvenements.SelectedIndex = 0;
myDataGridEvenements.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
Run Code Online (Sandbox Code Playgroud)
我不知道为什么,但行"dv.Sort ="strEvtType";" 导致一个奇怪的事情,我的窗口显示和程序不继续执行下一行,但我没有看到那种!
非常感谢,
最好的祝福,
Nixeus
由于我Window
在我的应用程序中有多个s,我正在寻找一个不需要我binding
在每个上面设置的解决方案Window
.
我创建了一个ResourceDictionary
具有style
窗口背景的:
<Style TargetType="{x:Type Window}">
<Setter Property="Background" Value="AliceBlue"/>
</Style>
Run Code Online (Sandbox Code Playgroud)
在我XAML
,我设置ResourceDictionary
:
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Templates.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
Run Code Online (Sandbox Code Playgroud)
没有错误,但我的Window
颜色保持白色.
我有一个std::string
.我需要将其转换std:string
为Cstring
.
我尝试使用.c_str()
但它只用于非unicode项目,我使用unicode项目(因为非unicode项目与VS2013一起被贬低).
任何人都可以告诉我如何转换std::string
为CString
unicode项目?
我想创建一个C#函数来测试与FTP服务器的连接.
这是我的功能:
FtpWebRequest requestDir = (FtpWebRequest)FtpWebRequest.Create("ftp://" + strHost.Trim());
requestDir.Credentials = new NetworkCredential(strUser, strPass);
requestDir.Method = WebRequestMethods.Ftp.ListDirectory;
try
{
WebResponse response = requestDir.GetResponse();
return "ok";
}
catch (Exception ex)
{
return ex.Message;
}
Run Code Online (Sandbox Code Playgroud)
我的问题很简单:
II使用好的主机(一个好的FTP主机),我的功能返回"OK".如果,之后,我使用了一个坏主机,它会返回一个异常
ERROR 421 : Service not available. Closing control connection.
Run Code Online (Sandbox Code Playgroud)
如果,再次,它用良好的地址重新测试,我有一个新的时间这个例外.
我需要关闭并重新打开我的应用程序才能解决这个问题.
我试着用:
KeepAlive = true / false and no changes.
Run Code Online (Sandbox Code Playgroud)
有人可以帮我吗?
非常感谢,
最好的祝福,
Nixeus
我有一个dateTimePicker.为了将此DateTimePicker内容写入我的DataBase,我得到的值为:
myDateTimePicker.selectedDate.value.
Run Code Online (Sandbox Code Playgroud)
当用户手动选择日期时,这没关系.
但是......当用户直接在DateTimePicker中键入日期时,SelectedDate.value
给我更旧的值.物有所值.Text
.
有没有办法.Text
与.SelectedValue.value
?同步?
也许我需要阅读其他财产?
我想绑定ObservableCollection
到wpf datagrid.我ObservableCollection
不是空的,但是,我的数据网格保持空白:
public partial class Fenetre_EvtCode : Window
{
ObservableCollection<EvtCode> glb_ObservableEvtCode;
public Fenetre_EvtCode()
{
InitializeComponent();
EvtCode myEvt = new EvtCode();
glb_ObservableEvtCode = myEvt.GetAllEvtCode();
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的xaml:
<DataGrid Foreground="Aqua"
Name="myDataGridEvtCode"
AutoGenerateColumns="True"
HorizontalAlignment="Stretch"
Margin="0,0,0,0"
VerticalAlignment="Stretch"
Height="453"
ItemsSource="{Binding glb_ObservableEvtCode}" />
Run Code Online (Sandbox Code Playgroud)
我再说一遍:我看了调试,我ObservableCollection
不是空的.
有谁知道为什么ma datagrid保持空?
我想用两种颜色生成中间色:
Color Middle = Color.FromRGB(Color.FromRgb( Color1.R + Color2.R) / 2, (Color1.G + Color2.G) / 2, (Color1.B + Color2.B) / (2);
Run Code Online (Sandbox Code Playgroud)
此代码将无法编译,因为FromRGB()
需要a byte
.
所以我尝试了这个:
Color myColorMiddle = Color.FromRgb((byte)(Color1.R + Color2.R) / (byte)2, (byte)(Color1.G + Color2.G) / (byte)2, (byte)(Color1.B + Color2.B) / (byte)2);
Run Code Online (Sandbox Code Playgroud)
但我得到了同样的错误.有人可以帮我吗?
我有一个读取 SQL Server 数据库的 C# 应用程序。\n有时我会收到错误并且应用程序崩溃。
\n\n如果我查看事件查看器,我会得到以下信息:
\n\nApplication\xc2\xa0: XXXXXXXXX_CLI.EXE\nVersion du Framework\xc2\xa0: v4.0.30319\nDescription : le processus a \xc3\xa9t\xc3\xa9 arr\xc3\xaat\xc3\xa9 en raison d'une exception non g\xc3\xa9r\xc3\xa9e.\nInformations sur l'exception\xc2\xa0: System.ComponentModel.Win32Exception\n\nInformations sur l'exception\xc2\xa0: System.Data.SqlClient.SqlException\n \xc3\xa0 System.Data.SqlClient.SqlConnection.OnError(System.Data.SqlClient.SqlException, Boolean, System.Action`1<System.Action>)\n \xc3\xa0 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(System.Data.SqlClient.TdsParserStateObject, Boolean, Boolean)\n \xc3\xa0 System.Data.SqlClient.TdsParser.TryRun(System.Data.SqlClient.RunBehavior, System.Data.SqlClient.SqlCommand, System.Data.SqlClient.SqlDataReader, System.Data.SqlClient.BulkCopySimpleResultSet, System.Data.SqlClient.TdsParserStateObject, Boolean ByRef)\n \xc3\xa0 System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()\n \xc3\xa0 System.Data.SqlClient.SqlDataReader.get_MetaData()\n \xc3\xa0 System.Data.SqlClient.SqlCommand.FinishExecuteReader(System.Data.SqlClient.SqlDataReader, System.Data.SqlClient.RunBehavior, System.String)\n \xc3\xa0 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, Boolean, Int32, System.Threading.Tasks.Task ByRef, Boolean, System.Data.SqlClient.SqlDataReader, Boolean)\n \xc3\xa0 System.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, Boolean, System.String, System.Threading.Tasks.TaskCompletionSource`1<System.Object>, Int32, System.Threading.Tasks.Task ByRef, Boolean)\n \xc3\xa0 System.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior, System.Data.SqlClient.RunBehavior, …
Run Code Online (Sandbox Code Playgroud)