示例#1
0
        /// <summary>
        /// Default constructor for the window.  The window is located at 0,0 with
        /// a size of 640,480
        /// </summary>
		public KeyboardTestWindow()
			: base("KeyboardTestWindow",10,10,640,480)
		{
            PrintKeyboards();
            PrintMice();

            fFont = new GDIFont("Courier", 12);

			TextStr0 = "00000000 00000000 00000000 00000000 <-- KeyData\n-------- -------- -----------------\n|||    |     |            |        \n|||    |     |            |____ repeat count\n|||    |     |_________________ OEM code\n|||    |_______________ extended key flag\n|||____________________ context code\n||_____________________ previous key state\n|______________________ transition state";
			BuffStr0 = TextStr0.ToCharArray(0,TextStr0.Length);

			TextStr1 = "-------- -------- 00000000 00000000 <-- wParam\n";
			BuffStr1 = TextStr1.ToCharArray(0,TextStr1.Length);

			TextStr2 = "CHARACTER TYPED:   ";
			BuffStr2 = TextStr2.ToCharArray(0,TextStr2.Length);

			TextStr3 = "Backspace key:   ";
			BuffStr3 = TextStr3.ToCharArray(0,TextStr3.Length);
			
			TextStr4 = "Shift state:      ";
			BuffStr4 = TextStr4.ToCharArray(0,TextStr4.Length);

			StrON = "ON ";
			StrOFF = "OFF";

			fCharTypedLabel = new StringLabel("Character Typed", "Courier", 30, 0, 0);
            AddGraphic(fCharTypedLabel);
			
            fBackspaceLabel = new StringLabel("Backspace Key", "Courier", 30, 10, 17 * 17);
            AddGraphic(fBackspaceLabel);
			
            fShiftLabel = new StringLabel("Shift State", "Courier", 30, 0, 0);
			
			// Cell Layout thing
            //Rectangle frame = new Rectangle(0, 0, 400, 60);
            //GraphicGroup cellGroup = new GraphicGroup("cellGroup", frame);
            //cellGroup.LayoutHandler = new GraphicCell(Position.Right, 4); 
            //cellGroup.AddGraphic(fCharTypedLabel, null);

			// Binary layout thing
            //GraphicGroup binaryGroup = new GraphicGroup("binaryGroup", frame);
            //binaryGroup.LayoutHandler = new BinaryLayout(Position.BottomRight, 4); 
            //binaryGroup.AddGraphic(cellGroup, null);
            //binaryGroup.AddGraphic(fShiftLabel, null);

			
            //AddGraphic(binaryGroup, null);
            
            
            //BackgroundColor = RGBColor.LtGray;
		}
示例#2
0
        void CreateComponents()
        {
            rootGroup = new GraphicGroup("root");
            rootGroup.Debug = true;
            AddGraphic(rootGroup);

            // Use a layout handler so all our graphics line up vertically
            rootGroup.LayoutHandler = new LinearLayout(rootGroup, 4, 4, Orientation.Vertical);

            StringLabel lookLabel = new StringLabel("Look Here:", 0, 0);

            StringLabel boxLabel = new StringLabel("Box", 0, 0);

            Caption cap = new Caption(lookLabel, boxLabel, Position.Right, 4);
            rootGroup.AddGraphic(cap, null);


        //    Switch aSwitch = new Switch("switch1", 100, 200, 100, 20, "Big Switch");
        //    aSwitch.Debug = true;
        //    rootGroup.AddGraphic(aSwitch);

            GraphicGroup controlGroup = new GraphicGroup("controlGroup", 10, 300, 400, 20);
            controlGroup.LayoutHandler = new LinearLayout(controlGroup, 4, 0, Orientation.Vertical);

            GraphicGroup layout1 = new GraphicGroup("layout1", 0, 0, 400, 40);
            layout1.LayoutHandler = new LinearLayout(layout1, 2, 0, Orientation.Horizontal);

            PushButton button1 = new PushButton("Pushy1", 0, 0, 100, 24, new StringLabel("Button1", 0, 0));
            button1.MouseUpEvent += new MouseEventHandler(this.ButtonActivity);
            layout1.AddGraphic(button1);

            PushButton button2 = new PushButton("Play", 104, 0, 100, 24, new StringLabel("Button2", 0, 0));
            button2.MouseDownEvent += new MouseEventHandler(this.PlayActivity);
            layout1.AddGraphic(button2);


            TrackSlider slider = new TrackSlider("slider",
                new GrayTrack("track", 0, 0, 200, 20),
                new GrayBox("box", 0, 0, 20, 16),
                Orientation.Horizontal,
                0, 255, 255);
            slider.PositionChangedEvent += new EventHandler(slider_PositionChangedEvent);

            controlGroup.AddGraphic(slider);
            controlGroup.AddGraphic(layout1);

            rootGroup.AddGraphic(controlGroup);

        }