|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
IntroductionThis is a simple viewer application which allows you to apply basic operation on images such as Rotate, Flip,
ROI (Region of interest) zoom and Panning. It offers a sample example for the powerful Using the codeThe interesting code is based on the To add a public LimfWnd()
{
this.ClientSize = new System.Drawing.Size(464, 344);
this.m_DisplayPort = new DisplayPort();
InitializeComponent();
this.m_DisplayPort.MouseDown += new MouseEventHandler(LimfWnd_MouseDown);
...
Then add the controls to the form: private void InitializeComponent()
{
//
// LimfWnd
//
this.AllowDrop = true;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.SystemColors.WindowText;
this.ClientSize = new System.Drawing.Size(SystemInformation.WorkingArea.Width/2,
SystemInformation.WorkingArea.Height/2);
this.Controls.AddRange(new System.Windows.Forms.Control[] {this.m_DisplayPort,
this.splitter1});
...
Add image to the private void LoadImage(object sender, System.EventArgs e)
{
FileDialog Boite = new OpenFileDialog();
Boite.ShowDialog();
if(Boite.FileName.Length > 0)
{
Image Img = Image.FromFile(Boite.FileName);
m_DisplayPort.SetImage(Img);
}
}
...
Chain the menu list event: private void LimfWnd_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Right)
{
CMenuActionList CommandsLst;
if(sender.GetType() == m_DisplayPort.GetType())
CommandsLst = ((DisplayPort) sender).GetCommand(null);
else
CommandsLst = new CMenuActionList();
if(CommandsLst == null)
CommandsLst = new CMenuActionList();
CommandsLst.AddMenu(1, "Quit", 1, new System.EventHandler(Quit));
Points of InterestThe main difficulty was to create the basic rotate/flip routines to manage the coordinate converter. The only limit I found regarding the use of GDI+ was the 16 bits per pixel format which is not implemented, so no use for such images. HistoryVersion 1.0 is the first release.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||