Click here to Skip to main content
Licence CPOL
First Posted 29 Mar 2007
Views 14,670
Downloads 336
Bookmarked 21 times

Textwizard

By | 29 Mar 2007 | Article
An article on building an TextWizard simlar Kaspersky anti-viruse in C# with transparency

Introduction

In" kaspersky anti_virus 6.0", there is a component witch is the same as my component

that can shows every texts. There are buttons witch names are "next"&"back"that used

for looking in every texts. I called my component "text wizard".

The way of using

Click on "tool box" with right-click & choose the" choose items ".after add the

'Ehsangolkar.dll'. finally you should drag the textWizard component and drop in your form.

Now it available for using.

Screenshot - properties.jpg

White 'Captioncurveradius' property you can change the radius curve. My suggestion for radius curve is '7' default value

In addition, white using 'TextCollectin' you can definite the new items for Textwizard.

TextCollection

How to use :

After clicking on textwizard and adding new item you could change the value items like color, caption box and panel box, caption text caption image, etc.

Screenshot - Textcollection.jpg

How to make:

The class as a kind of public has been definition for making text collection witch has inheritance from

System.Collections.CollectionBase class and use

System.Collections.IList interface

You can see the codes of this class here:

 
public class TextWizardItemCollection : System.Collections.CollectionBase, System.Collections.IList

{

/// <summary>

/// Raised when a Segment is clicked on the control

/// </summary>

public event CollectionUpdatedEventHandler CollectionUpdated;

 

/// <summary>

/// Return the item at the specified index.

/// </summary>

public TextWizardItems this[int index]

{

get

{

return (TextWizardItems)List[index];

}

}

/// <summary>

/// Adds elements to the list.

/// </summary>

/// <param name="items"></param>

public void AddRange(TextWizardItems[] items)

{

foreach (TextWizardItems item in items)

{

this.List.Add(item);

}

OnCollectionUpdated(new EventArgs());

}

/// <summary>

/// Add one element to the list.

/// </summary>

/// <param name="item"></param>

public void Add(TextWizardItems item)

{

List.Add(item);

OnCollectionUpdated(new EventArgs());

}

/// <summary>

/// Inserts an item at the specified index

/// </summary>

/// <param name="index"></param>

/// <param name="item"></param>

public void Insert(int index, TextWizardItems item)

{

this.List.Insert(index, item);

OnCollectionUpdated(new EventArgs());

}

/// <summary>

/// Copies a range of elements from the ArrayList to a compatible one-dimensional Array, 

/// starting at the specified index of the target array.

/// </summary>

/// <param name="array"></param>

/// <param name="index"></param>

public void CopyTo(TextWizardItems[] array, int index)

{

this.List.CopyTo(array, index);

}

/// <summary>

/// When implemented by a class, determines the index of a specific item in the IList.

/// </summary>

/// <param name="item"></param>

public int IndexOf(TextWizardItems item)

{

return this.List.IndexOf(item);

}

/// <summary>

/// Remove the item from the list

/// </summary>

/// <param name="value"></param>

public void Remove(TextWizardItems value)

{

this.List.Remove(value);

OnCollectionUpdated(new EventArgs());

}

/// <summary>

/// Determine if the list contains the item

/// </summary>

/// <param name="value"></param>

/// <returns></returns>

public bool Contains(TextWizardItems value)

{

return this.List.Contains(value);

}

/// <summary>

/// Handles the OnUpdate event 

/// </summary>

/// <param name="e"></param>

protected virtual void OnCollectionUpdated(EventArgs e)

{

if (CollectionUpdated != null)

{

// Invokes the delegates. 

CollectionUpdated(this, e);

}

}

}

Caption-box

To actually draw the caption box:

 
GraphicsPath myPath = new GraphicsPath();

Pen myPen = new Pen(outlineColor, 1);

// Draw the path to the screen.

myPath.AddArc(this.Width - captionCurveRadius * 2 - 1, Consts.CaptionOffset,

captionCurveRadius * 2, captionCurveRadius * 2, 270, 90);

myPath.AddArc(this.Width - captionCurveRadius * 2 - 1, Consts.CaptionHeight,

captionCurveRadius * 2, captionCurveRadius * 2, 0, 90);

myPath.AddArc(0, Consts.CaptionHeight, captionCurveRadius * 2 - 1,

captionCurveRadius * 2, 90, 90);

myPath.AddArc(0, Consts.CaptionOffset, captionCurveRadius * 2 - 1,

captionCurveRadius * 2, -180, 90);

myPath.AddLine(captionCurveRadius, Consts.CaptionOffset,

this.Width - captionCurveRadius - 1, Consts.CaptionOffset);

e.Graphics.FillPath(b, myPath);

e.Graphics.DrawPath(myPen, myPath);

Panel-box

 
GraphicsPath panelPath = new GraphicsPath();

panelPath.AddArc(0, Consts.CaptionHeight, captionCurveRadius * 2 - 1,

captionCurveRadius * 2, 180, -90);

panelPath.AddLine(captionCurveRadius, Consts.CaptionHeight + captionCurveRadius * 2,

this.Width - captionCurveRadius, Consts.CaptionHeight + captionCurveRadius * 2);

panelPath.AddArc(this.Width - captionCurveRadius * 2 - 1, Consts.CaptionHeight,

captionCurveRadius * 2, captionCurveRadius * 2, 90, -90);

panelPath.AddLine(this.Width - 1, Consts.CaptionHeight + captionCurveRadius, this.Width - 1,

this.Height - captionCurveRadius);

panelPath.AddArc(this.Width - captionCurveRadius * 2 - 1,

this.Height - captionCurveRadius * 2 - 1,captionCurveRadius * 2, captionCurveRadius * 2, 0, 90);

panelPath.AddLine(this.Width - captionCurveRadius, this.Height - 1,

captionCurveRadius, this.Height - 1);

panelPath.AddArc(0, this.Height - captionCurveRadius * 2 - 1, captionCurveRadius * 2,

captionCurveRadius * 2, 90, 90);

panelPath.AddLine(0, this.Height - captionCurveRadius - 1, 0, captionCurveRadius - 1);

e.Graphics.DrawPath(myPen, panelPath);

About me

I am student in Islamic azad university Najafabad branch of Iran.

Thanks to Afshin (my brother) for translating the article.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Ehsan Golkar



Iran (Islamic Republic Of) Iran (Islamic Republic Of)

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralCan't open Demo.ZIP Pinmembertim_mcgwyn10:42 29 Mar '07  
AnswerRe: Can't open Demo.ZIP [modified] PinmemberEhsan Golkar23:18 29 Mar '07  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 29 Mar 2007
Article Copyright 2007 by Ehsan Golkar
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid