Category Archives: interoperability

Randomly change the desktop picture in C#

The example Set the Windows desktop picture in C# shows how to display an image on the desktop. This example periodically changes the desktop picture to a randomly selected image file picked from a directory. Note that recent versions of … Continue reading

Posted in API, graphics, image processing, interoperability, system | Tagged , , , , , , , , , , , , , , , | Leave a comment

Set the Windows desktop picture in C#

This example sets the Windows desktop picture much as you can manually in Windows 10. (I can’t guarantee that it will work without any changes in other versions of Windows.) Exactly how you set the desktop picture manually depends on … Continue reading

Posted in API, graphics, interoperability, system | Tagged , , , , , , , , , , , , , , , | Leave a comment

Convert RTF and TXT files into DOCX files in C#

First add a reference to Microsoft.Office.Interop.Word. To make using the library easier, add this using statement: using Word = Microsoft.Office.Interop.Word; When you enter the input and output file names and click Convert, the program uses the following code to open … Continue reading

Posted in files, interoperability, Office, Word | Tagged , , , , , , , , , , , , , | Leave a comment

Make a temperature forecast in C#

The example Get weather forecast data in C# explains how to read weather forecast data from OpenWeatherMap. This example uses that data to list the forecast’s temperatures. The forecast data has (in part) the following structure. <weatherdata> … <forecast> <time … Continue reading

Posted in internet, interoperability, web, XML | Tagged , , , , , , , , , , , , | 5 Comments

Get weather forecast data in C#

There are many sites that offer weather condition and weather forecast services. All of the ones I found required you to have a developer key, although most of them have a free membership that works for a simple program like … Continue reading

Posted in internet, interoperability, web, XML | Tagged , , , , , , , , , , | 1 Comment

Make an Excel chart in C#

This example uses the following code to create an Excel chart in a new workbook. private void btnCreateChart_Click( object sender, EventArgs e) { // Get the Excel application object. Excel.Application excel_app = new Excel.ApplicationClass(); // Make Excel visible (optional). excel_app.Visible … Continue reading

Posted in Excel, interoperability, Office | Tagged , , , , , , , , , , | Leave a comment

Drag and drop images while displaying a preview in C#

The example Drag and drop images in C# explains how to drag and drop images. See that example for the basic ideas. (Pay special attention to the second paragraph, which discusses the AllowDrop property for the PictureBox control.) This example … Continue reading

Posted in Drag and Drop, graphics, image processing, interoperability | Tagged , , , , , , , , , , , , , , , , , , | Leave a comment

Drag and drop text with feedback in C#

These examples explain the basics of drag and drop: Drag and drop text in C# Drag and drop images in C# Those examples use these methods and events: The DoDragDrop method to start a drag The DragEnter event to tell … Continue reading

Posted in Drag and Drop, interoperability | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Drag and drop images in C#

This example shows how to drag and drop images in C#. The example Drag and drop text in C# explains basic drag and drop operations. See that example for the fundamentals. One of the first things you must do before … Continue reading

Posted in Drag and Drop, graphics, image processing, interoperability | Tagged , , , , , , , , , , , , , , | 6 Comments

Drag and drop text in C#

This example shows how to let a program drag and drop text both between its controls and with drag and drop enabled controls in other applications. First, to receive a drop, you must set a control’s AllowDrop property to true. … Continue reading

Posted in Drag and Drop, interoperability | Tagged , , , , , , , , , , | 2 Comments