Topics
-
-
- *Gurus*
- Administrators
- 2 replies
- 12.3k views
Well, someone asked me to find a way to display line numbers next to a RichTextBox, so I knocked up this sample which seems to (roughly) do the trick. It wouldn't be hard to bump this up to spec, should you need it.richtextlinenumbers.zip
Last reply by AWS, -
-
-
- Administrators
- 0 replies
- 196 views
Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages and runtimes (such as C++, C#, Java, Python, PHP, Go, .NET). Begin your journey with VS Code with these introductory videos. You can download with the links below. Be sure to download the correct version for your system. Windows: https://code.visualstudio.com/sha/download?build=stable&os=win32-x64-user MacOS: https://code.visualstudio.com/sha/download?build=stable&os=darwin-universal Linux:…
Last reply by AWS, -
-
- 0 replies
- 8.5k views
A simplified version of the MSDN StreamSocket sample (tested and working). TCP Client (Windows Phone 8 App) Imports Windows.Networking Imports Windows.Networking.Sockets Imports Windows.Storage.Streams Partial Public Class MainPage : Inherits PhoneApplicationPage Dim Socket As StreamSocket Private Async Sub ButtonConnect_Click(sender As Object, e As RoutedEventArgs) Handles ButtonConnect.Click Socket = New StreamSocket Await Socket.ConnectAsync(New HostName("192.168.1.7"), "1234") StartListening() End Sub Private Async Sub StartListening() Dim reader As New DataReader(Socket.InputStream) Do ' Read first 4 …
Last reply by JumpyNET, -
- 0 replies
- 25.9k views
Windows Vista comes with a new feature called Default Programs (which replaces the Set Program Access and Default and File Types feature from Windows XP). This feature provides a way of changing program defaults, such as file and protocol associations and AutoPlay settings. To save us most of the trouble, David Kean has gone ahead and written a small wrapper around the IApplicationAssociationRegistrationUI::LaunchAdvancedAssociationUI method, which displays the file association window for a particular application. The usage of this method is simple: System.Windows.DefaultApplications.ShowAssociationsWindow("Internet Explorer") Here is a link for the source code a…
Last reply by JumpyNET, -
-
- Administrators
- 0 replies
- 5.5k views
The attached sample shows how to use the built in TripleDES provider to encrypt and decrypt a single file. The application was written under VS 2008 but the code itself will happily run against .Net 2 After selecting a file to encrypt enter a password and hit the Generate IV button to generate a random IV for the encryption. When you decrypt the file you need to make sure both the password and IV are the same. If you do not specify these then the system will generate these randomly each time and you will never be able to decrypt an encrypted file! The application itself has no real error handling so make sure you provide a password and an IV otherwise it will…
Last reply by PlausiblyDamp, -
-
- 0 replies
- 6.9k views
It took me a while to find this information, so I though I'd post it here incase it might save some time for some one else. Here's a simple code example: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim AppPath As String = """" & Application.ExecutablePath & """" & " ""%1""" Dim IconStr As String = "shell32.dll,116" 'What to do with mp3-files (icon, open command etc.) SaveToRegistry("SOFTWARE\Classes\Litware.Player.AssocFile.MP3", "", "MP3 Format Sound") SaveToRegistry("SOFTWARE\Classes\Litware.Player.AssocFile.MP3\DefaultIcon", "", IconStr) SaveToRegi…
Last reply by JumpyNET, -
-
- Leaders
- 0 replies
- 6.6k views
Howdo, I've been working on this for a couple of days, I did a VB.NET example of this on a forum a few years ago, but C# presented me with a new challenge & it took a while to figure out. The Idea is to get hold of an open instance of IE ( IE7 in this case ) & grab hold of it's IHTMLDocument2 Interface, giving the ability to manipulate that external Internet Explorer window / grab it's url address, it's html, make it navigate elsewhere, etc... when this code is added to a project, you must make a reference to Microsoft.mshtml using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.…
Last reply by dynamic_sysop, -
-
-
- Leaders
- 0 replies
- 12.6k views
Ever wish the picture box could scale images without using bilinear filtering (for example, when viewing/editing video game graphics)? In the past I had written controls from scratch that emulate the PictureBox but used my desired interpolation. Then I was hit with a stroke of common sense. I've extended the PictureBox class to enhance it with the ability to use various interpolation modes, including the video game creator's best friend, nearest neighbor. using System.Windows.Forms; using System.Drawing.Drawing2D; using System.ComponentModel; using System; namespace iLab { /// <summary> /// A PictureBox control extended to allow a variety of interpolations…
Last reply by snarfblam, -
-
-
- Leaders
- 2 replies
- 7k views
Anyone who has spent more than a little bit of time getting their hands dirty with reflection will be well aware that all kinds of magic can happen through the System.Type.InvokeMember method. Unfortunately, though, this function has a large number of parameters to cover nearly every member invocation/access scenario and it can become tedious stringing together confusing parameter arrays and binding flags and determining which parameters are relevant for every invocation, and the resulting code is very difficult to read. The Reflector class provides a number of methods that expose .Net's reflection capabilities in a more intuitive manner (and extends that functionality…
Last reply by snarfblam, -
-
-
- Leaders
- 0 replies
- 4.8k views
I posted this class definition on another thread and decided that it would be a good idea to post it in the Code Library as well. It is a generic, global object caching class, working in a dictionary-like manner (and, in fact, backed by a Dictionary<string, TValue> object). Because of the way that .Net handles fields of static classes you are provided a complete and separate cache for each type. (Or, to be more accurate, for each type parameter. For example, you can store a Bitmap in Cache<Image> and it will not be found in Cache<Bitmap>. Likewise, a Bitmap stored in Cache<Bitmap> will not be found in Cache<Image>.) The Cache class provide…
Last reply by snarfblam, -
-
-
- Leaders
- 0 replies
- 5.1k views
The DesignMode property of the Control class is meant to be testable to see if the control is in design mode, allowing the programmer to produce different behavior at design time than at runtime. Unfortunately, the behavior of this property is particularly unreliable. It certainly has frustrated me at times and I'm sure that it has frustrated others, so I did a quick google search and found a few work-arounds on a blog and another blog. Test the value of GetService(typeof(IDesignerHost)) for null within a component. A null value indicates that the component is not hosted in a designer. This method did not work for me consistently. Check System.ComponentModel.Licen…
Last reply by snarfblam, -
-
-
- Leaders
- 0 replies
- 5.3k views
I whipped this up for a small concept game, and decided to polish it up and post it here. It is ideal for simple tile based games. Possible Improvements: More rendering methods (i.e. draw group of tiles, clear control to default tile) More rendering overloads Support for multiple sources Multi-layer support (would involve saving tile indices to re-render lower layers) Optimizations (performance, visual appearance on large operations) I will probably incorporate some of these improvements and re-post later. TileBox.zip
Last reply by snarfblam, -
-
-
- Leaders
- 0 replies
- 10.6k views
The Problem Using reflection, you can manipulate almost any aspect of any object in a completely dynamic manner. However, when implementing a .Net based automation or scripting software it becomes painfully obvious that event handlers can not be attached dynamically unless a function with the appropriate signature already exists, which is hardly dynamic at all. There are two solutions to this problem. Solution: Delegate Contravariance Delegate contravariance is the creation of a delegate where the target method has at least one argument whose type derives from the corresponding argument's type on the delegate type declaration. For example, examine the following C# co…
Last reply by snarfblam, -
-
- 0 replies
- 8k views
Foreward I recently ran into a very annoying problem whilst developing for the Pocket PC. How to create an application that was full screen? The simple answer to this is you create a Form with it's WindowState property set to Maximised and set the Menu property to null. I wasn't happy with this however as although I didn't want the TaskBar and the SIP Icon, I still wanted to allow a menu. Solution 1 Many places I looked suggested that the way to get around this was to use the SHFullScreen API. The way this works is by moving the items passed into dwState below the object with the windows handle passed into hwndRequester. I'm not going to go into too much detail, but …
Last reply by Cags, -
-
- Administrators
- 0 replies
- 8.6k views
Just a quick example of how it is possible to create a custom textbox control in VB.Net. It exposes a property to define allowed content via an enumeration, raises an event on invalid entry and also handles programatic assigment and attempts to paste invalid data also. Zip also includes a sample form showing the control in action (or lack of action) CustomControl.zip
Last reply by PlausiblyDamp, -
-
- 0 replies
- 8.9k views
I've been worling on this class for a while, and while it's not finished it works pretty good and should be a great starting point for anyone looking to build d3d apps. Class Code: Imports System Imports Microsoft.DirectX Imports Microsoft.DirectX.Direct3D Imports Microsoft.DirectX.Direct3D.D3DX Public Class clsMesh 'Variable Declerations Private Device As Device 'Reference do the main Device Private v3Position As New Vector3(0, 0, 0) 'Location of our Mesh in 3D space Private Mesh As Mesh 'Our mesh file Private Materials() As Material 'Mesh Materials Private Textures() As Texture …
Last reply by Nate Bross, -
-
- Leaders
- 0 replies
- 11.4k views
Hi folks, long time since i done this http://www.xtremedotnettalk.com/x_images/images/smilies/frown.gif anyway i've knocked together a little example that allows you to list the files in a .CAB file ( it can be built upon to allow extraction etc... ) the class to read the cab ... '/// at very top of Class / Form... Imports System.Runtime.InteropServices Public Class CAB #Region "API / DELEGATES" <StructLayout(LayoutKind.Sequential)> _ Public Structure FILE_IN_CABINET_INFO Public NameInCabinet As IntPtr Public FileSize As Int32 Public Win32Error As Int32 Public DosDate As Int16 Public DosTime As Int16 Public DosAttribs As Int16 <MarshalAs(UnmanagedTy…
Last reply by dynamic_sysop, -
-
- 0 replies
- 7.5k views
some of you might find this of use. . . Suppose you have an property of a class that is an "Flags" attributed enum. reference the attached FlagsUI.dll assembly. . . apply this attribute to your property: [EditorAttribute(typeof(FlagsUI.FlagsEditor), typeof(System.Drawing.Design.UITypeEditor))] Now you get a dropdown checkbox to select the set of flags that are applied to the property. attached zip contains: FlagsUI - the Flagged property editor FlaggedComponents - two simple component/flag enumeration examples testapp - an example app. for best results - Build the solution before opening the form. Click on the "value" property of either of the…
Last reply by Joe Mamma, -
-
- Administrators
- 1 reply
- 12.8k views
Result of being bored in a hotel a few nights ago. Fairly rough and ready (only took a few hours and several guiness to throw together) but should handle ID3 v1 tags fine. Supports ID3 v2 tags more or less : Provides property access for the more common tags but should read and write all tags. Text based tags are untested with anything but ASCII content. Error handling may be a bit lacking feel free to PM me with any critical problems and I'll try to find time to fix them ;) Can be used something like MP3TagLibrary.ID3v2Tag test = new MP3TagLibrary.ID3v2Tag(); MessageBox.Show(test.Artist); //should display artist test.Artist= "This will overwrite the real tag - be …
Last reply by PlausiblyDamp, -
-
-
- Leaders
- 0 replies
- 9.9k views
the main part ( the interface it's self ) ... #Region " IActiveDesktop Interface" <ComImport(), Guid("F490EB00-1240-11D1-9888-006097DEACF9"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _ Public Interface IActiveDesktop '/// '// these functions need to be in the same order as seen in the SHLOBJ.H C/C++ Header file... '/// Function ApplyChanges(ByVal dwFlags As Integer) As IntPtr '///HRESULT ApplyChanges(DWORD dwFlags); Function GetWallpaper(<MarshalAs(UnmanagedType.LPWStr)> ByVal pwszWallpaper As System.Text.StringBuilder, ByVal cchWallpaper As Integer, ByVal dwReserved As Integer) As IntPtr '///HRESULT GetWallpaper(LPWSTR pwszW…
Last reply by dynamic_sysop, -
-
Who's Online 0 Members, 0 Anonymous, 14 Guests (See full list)
- There are no registered users currently online