CompareModesDialog.cs :  » GUI » wx-NET » wx » SampleDisplay » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » GUI » wx NET 
wx NET » wx » SampleDisplay » CompareModesDialog.cs
//-----------------------------------------------------------------------------
// $Id: CompareModesDialog.cs,v 1.4 2007/10/21 15:30:40 harald_meyer Exp $
// Michael S. Muegel mike _at_ muegel dot org
//
// Licensed  under the Widgets license, see LICENSE.txt for details.
//-----------------------------------------------------------------------------

using System;
using System.Drawing;
using wx;

namespace wx.SampleDisplay{
  public class CompareModesDialog : Dialog
  {
    public CompareModesDialog( Window parent, int id, Display display )
      : base( parent, id , "VideoMode Euqlity/Match Results", 
      wxDefaultPosition, wxDefaultSize, 
      wxDEFAULT_DIALOG_STYLE | wxMAXIMIZE_BOX | wxRESIZE_BORDER)
    {
      // Instructions
      HtmlWindow html_instr = new HtmlWindow(this);
      // Force HTML font sizes to be same on all platforms
      html_instr.SetFonts("", "", new int[] { 7, 8, 10, 12, 16, 22, 30 });
      html_instr.SetPage("Testing current display's video modes for equality and \"match\" (non-zero fields are equal except for refresh, which is allowed to have a greater value).");
      html_instr.SetSizeHints(-1,75);

      // Test results
      ListCtrl list_results = new ListCtrl( this, -1, 
        wxDefaultPosition, wxDefaultSize, ListCtrl.wxLC_REPORT|wxSUNKEN_BORDER );
      list_results.InsertColumn(0, "Mode1");
      list_results.InsertColumn(1, "Mode2");
      list_results.InsertColumn(2, "Mode1 == Mode2");
      list_results.InsertColumn(3, "Mode1.Matches(Mode2)");
      VideoMode[] modes = display.GetModes();
      Array.Sort(modes);
      int row = 0;
      for (int m1 = 0; m1 < modes.Length; m1++)
      {
        for (int m2 = 0; m2 < modes.Length; m2++)
        {
          // The ListCtrl API is ugly IMHO in wxLC_REPORT mode. Should
          // have seperate InsertRow() method and then use SetItem
          // for each cell vs. InsertItem() does both for the 0 column.
          list_results.InsertItem(row, modes[m1].ToString());
          list_results.SetItem(row, 1, modes[m2].ToString());
          list_results.SetItem(row, 2, (modes[m1] == modes[m2]).ToString());
          list_results.SetItem(row, 3, modes[m1].Matches(modes[m2]).ToString());
          ++row;
        }
      }

      // Ensure ListCtrl is as wide as it's data
      int width = 0;
      for (int col = 0; col <= 3; col++)
      {
        int sizing_mode = (col <= 1) ? ListCtrl.wxLIST_AUTOSIZE :
          ListCtrl.wxLIST_AUTOSIZE_USEHEADER;
        list_results.SetColumnWidth(col, sizing_mode);
        width += list_results.GetColumnWidth(col);
      }
      list_results.SetSizeHints(width + 25, 400);

      // OK button (built-in handler for wxID_OK will be invoked when 
      // button is clicked
      Button btn_ok = new Button( this, wxID_OK, "OK" );

      BoxSizer sizer = new BoxSizer( Orientation.wxVERTICAL );
      sizer.Add( html_instr, 0, Stretch.wxEXPAND|Direction.wxALL, 5 );
      sizer.Add( list_results, 1, Stretch.wxEXPAND|Direction.wxALL, 5 );
      sizer.Add( btn_ok, 0, Alignment.wxALIGN_CENTER_HORIZONTAL|Direction.wxALL, 5 );

      sizer.Fit(this);
      AutoLayout = true;
      SetSizer( sizer );
    }

  }
 
} // namespace
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.