This is a preview version of Cyotek's blog and may be missing functionality and/or unstable. Please visit https://www.cyotek.com/blog for the current version of the blog.
If you encounter any problems using this preview site, please contact us with the details.

Creating a Windows Forms RadioButton that supports the double click event

c# winforms double click radiobutton 0 Comments

Another of the peculiarities of Windows Forms is that the RadioButton control doesn't support double clicking. Granted, it is not often you require the functionality but it's a little odd it's not supported.

As an example, one of our earlier products which never made it to production uses a popup dialog to select a zoom level for a richtext box. Common zoom levels are provided via a list of radio buttons. Rather than the user having to first click a zoom level and then click the OK button, we wanted the user to be able to simply double click an option to have it selected and the dialog close.

Read More

Boulder Dash Part 1: Implementing Sprite AI

c# ai game sprite boulder dash 0 Comments Downloads

One of the projects I've had on the backburner for over a year now was a Boulder Dash clone. While I was working on this clone I written a basic game engine using GDI, another using managed DirectX, editing tools, and even a conversion tool for the BDCFF. Everything but the game itself.

After working pretty much nonstop on the Sitemap Creator and WebCopy tools recently, I wanted to take things a bit easy between releases and wanted to resurrect this project.

Read More

Creating a Windows Forms Label that wraps with C#

c# winforms autosize wordwrap label 4 Comments

One of the few annoyances I occasionally get with C# is the lack of a word wrap facility for the standard Label control.

Instead, if the AutoSize property is set to True, the label will just get wider and wider. In order to wrap it, you have to disable auto resize then manually ensure the height of the label is sufficient.

Read More

Snippet: Mime types and file extensions

c# content type extension mime type 0 Comments

If you have a mime type and you want to find the default extension for it, you can get this from the Extension value in the following registry key:

HKEY_CLASSES_ROOT\MIME\Database\Content Type<mime type>

Read More

Unable to update the EntitySet because it has a DefiningQuery and no element exists in the element to support the current operation.

c# sql server entity framework 3 Comments

After integrating the new forum code, I added basic subscription support. When replying to a topic and opting to subscribe to notifications, the following exception would be thrown:

Unable to update the EntitySet 'ThreadSubscriptions' because it has a DefiningQuery and no element exists in the element to support the current operation.

Read More

Converting BBCode into HTML using C#

c# bbcode html regular expression 0 Comments Downloads

Although the dynamic content in the Cyotek website is written using Markdown syntax using the MarkdownSharp library, we decided to use the more commonly used BBCode tags for the forums.

Some of the source code on this site is also preformatted using the CSharpFormat library, and we wanted to provide access to this via forum tags too.

Read More

Using XSLT to display an ASP.net sitemap without using tables

c# xslt sitemap transform xml webforms mvc asp.net 3 Comments

The quick and easy way of displaying an ASP.net site map (web.sitemap) in an ASP.net page is to use a TreeView control bound to a SiteMapDataSource component as shown in the following example:

<asp:SiteMapDataSource runat="server" ID="siteMapDataSource" EnableViewState="False"   ShowStartingNode="False" />
<asp:TreeView runat="server" ID="siteMapTreeView" DataSourceID="siteMapDataSource"  EnableClientScript="False" EnableViewState="False" ShowExpandCollapse="False"></asp:TreeView>
Read More

Error 80040154 when trying to use SourceSafe via interop on 64bit Windows

win64 80040154 {783cd4e4-9d54-11cf-b8ee-00608cc9a71f} interop com sourcesafe 9 Comments

We recently moved to Windows 7, and I decided to go with the 64bit version for my machine. One of the utilities we use is a small tool for adding folders to Visual SourceSafe (why we haven't moved to another SCC provider yet is another question!) via the SourceSafeTypeLib interop dll. However, I was most annoyed when it wouldn't work on my machine, the following exception message would be displayed:

Retrieving the COM class factory for component with CLSID {783CD4E4-9D54-11CF-B8EE-00608CC9A71F} failed due to the following error: 80040154.

Read More

Creating a GroupBox containing an image and a custom display rectangle

c# winforms groupbox displayrectangle 0 Comments Downloads

Add a new Component class to your project, and inherit this from the standard GroupBox.

    [ToolboxItem(true)]
    [DefaultEvent("Click"), DefaultProperty("Text")]
    public partial class GroupBox : System.Windows.Forms.GroupBox
Read More