Click here to Skip to main content
15,881,089 members
Articles / Web Development / HTML

Implementing WS-SecureConversation in Microsoft IssueVision

Rate me:
Please Sign up or sign in to vote.
4.61/5 (12 votes)
27 Sep 20056 min read 73.1K   776   38  
Adding secure communications to the Microsoft IssueVision sample application using WSE 2.0.
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace IssueVision
{
	public class SectionHeader : Panel
	{
		// const values
		private class Consts
		{
			public static Color ColorLow = Color.FromArgb(175, 200, 245);
			public static Color ColorHigh = Color.FromArgb(205, 225, 250);
			public static Pen PenTop = new Pen(Color.FromArgb(180, 210, 245));
			public static Pen PenBottom = new Pen(SystemColors.InactiveCaption);
			public const int PosOffset = 4;
		}

		// internal members
		private LinearGradientBrush m_brush;
		private string m_text = string.Empty;

		[DefaultValueAttribute("")]
		[CategoryAttribute("Appearance")]
		[DescriptionAttribute("Header text.")]
		public string HeaderText
		{
			get
			{
				return m_text;
			}

			set
			{
				m_text = value;
				Invalidate();
			}
		}

		public SectionHeader()
		{
			SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true);
		}

		// the caption needs to be drawn
		protected override void OnPaint(PaintEventArgs e)
		{
			Draw(e.Graphics);
			base.OnPaint(e);
		}

		// draw the caption
		private void Draw(Graphics g)
		{
			if (Width != 0 && Height != 0)
			{
				// background
				g.FillRectangle(m_brush, DisplayRectangle);
				
				// header text
				g.DrawString(m_text, Font, SystemBrushes.ControlText, Consts.PosOffset, ((Height - Font.Height) / 2));
				
				// top and bottom lines
				g.DrawLine(Consts.PenTop, 0, 0, Width - 1, 0);
				g.DrawLine(Consts.PenBottom, 0, Height - 1, Width - 1, Height - 1);
			}
		}

		protected override void OnSizeChanged(EventArgs e)
		{
			base.OnSizeChanged(e);
			
			if (Width > 0 && Height > 0)
			{
				// create the gradient brush when the control is resized
				m_brush = new LinearGradientBrush(DisplayRectangle, Consts.ColorHigh, Consts.ColorLow, LinearGradientMode.Vertical);
			}
		}
	}
}

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
Software Developer (Senior)
United States United States
Weidong has been an information system professional since 1990. He has a Master's degree in Computer Science, and is currently a MCSD .NET

Comments and Discussions