PVA – Archives

Sưu tầm những bài viết hay trên internet…

Tag Archives: c#

Ẩn form lúc khởi tạo ứng dụng

From: http://stackoverflow.com/questions/70272/single-form-hide-on-startup HIDE FORM AT STARTUP Nhu cầu: Khi khởi động chương trình, form bị ẩn đi, chỉ hiển thị notifyIcon Giải pháp: – Xem xét file program.cs – Thay vì Application.Run(new MainForm()); ta khởi tạo form trước khi khởi tạo ứng dụng như vầy Form1 form1 = new Form1(); form1.Visible = false; Application.Run(); – [...]

Get/Set Window Text using the WINAPI and C#

From: http://www.dreamincode.net/forums/blog/126/entry-594-getset-window-text-using-the-winapi-and-c%23/ Welcome to this entry on Getting / Setting window text on external applications using the Windows API, in C#. I have recently been playing with the WINAPI functions, and found them quite intriguing, and thought I’d share my experiences with you, as everyone likes a good hax every now and then just to satisfy [...]

Processing Global Mouse and Keyboard Hooks in C#

Download source files [Version 2] – 31.63 KB Download demo application [Version 2] – 6.11 KB Download source files [Version 1] – 12.43 KB Download demo application [Version 1] – 5.58 KB Introduction This class allows you to tap keyboard and mouse and/or to detect their activity even when an application runs in the background [...]

C# Single-Instance Windows Form

From: http://dotnetperls.com/single-instance-windows-form You need to block new instances of your Windows Forms program from running alongside old ones. New instances must focus old ones if they exist, and then exit. Processes that are new should start normally. Here we see a solution to this problem that is adapted from other code on the Internet, written in the [...]

Placing Your C# Application in the System Tray

From: http://www.developer.com/article.php/3336751 There are many cases when it’s advantageous to place an application’s icon in the System Tray. For example, firewall/antivirus and instant messaging applications do this so as to run in the background and still be accessible to the user without crowding up the task bar. In this week’s installment of my .NET Tips and Techniques [...]

Enable wrap and change the color of Listbox items

From: http://blogs.msdn.com/b/rahulso/archive/2007/09/18/enable-wrap-and-change-the-color-in-listbox-items.aspx Problem description> You have a Listbox where you have a lot of items which are quite large and won’t fit inside the width of your listbox. You don’t want to enable Horizontal Scroll bar, since you have don’t want your users to keep scrolling left and right in order to view the items. Now [...]

Autoscroll (TextBox, ListBox, ListView) [C#]

From: http://www.csharp-examples.net/autoscroll/ This example demonstrates how to programatically autoscroll WinForm controls TextBox, ListBox, ListView, TreeView and DataGridView. Autoscroll to the end of box or view is useful, for example, in situations when you use one of these components as the output log window. Usually you add the items to the box or view and you want [...]

Bắt sự kiện thoát chương trình

Bạn muốn bắt sự kiện khi người sử dụng nhấp vào button có hình chữ “x” trên form. Để làm được điều này, bạn phải override hàm OnClosing như sau protected virtual void OnClosing ( CancelEventArgs e ) { //… } Xem thêm: http://msdn.microsoft.com/en-us/library/system.windows.forms.form.onclosing(v=VS.80).aspx

TCP/IP Chat Application Using C#

This is a LAN chat application with TCP/IP socket programming technology in C#. This application is a multi thread network application and works in a non-blocking way. Public and private chat is also implemented in this code. Download source files – 345 Kb Download demo – 298 Kb

Learn Regular Expression (Regex) syntax with C# and .NET

What are Regular Expressions? From: http://www.radsoftware.com.au/articles/regexlearnsyntax.aspx Regular Expressions are a powerful pattern matching language that is part of many modern programming languages. Regular Expressions allow you to apply a pattern to an input string and return a list of the matches within the text. Regular expressions also allow text to be replaced using replacement patterns. It is [...]

Follow

Get every new post delivered to your Inbox.