Click here to Skip to main content
15,881,938 members
Articles / Programming Languages / C++/CLI

Write your own UserControl with C++/CLI: an RSS reader

Rate me:
Please Sign up or sign in to vote.
4.33/5 (8 votes)
21 Mar 20064 min read 82.2K   2.1K   20  
Thsi article explains how to create an RSS reader user control.
#pragma once


namespace rssReader {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
	private: rssFeeder::rssFeederControl^  rssFeederControl1;
	private: rssFeeder::rssFeederControl^  rssFeederControl2;
	private: rssFeeder::rssFeederControl^  rssFeederControl3;
	protected: 

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->rssFeederControl1 = (gcnew rssFeeder::rssFeederControl());
			this->rssFeederControl2 = (gcnew rssFeeder::rssFeederControl());
			this->rssFeederControl3 = (gcnew rssFeeder::rssFeederControl());
			this->SuspendLayout();
			// 
			// rssFeederControl1
			// 
			this->rssFeederControl1->interval = L"300";
			this->rssFeederControl1->Location = System::Drawing::Point(12, 47);
			this->rssFeederControl1->Name = L"rssFeederControl1";
			this->rssFeederControl1->nbMax = L"5";
			this->rssFeederControl1->Size = System::Drawing::Size(251, 149);
			this->rssFeederControl1->TabIndex = 0;
			this->rssFeederControl1->url = L"http://blog.voidnish.com/\?feed=rss2";
			this->rssFeederControl1->urlComment = L"http://blog.voidnish.com/\?feed=comments-rss2";
			// 
			// rssFeederControl2
			// 
			this->rssFeederControl2->interval = L"300";
			this->rssFeederControl2->Location = System::Drawing::Point(82, 202);
			this->rssFeederControl2->Name = L"rssFeederControl2";
			this->rssFeederControl2->nbMax = L"7";
			this->rssFeederControl2->Size = System::Drawing::Size(424, 177);
			this->rssFeederControl2->TabIndex = 1;
			this->rssFeederControl2->url = L"http://blogs.msdn.com/MainFeed.aspx";
			this->rssFeederControl2->urlComment = nullptr;
			// 
			// rssFeederControl3
			// 
			this->rssFeederControl3->interval = L"300";
			this->rssFeederControl3->Location = System::Drawing::Point(314, 47);
			this->rssFeederControl3->Name = L"rssFeederControl3";
			this->rssFeederControl3->nbMax = L"4";
			this->rssFeederControl3->Size = System::Drawing::Size(267, 137);
			this->rssFeederControl3->TabIndex = 2;
			this->rssFeederControl3->url = L"http://blog.kalmbachnet.de/rss.php\?ver=2";
			this->rssFeederControl3->urlComment = nullptr;
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(605, 430);
			this->Controls->Add(this->rssFeederControl3);
			this->Controls->Add(this->rssFeederControl2);
			this->Controls->Add(this->rssFeederControl1);
			this->Name = L"Form1";
			this->Text = L"RSS Reader";
			this->ResumeLayout(false);

		}
#pragma endregion
	private: System::Void rssFeederControl3_itemClick(System::Object^  sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs^  e)
			 {
				System::Diagnostics::Process::Start(e->Link->LinkData->ToString());
				e->Link->Visited = true;
			 }
	private: System::Void rssFeederControl1_itemClick(System::Object^  sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs^  e) 
			 {
				System::Diagnostics::Process::Start(e->Link->LinkData->ToString());
				e->Link->Visited = true;
			 }
	private: System::Void rssFeederControl2_itemClick(System::Object^  sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs^  e) 
			 {
				System::Diagnostics::Process::Start(e->Link->LinkData->ToString());
				e->Link->Visited = true;
			 }
	};
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
France France
I'm a french developper, specially interested in windows programming with my favourite language, C++.

Beginning Windows programs with Win32, API & MFC, I finally move on C++/CLI. Now, I'm a Visual C++ MVP since 2007

My web site (in french nico-pyright.developpez.com) contains article and tutorial about Win32, MFC & C++/CLI.

I've also written a C++/CLI FAQ (to be continued ...)

Comments and Discussions