コード例 #1
0
        public TransferNotiForm(string ani, string name)
        {
            InitializeComponent();
            label_customer_color = label_Customer.ForeColor;
            label_from_color = label_from.ForeColor;
            backcolor = this.BackColor;

            pbx_icon.Image = global::Client.Properties.Resources.phone_black;
            pbx_close.Visible = true;

            pbx_close.MouseClick += new MouseEventHandler(OnMouseClickToClose);

            MouseClick += new MouseEventHandler(OnMouseClickToShowCustomerPopUp);
            pbx_icon.MouseClick += new MouseEventHandler(OnMouseClickToShowCustomerPopUp);
            label_from.MouseClick += new MouseEventHandler(OnMouseClickToShowCustomerPopUp);
            label_Customer.MouseClick += new MouseEventHandler(OnMouseClickToShowCustomerPopUp);

            this.ani = ani;

            if (name.Length > 1)
            {
                label_Customer.Text = name + "(" + ani + ")";
            }
            else
            {
                label_Customer.Text = ani;
            }
            label_from.Text = "시간 : " + DateTime.Now.ToShortTimeString();
        }
コード例 #2
0
ファイル: Command.cs プロジェクト: abordt/Viking
        public Command(Viking.UI.Controls.SectionViewerControl parent)
        {
            this.Parent = parent;

            MyMouseClick = new MouseEventHandler(this.OnMouseClick);
            MyMouseDoubleClick = new MouseEventHandler(this.OnMouseDoubleClick);
            MyMouseDown = new MouseEventHandler(this.OnMouseDown);
            MyMouseUp = new MouseEventHandler(this.OnMouseUp);
            MyMouseWheel = new MouseEventHandler(this.OnMouseWheel);
            MyMouseMove = new MouseEventHandler(this.OnMouseMove);

            MyMouseHover = new EventHandler(this.OnMouseHover);
            MyMouseLeave = new EventHandler(this.OnMouseLeave);
            MyMouseEnter = new EventHandler(this.OnMouseEnter);

            MyKeyPress  = new KeyPressEventHandler(this.OnKeyPress);

            MyKeyDown = new KeyEventHandler(this.OnKeyDown);

            Parent.MouseClick += MyMouseClick;
            Parent.MouseDoubleClick += MyMouseDoubleClick;
            Parent.MouseDown += MyMouseDown;
            Parent.MouseUp += MyMouseUp;
            Parent.MouseWheel += MyMouseWheel;
            Parent.MouseMove += MyMouseMove;
            Parent.MouseHover += MyMouseHover;
            Parent.MouseLeave += MyMouseLeave;
            Parent.MouseEnter += MyMouseEnter;
            Parent.KeyPress += MyKeyPress;
            Parent.KeyDown += MyKeyDown;
        }
コード例 #3
0
        private void AddCardDiscardPile(MouseEventArgs e, Panel sourcePanel, DiscardPile discardPile, ref Point lastLocation, MouseEventHandler methodToHandle)
        {
            if (e.Button == MouseButtons.Left)
            {
            if (wPile.getCount() > 0)
            {
                Card card = wPile.getLastCardInPile();
                discardPile.AddToPile(card);
                if (discardPile.getCount() == 1)
                    sourcePanel.BackgroundImage = card.getCardImage();
                else
                {
                    Panel p = new Panel();
                    p.BackgroundImage = card.getCardImage();
                    p.Height = sourcePanel.Height;
                    p.Width = sourcePanel.Width;
                    lastLocation.Offset(0, 20);
                    p.Location = lastLocation;
                    lastLocation = p.Location;
                    p.MouseDown += new System.Windows.Forms.MouseEventHandler(methodToHandle);
                    this.Controls.Add(p);
                    p.BringToFront();
                }

                //Remove card from the waste pile
                wPile.removeCard(card);
                wastePilePicture.BackgroundImage = null;
            }
            }
        }
コード例 #4
0
 //public bool Moving { get { return isMoving; } }
 /// <summary>
 /// Creates an instance of MovableChartLabelPoint
 /// </summary>
 public MovableChartLabelPoint()
 {
     IsMovable = false;
       MouseLeftButtonDown += new MouseButtonEventHandler(MovableChartLabelPoint_MouseLeftButtonDown);
       MouseLeftButtonUp += new MouseButtonEventHandler(MovableChartLabelPoint_MouseLeftButtonUp);
       MouseMove += new MouseEventHandler(MovableChartLabelPoint_MouseMove);
 }
コード例 #5
0
ファイル: CellAverageResultForm.cs プロジェクト: xiaoyj/Space
 public void GenerateAveResultTabPage(MouseEventHandler MouseDoubleClickHandle)
 {
     //TabPage tp = new TabPage(tpName);
     //TabControl tc = new TabControl();
     //tp.Controls.Add(tc);
     //tc.Dock = DockStyle.Fill;
    // DataSet ds = new DataSet();
     foreach (KeyValuePair<string, DataTable> rel in m_result)
     {
         TabPage subTabPage = new TabPage(rel.Key);
         //ds.Tables.Add(m_gsmDataTabel["CellAverageResult"]);
         DataGridView dgv = new DataGridView();
         dgv.ReadOnly = true;
         dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
         dgv.DataSource = m_result[rel.Key];
         dgv.Dock = DockStyle.Fill;
         //dgv.DataMember = "CellAverageResult";
         subTabPage.Text = rel.Key;
         subTabPage.Controls.Add(dgv);
         tcAveResults.Controls.Add(subTabPage);
         //tc.Controls.Add(subTabPage);
         //return tp;
     }
     
     
     
 }
コード例 #6
0
ファイル: TextBox.cs プロジェクト: Profit0004/mono
		public TextBox() {

			scrollbars = RichTextBoxScrollBars.None;
			alignment = HorizontalAlignment.Left;
			this.LostFocus +=new EventHandler(TextBox_LostFocus);
			this.RightToLeftChanged += new EventHandler (TextBox_RightToLeftChanged);
			MouseWheel += new MouseEventHandler (TextBox_MouseWheel);

			BackColor = ThemeEngine.Current.ColorControl;
			ForeColor = ThemeEngine.Current.ColorControlText;
			backcolor_set = false;

			SetStyle (ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false);
			SetStyle (ControlStyles.FixedHeight, true);

			undo = new MenuItem(Locale.GetText("&Undo"));
			cut = new MenuItem(Locale.GetText("Cu&t"));
			copy = new MenuItem(Locale.GetText("&Copy"));
			paste = new MenuItem(Locale.GetText("&Paste"));
			delete = new MenuItem(Locale.GetText("&Delete"));
			select_all = new MenuItem(Locale.GetText("Select &All"));

			menu = new ContextMenu(new MenuItem[] { undo, new MenuItem("-"), cut, copy, paste, delete, new MenuItem("-"), select_all});
			ContextMenu = menu;

			menu.Popup += new EventHandler(menu_Popup);
			undo.Click += new EventHandler(undo_Click);
			cut.Click += new EventHandler(cut_Click);
			copy.Click += new EventHandler(copy_Click);
			paste.Click += new EventHandler(paste_Click);
			delete.Click += new EventHandler(delete_Click);
			select_all.Click += new EventHandler(select_all_Click);

			document.multiline = false;
		}
コード例 #7
0
        public FractalView()
        {
            fractalImageCacheInvalidated = true;

            MouseClick += new MouseEventHandler(GAPictureBox_Click);
            Paint += new PaintEventHandler(GAPanel_Paint);
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: JeremiahZhang/AKA
        /// <summary> The Constructor for our application</summary>
        MyForm()
        {
            //Initial settings for our Form window
            Size = new Size(400, 300);
            Text = " Collision on Either Side";
            BackColor = Color.Black;
            CenterToScreen();

            /// <remarks>Turn on double-buffering to eliminate flickering </remarks>
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);

            /// <remarks>Create Paint Event Handler:
            /// fired every time Windows says it's time to repaint the Form. </remarks>
            Paint += new PaintEventHandler(DrawStuff);

            /// <remarks>Creates a new mouse movement event handler </remarks>
            MouseMove += new MouseEventHandler(MouseMoveUpdate);

            ZoneLeft = ZoneX - (ZoneWidth / 2); // The left side is half the Width to the left of Center
            ZoneRight = ZoneX + (ZoneWidth / 2); // Half the Width to the right
            ZoneTop = ZoneY - (ZoneHeight / 2); // obviously this must turn seaweed into fertilizer
            ZoneBottom = ZoneY + (ZoneHeight / 2);
        }
コード例 #9
0
ファイル: MAIN.CS プロジェクト: ppatoria/SoftwareDevelopment
 public MainForm()
 {
     InitializeComponent();
     MouseEventHandler wheelHandler = null;
     wheelHandler = new MouseEventHandler(listBox_MouseWheel);
     eventListBox.MouseWheel += wheelHandler;
 }
コード例 #10
0
ファイル: ImageButton.cs プロジェクト: RoelofSol/DeOps
 public ImageButton()
 {
     MouseMove  += new MouseEventHandler(ImageButton_MouseMove);
     MouseDown  += new MouseEventHandler(ImageButton_MouseDown);
     MouseLeave += new EventHandler(ImageButton_MouseLeave);
     MouseUp    += new MouseEventHandler(ImageButton_MouseUp);
 }
コード例 #11
0
ファイル: CodeEditor.AutoC.cs プロジェクト: h3tch/ProtoFX
 public void InitializeAutoC()
 {
     // auto completion settings
     AutoCSeparator = '|';
     AutoCMaxHeight = 9;
     MouseMove += new MouseEventHandler(HandleMouseMove);
 }
コード例 #12
0
 /// <summary>
 /// 开始鼠标捕捉
 /// </summary>
 /// <param name="element"></param>
 /// <param name="mouseMoveHandler"></param>
 /// <param name="mouseUpHandler"></param>
 public static void StartCapture(this FrameworkElement element, MouseEventHandler mouseMoveHandler, 
     MouseButtonEventHandler mouseUpHandler)
 {
     element.MouseMove += mouseMoveHandler;
     element.MouseUp += mouseUpHandler;
     element.CaptureMouse();
 }
コード例 #13
0
        public TriangleRegion(Image backgroundImage = null)
            : base(backgroundImage)
        {
            Angle = TriangleAngle.Top;

            MouseWheel += new MouseEventHandler(TriangleRegion_MouseWheel);
        }
コード例 #14
0
        public PolygonRegion(Image backgroundImage = null)
            : base(backgroundImage)
        {
            nodes = new List<NodeObject>();

            MouseDown += new MouseEventHandler(PolygonRegionSurface_MouseDown);
        }
コード例 #15
0
		private void InitializeForm()
		{
			var mouseDoubleClick = new MouseEventHandler((sender, args) => { Process.Start((sender as TextBox).Text); });
			this.txtSourceRootDir.MouseDoubleClick += mouseDoubleClick;
			this.txtSourceRootDir2.MouseDoubleClick += mouseDoubleClick;
			this.txtSourceRootDir3.MouseDoubleClick += mouseDoubleClick;

			// Attach handler
			ProcessBehavior.PrintLog += AddLog;
			DbBehavior.PrintLog += AddLog;

			// set  the command line args.
			var commandLineArgs = Environment.GetCommandLineArgs();

			if (commandLineArgs.Count() == 3)
			{
				if (commandLineArgs[1].ToUpper() == "QA")
				{
					tabControl1.SelectedIndex = 1;
					this.txtSourceRootDir.Text = commandLineArgs[2];
				}
			}

			// QA 탭 감춤.
			tabControl1.SelectedTab.Visible = false;

			cboLanguage.SelectedIndex = 1;
			cbxClientCount.SelectedIndex = 0;
			cbxEnvironment.SelectedIndex = 0;

			//if (Screen.AllScreens.Length > 1)
			//{
			//	this.Location = new Point(Screen.AllScreens[1].WorkingArea.X, Screen.AllScreens[1].WorkingArea.Height - this.Height);
			//}
		}
コード例 #16
0
        Dictionary<string, int> heldValues = new Dictionary<string, int>(); // Used to store a dictionary of held values which can be used by developers to attatch values to this DragPictureBox

        #endregion Fields

        #region Constructors

        // When a new instance of a DragPictureBox is created
        public DragPictureBox()
        {
            InitializeComponent(); // Initialize this DragPictureBox component
            followMouse.Tick += new EventHandler(followMouse_Tick); // Add the listener to the followMouse timer so that when it ticks it calls the followMouse_Tick method
            followMouse.Interval = 10; // Set the interval of the followMouse timer to 10 milliseconds
            MouseDown += new MouseEventHandler(MouseClicked); // Add a MouseDown listener to this DragPictureBox to call MouseClicked when the user clicks it.
        }
コード例 #17
0
        public VoiceToolstripButton(VoiceService voices)
        {
            Voices = voices;

            ToolTipText = "Voice Chat";

            Paint += new PaintEventHandler(VoiceToolstripButton_Paint);

            ButtonClick += new EventHandler(VoiceToolstripButton_ButtonClick);
            MouseDown += new MouseEventHandler(VoiceToolstripButton_MouseDown);
            MouseUp += new MouseEventHandler(VoiceToolstripButton_MouseUp);
            OffButton = new ToolStripMenuItem("Off", Res.VoiceRes.VoiceOff, OffButton_Clicked);
            VoiceActivatedButton = new ToolStripMenuItem("Voice Activated", Res.VoiceRes.VoiceVAD, VoiceActivatedButton_Clicked);
            PushtoTalkButton = new ToolStripMenuItem("Push to Talk", Res.VoiceRes.VoicePTT, PushtoTalkButton_Clicked);
            MuteButton = new ToolStripMenuItem("Mute", Res.VoiceRes.VoiceMute, MuteButton_Clicked);
            SettingsButton = new ToolStripMenuItem("Settings", Res.VoiceRes.VoiceSettings, SettingsButton_Clicked);

            DropDownItems.Add(OffButton);
            DropDownItems.Add(VoiceActivatedButton);
            DropDownItems.Add(PushtoTalkButton);
            DropDownItems.Add(MuteButton);
            DropDownItems.Add(SettingsButton);

            WindowID = Voices.Core.RndGen.Next();

            Voices.RegisterWindow(WindowID, new VolumeUpdateHandler(VoiceService_VolumeUpdate));

            OffButton.PerformClick();
        }
コード例 #18
0
ファイル: DraggablePushpin.cs プロジェクト: valeriob/Routing
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            var parentLayer = Parent as MapLayer;
            if (parentLayer != null)
            {
                var parentMap = parentLayer.ParentMap;
                if (parentMap != null)
                {
                    if (this.ParentMapMousePanHandler == null)
                    {
                        ParentMapMousePanHandler = new EventHandler<MapMouseDragEventArgs>(ParentMap_MousePan);
                        parentMap.MousePan += ParentMapMousePanHandler;
                    }
                    if (ParentMapMouseLeftButtonUpHandler == null)
                    {
                        ParentMapMouseLeftButtonUpHandler = new MouseButtonEventHandler(ParentMap_MouseLeftButtonUp);
                        parentMap.MouseLeftButtonUp += ParentMapMouseLeftButtonUpHandler;
                    }
                    if (ParentMapMouseMoveHandler == null)
                    {
                        ParentMapMouseMoveHandler = new MouseEventHandler(ParentMap_MouseMove);
                        parentMap.MouseMove += ParentMapMouseMoveHandler;
                    }
                }
            }

            IsDragging = true;

            base.OnMouseLeftButtonDown(e);
        }
コード例 #19
0
ファイル: swf-statusbar.cs プロジェクト: hitswa/winforms
		public Test1 ()
		{
			Button btn = new Button ();
			btn.Text = "Click Me";
			btn.Click += new EventHandler (button_clicked);

			Controls.Add (btn);
			StatusBar sb1;
			sb1 = new StatusBar ();
			sb1.Width = 300;
			sb1.ShowPanels = true;
			Controls.Add (sb1);

			StatusBarPanel p = new StatusBarPanel ();
			p.AutoSize = StatusBarPanelAutoSize.Spring;
			p.Text = "Clicks: 0";
			sb1.Panels.Add (p);
			clicks_panel = p;

			StatusBarPanel p2 = new StatusBarPanel ();
			p2.AutoSize = StatusBarPanelAutoSize.Contents;
			p2.Text = "i am an apeman";
			sb1.Panels.Add (p2);

			StatusBarPanel p3 = new StatusBarPanel ();
			p3.Alignment = HorizontalAlignment.Right;
			p3.AutoSize = StatusBarPanelAutoSize.Spring;
			p3.Text = "test";
			sb1.Panels.Add (p3);
			mouse_panel = p3;

			MouseMove += new MouseEventHandler (mouse_moved);
		}
コード例 #20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MLifterTextBox"/> class.
        /// </summary>
        /// <remarks>Documented by Dev05, 2007-09-19</remarks>
        public MLifterTextBox()
        {
            AllowAnswerSubmit = true;
            BorderStyle = BorderStyle.None;
            Font = new System.Drawing.Font("MS Sans Serif", 14, System.Drawing.FontStyle.Bold);
            SelectionAlignment = HorizontalAlignment.Center;

            //ScrollBars = RichTextBoxScrollBars.ForcedVertical;

            AllowDrop = true;
            DragEnter += new DragEventHandler(MLifterTextBox_DragEnter);
            DragDrop += new DragEventHandler(MLifterTextBox_DragDrop);
            MouseDown += new MouseEventHandler(MLifterTextBox_MouseDown);
            Leave += new EventHandler(MLifterTextBox_Leave);
            ContentsResized += new ContentsResizedEventHandler(MLifterTextBox_ContentsResized);

            caseSensitive = false;
            correctOnTheFly = false;

            StripChars.Add("\n\r");
            StripChars.Add("\r\n");
            StripChars.Add("\n");
            //StripChars.Add(",");

            allowedControlChars.Clear();
            allowedControlChars.Add((char)Keys.Enter);
            allowedControlChars.Add((char)Keys.Back);
            allowedControlChars.Add((char)Keys.Space);
            allowedControlChars.Add((char)Keys.LineFeed);

            IgnoreChars = ".!?;,";
        }
コード例 #21
0
ファイル: CodeEditor.Events.cs プロジェクト: h3tch/ProtoFX
        /// <summary>
        /// Initialize class events.
        /// </summary>
        private void InitializeEvents()
        {
            TextChanged += new EventHandler(HandleTextChanged);
            UpdateUI += new EventHandler<UpdateUIEventArgs>(HandleUpdateUI);

            // enable drag & drop
            AllowDrop = true;
            DragOver += new DragEventHandler(HandleDragOver);
            DragDrop += new DragEventHandler(HandleDragDrop);

            // search & replace
            KeyUp += new KeyEventHandler(HandleKeyUp);
            KeyDown += new KeyEventHandler(HandleKeyDown);
            InsertCheck += new EventHandler<InsertCheckEventArgs>(HandleInsertCheck);
            CharAdded += new EventHandler<CharAddedEventArgs>(HandleCharAdded);
            
            MouseWheel += new MouseEventHandler(HandleMouseWheel);
            Painted += new EventHandler<EventArgs>(HandlePainted);

            // create default pens
            grayPen = new Pen(Brushes.Gray);
            dashedPen = new Pen(Brushes.LightGray);
            dashedPen.DashPattern = new[] { 3f, 6f };

            // measure default line size
            lineSize = TextRenderer.MeasureText(new string('/', NewLineHelper), Font);
        }
コード例 #22
0
        public Surface(Image backgroundImage = null)
        {
            ScreenRectangle = CaptureHelpers.GetScreenBounds();
            ScreenRectangle0Based = CaptureHelpers.FixScreenCoordinates(ScreenRectangle);

            InitializeComponent();

            SurfaceImage = backgroundImage;
            Prepare();

            DrawableObjects = new List<DrawableObject>();
            Config = new SurfaceOptions();
            timer = new Stopwatch();

            borderPen = new Pen(Color.DarkBlue);
            borderDotPen = new Pen(Color.Black, 1);
            borderDotPen.DashPattern = new float[] { 5, 5 };
            borderDotPen2 = new Pen(Color.White, 1);
            borderDotPen2.DashPattern = new float[] { 5, 5 };
            borderDotPen2.DashOffset = 5;
            shadowBrush = new SolidBrush(Color.FromArgb(75, Color.Black));
            lightBrush = new SolidBrush(Color.FromArgb(10, Color.Black));
            nodeBackgroundBrush = new SolidBrush(Color.White);
            textFont = new Font("Arial", 12, FontStyle.Bold);

            Shown += new EventHandler(Surface_Shown);
            KeyUp += new KeyEventHandler(Surface_KeyUp);
            MouseDoubleClick += new MouseEventHandler(Surface_MouseDoubleClick);
        }
コード例 #23
0
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            //因为图钉是添加在MapLayer上的
            var parentLayer = this.Parent as MapLayer;
            if (parentLayer != null)
            {
                //MapLayer是Map的一个子对象
                var parentMap = parentLayer.ParentMap;
                if (parentMap != null)
                {
                    if (this.MapMouseDragHandler == null)
                    {
                        this.MapMouseDragHandler = new EventHandler<MapMouseDragEventArgs>(ParnetMap_MousePan);
                        parentMap.MousePan += this.MapMouseDragHandler;
                    }

                    if (this.MapMouseLeftButtonUpHandler == null)
                    {
                        this.MapMouseLeftButtonUpHandler = new MouseButtonEventHandler(PrentMap_MouseLeftButtonUp);
                        parentMap.MouseLeftButtonUp += this.MapMouseLeftButtonUpHandler;
                    }

                    if (this.MapMouseMoveHandler == null)
                    {
                        this.MapMouseMoveHandler = new MouseEventHandler(PrentMap_MouseMove);
                        parentMap.MouseMove += this.MapMouseMoveHandler;
                    }
                }
            }
            this.IsDragging = true;

            base.OnMouseLeftButtonDown(e);
        }
コード例 #24
0
		public SharpDevelopSideBar()
		{
			SideTabItemFactory = new SharpDevelopSideTabItemFactory();
			
			MouseUp                     += new MouseEventHandler(SetContextMenu);
			sideTabContent.MouseUp += new MouseEventHandler(SetItemContextMenu);
		}
コード例 #25
0
        public ImagePreview(Control parent, MouseEventHandler parentmouse, MouseEventHandler parentclick, MouseEventHandler parentdoubleclick, InternetImage img)
        {
            InitializeComponent();
            m_random = new Random().Next(256);

            //this.BackColor = System.Drawing.Color.Black;
            //this.Location = new System.Drawing.Point(positionx*(128+8)+4, positiony*(128+16+4+8)+4);
            //this.Bounds = new Rectangle(new System.Drawing.Point(positionx * (128 + 8) + 4, positiony * (128 + 16 + 4 + 8) + 4), Size);
            this.MouseMove += new MouseEventHandler(parentmouse);
            this.MouseClick += new MouseEventHandler(parentclick);
            this.MouseDoubleClick += new MouseEventHandler(parentdoubleclick);
            this.MouseOverPanel.MouseMove += new System.Windows.Forms.MouseEventHandler(parentmouse);
            this.ImagePanel.MouseMove += new System.Windows.Forms.MouseEventHandler(parentmouse);
            this.ImagePanel.MouseClick += new MouseEventHandler(parentclick);
            this.ImagePanel.MouseDoubleClick += new MouseEventHandler(parentdoubleclick);
            this.Description.MouseClick +=new MouseEventHandler(parentclick);
            this.Description.MouseDoubleClick += new MouseEventHandler(parentdoubleclick);
            this.Description2.MouseClick += new MouseEventHandler(parentclick);
            this.Description2.MouseDoubleClick += new MouseEventHandler(parentdoubleclick);
            this.SaveFile.Click += new EventHandler(SaveFile_Click);
            this.DoubleBuffered = true;

            Image = img;
            Selected = false;
            
            parent.Controls.Add(this);
        }
コード例 #26
0
ファイル: MainForm.cs プロジェクト: dsrbecky/Fractals
 public MainForm()
 {
     InitializeComponent();
     CurrentFractalSingleton.CurrentFractalChanged += delegate{ RestartRenderLoop(); };
     MouseWheel += new MouseEventHandler (picture_MouseWheel);
     ClientSize = new Size(512,512);
 }
コード例 #27
0
ファイル: FormMove.cs プロジェクト: nibomed/Emoticoner
 public FormMoveHook(Form target)
 {
     form = target;
     mouseDownHandler = new MouseEventHandler(MouseDownHandler);
     mouseUpHandler = new MouseEventHandler(MouseUpHandler);
     mouseMoveHandler = new MouseEventHandler(MouseMovHandlere);
 }
コード例 #28
0
 public ColorButton()
 {
     MouseEnter += new EventHandler(OnMouseEnter);
     MouseLeave += new EventHandler(OnMouseLeave);
     MouseUp += new MouseEventHandler(OnMouseUp);
     Paint += new PaintEventHandler(ButtonPaint);
 }
コード例 #29
0
		private void Init()
		{
			InitializeComponent();

			MouseUp += new MouseEventHandler(OnMouseUp);
			KeyUp += new KeyEventHandler(OnKeyUp);
		}
コード例 #30
0
 private void AreaCliente_Load(object sender, EventArgs e)
 {
     MouseDown += new MouseEventHandler(AreaCliente_MouseDown);
     MouseMove += new MouseEventHandler(AreaCliente_MouseMove);
 }
コード例 #31
0
 public WidgetBase()
 {
     MouseDown += new MouseEventHandler(Form1_MouseDown);
     MouseMove += new MouseEventHandler(Form1_MouseMove);
 }
コード例 #32
0
        private static void IsPinnableChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (!(bool)e.NewValue || !(d is Expander))
            {
                return;
            }

            var expander = (Expander)d;

            RoutedEventHandler onChecked = (_o, __o) =>
            {
                expander.IsExpanded = true;
                expander.SetValue(PinnableExpander.IsPinnedProperty, true);
            };

            RoutedEventHandler onUnchecked = (_o, __o) =>
            {
                expander.IsExpanded = false;
                expander.SetValue(PinnableExpander.IsPinnedProperty, false);
            };

            MouseEventHandler onMouseEnter = (_o, __o) =>
            {
                if (!expander.IsExpanded)
                {
                    expander.IsExpanded = true;
                }
            };

            //MouseEventHandler onMouseLeave = (_o, __o) =>
            //{
            //    if (!GetIsPinned(expander) && expander.IsExpanded)
            //    {
            //        expander.IsExpanded = false;
            //    }
            //};

            ToggleButton pinButton = null;
            Rectangle    headerBkg = null;

            expander.Loaded += (_, __) =>
            {
                pinButton = expander.ChildrenOfType <ToggleButton>().FirstOrDefault(el => el.Name == "PinButton_PART");
                if (pinButton != null)
                {
                    pinButton.Checked   += onChecked;
                    pinButton.Unchecked += onUnchecked;
                }

                headerBkg = expander.ChildrenOfType <Rectangle>().FirstOrDefault(el => el.Name == "HeaderBkg_PART");
                if (headerBkg != null)
                {
                    headerBkg.MouseEnter += onMouseEnter;
                }

                //Support for closing expander on Mouse leave
                //expander.MouseLeave += onMouseLeave;
            };

            expander.Unloaded += (_, __) =>
            {
                if (pinButton != null)
                {
                    pinButton.Checked   -= onChecked;
                    pinButton.Unchecked -= onUnchecked;
                }

                if (headerBkg != null)
                {
                    headerBkg.MouseEnter -= onMouseEnter;
                }

                //Support for closing expander on Mouse leave
                //expander.MouseLeave -= onMouseLeave;
            };
        }
コード例 #33
0
        private void SetupControls()
        {
            UIPanel panel = AddUIComponent <UIPanel>();

            panel.gameObject.AddComponent <UICustomControl>();

            panel.backgroundSprite = "UnlockingPanel";
            panel.width            = width - 10;
            panel.height           = height - 75;
            panel.relativePosition = new Vector3(5, 0);

            // Max Speed
            UILabel maxSpeedLabel = panel.AddUIComponent <UILabel>();

            maxSpeedLabel.text             = "Maximum speed:";
            maxSpeedLabel.textScale        = 0.8f;
            maxSpeedLabel.relativePosition = new Vector3(15, 15);

            m_maxSpeed = UIUtils.CreateTextField(panel);
            m_maxSpeed.numericalOnly    = true;
            m_maxSpeed.width            = 75;
            m_maxSpeed.tooltip          = "Change the maximum speed of the vehicle\nPlease note that vehicles do not go beyond speed limits";
            m_maxSpeed.relativePosition = new Vector3(15, 35);

            UILabel kmh = panel.AddUIComponent <UILabel>();

            kmh.text             = "km/h";
            kmh.textScale        = 0.8f;
            kmh.relativePosition = new Vector3(95, 40);

            // Acceleration
            UILabel accelerationLabel = panel.AddUIComponent <UILabel>();

            accelerationLabel.text             = "Acceleration/Brake:";
            accelerationLabel.textScale        = 0.8f;
            accelerationLabel.relativePosition = new Vector3(160, 15);

            m_acceleration = UIUtils.CreateTextField(panel);
            m_acceleration.numericalOnly    = true;
            m_acceleration.allowFloats      = true;
            m_acceleration.width            = 60;
            m_acceleration.tooltip          = "Change the vehicle acceleration factor";
            m_acceleration.relativePosition = new Vector3(160, 35);

            // Braking
            m_braking = UIUtils.CreateTextField(panel);
            m_braking.numericalOnly    = true;
            m_braking.allowFloats      = true;
            m_braking.width            = 60;
            m_braking.tooltip          = "Change the vehicle braking factor";
            m_braking.relativePosition = new Vector3(230, 35);

            // Colors
            m_useColors                  = UIUtils.CreateCheckBox(panel);
            m_useColors.text             = "Color variations:";
            m_useColors.isChecked        = true;
            m_useColors.width            = width - 40;
            m_useColors.tooltip          = "Enable color variations\nA random color is chosen between the four following colors";
            m_useColors.relativePosition = new Vector3(15, 70);

            m_color0                      = UIUtils.CreateColorField(panel);
            m_color0.name                 = "AVO-color0";
            m_color0.popupTopmostRoot     = false;
            m_color0.relativePosition     = new Vector3(13, 95 - 2);
            m_color0_hex                  = UIUtils.CreateTextField(panel);
            m_color0_hex.maxLength        = 6;
            m_color0_hex.relativePosition = new Vector3(55, 95);

            m_color1                      = UIUtils.CreateColorField(panel);
            m_color1.name                 = "AVO-color1";
            m_color1.popupTopmostRoot     = false;
            m_color1.relativePosition     = new Vector3(13, 120 - 2);
            m_color1_hex                  = UIUtils.CreateTextField(panel);
            m_color1_hex.maxLength        = 6;
            m_color1_hex.relativePosition = new Vector3(55, 120);

            m_color2                      = UIUtils.CreateColorField(panel);
            m_color2.name                 = "AVO-color2";
            m_color2.popupTopmostRoot     = false;
            m_color2.relativePosition     = new Vector3(158, 95 - 2);
            m_color2_hex                  = UIUtils.CreateTextField(panel);
            m_color2_hex.maxLength        = 6;
            m_color2_hex.relativePosition = new Vector3(200, 95);

            m_color3                      = UIUtils.CreateColorField(panel);
            m_color3.name                 = "AVO-color3";
            m_color3.popupTopmostRoot     = false;
            m_color3.relativePosition     = new Vector3(158, 120 - 2);
            m_color3_hex                  = UIUtils.CreateTextField(panel);
            m_color3_hex.maxLength        = 6;
            m_color3_hex.relativePosition = new Vector3(200, 120);

            // Enable & BackEngine
            m_enabled                  = UIUtils.CreateCheckBox(panel);
            m_enabled.text             = "Allow this vehicle to spawn";
            m_enabled.isChecked        = true;
            m_enabled.width            = width - 40;
            m_enabled.tooltip          = "Make sure you have at least one vehicle allowed to spawn for that category";
            m_enabled.relativePosition = new Vector3(15, 155);;

            m_addBackEngine                  = UIUtils.CreateCheckBox(panel);
            m_addBackEngine.text             = "Replace last car with engine";
            m_addBackEngine.isChecked        = false;
            m_addBackEngine.width            = width - 40;
            m_addBackEngine.tooltip          = "Make the last car of this train be an engine";
            m_addBackEngine.relativePosition = new Vector3(15, 175);

            // Capacity
            UIPanel capacityPanel = panel.AddUIComponent <UIPanel>();

            capacityPanel.size             = Vector2.zero;
            capacityPanel.relativePosition = new Vector3(15, 200);

            UILabel capacityLabel = capacityPanel.AddUIComponent <UILabel>();

            capacityLabel.text             = "Capacity:";
            capacityLabel.textScale        = 0.8f;
            capacityLabel.relativePosition = Vector3.zero;

            m_capacity = UIUtils.CreateTextField(capacityPanel);
            m_capacity.numericalOnly    = true;
            m_capacity.width            = 110;
            m_capacity.tooltip          = "Change the capacity of the vehicle";
            m_capacity.relativePosition = new Vector3(0, 20);

            // Restore default
            m_restore                  = UIUtils.CreateButton(panel);
            m_restore.text             = "Restore default";
            m_restore.width            = 130;
            m_restore.tooltip          = "Restore all values to default";
            m_restore.relativePosition = new Vector3(160, 215);

            // Remove Vehicles
            m_removeLabel                  = this.AddUIComponent <UILabel>();
            m_removeLabel.text             = "Remove vehicles:";
            m_removeLabel.textScale        = 0.8f;
            m_removeLabel.relativePosition = new Vector3(10, height - 60);

            m_clearVehicles                  = UIUtils.CreateButton(this);
            m_clearVehicles.text             = "Driving";
            m_clearVehicles.width            = 90f;
            m_clearVehicles.tooltip          = "Remove all driving vehicles of that type\nHold the SHIFT key to remove all types";
            m_clearVehicles.relativePosition = new Vector3(10, height - 40);

            m_clearParked                  = UIUtils.CreateButton(this);
            m_clearParked.text             = "Parked";
            m_clearParked.width            = 90f;
            m_clearParked.tooltip          = "Remove all parked vehicles of that type\nHold the SHIFT key to remove all types";
            m_clearParked.relativePosition = new Vector3(105, height - 40);

            panel.BringToFront();

            // Event handlers
            m_maxSpeed.eventTextSubmitted     += OnMaxSpeedSubmitted;
            m_acceleration.eventTextSubmitted += OnAccelerationSubmitted;
            m_braking.eventTextSubmitted      += OnBrakingSubmitted;

            m_useColors.eventCheckChanged += OnCheckChanged;

            MouseEventHandler mousehandler = (c, p) => { if (m_initialized)
                                                         {
                                                             (parent as UIMainPanel).ChangePreviewColor((c as UIColorField).selectedColor);
                                                         }
            };

            m_color0.eventMouseEnter += mousehandler;
            m_color1.eventMouseEnter += mousehandler;
            m_color2.eventMouseEnter += mousehandler;
            m_color3.eventMouseEnter += mousehandler;

            m_color0_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color0.selectedColor);
                                                        }
            };
            m_color1_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color1.selectedColor);
                                                        }
            };
            m_color2_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color2.selectedColor);
                                                        }
            };
            m_color3_hex.eventMouseEnter += (c, p) => { if (m_initialized)
                                                        {
                                                            (parent as UIMainPanel).ChangePreviewColor(m_color3.selectedColor);
                                                        }
            };

            m_color0.eventSelectedColorChanged += OnColorChanged;
            m_color1.eventSelectedColorChanged += OnColorChanged;
            m_color2.eventSelectedColorChanged += OnColorChanged;
            m_color3.eventSelectedColorChanged += OnColorChanged;

            m_color0_hex.eventTextSubmitted += OnColorHexSubmitted;
            m_color1_hex.eventTextSubmitted += OnColorHexSubmitted;
            m_color2_hex.eventTextSubmitted += OnColorHexSubmitted;
            m_color3_hex.eventTextSubmitted += OnColorHexSubmitted;

            m_enabled.eventCheckChanged       += OnCheckChanged;
            m_addBackEngine.eventCheckChanged += OnCheckChanged;

            m_capacity.eventTextSubmitted += OnCapacitySubmitted;

            m_restore.eventClick += (c, p) =>
            {
                m_initialized = false;
                bool isEnabled = m_options.enabled;
                DefaultOptions.Restore(m_options.prefab);
                VehicleOptions.UpdateTransfertVehicles();

                VehicleOptions.prefabUpdateEngine = m_options.prefab;
                VehicleOptions.prefabUpdateUnits  = m_options.prefab;
                new EnumerableActionThread(VehicleOptions.UpdateBackEngines);
                new EnumerableActionThread(VehicleOptions.UpdateCapacityUnits);

                Show(m_options);

                if (m_options.enabled != isEnabled)
                {
                    eventEnableCheckChanged(this, m_options.enabled);
                }
            };

            m_clearVehicles.eventClick += OnClearVehicleClicked;
            m_clearParked.eventClick   += OnClearVehicleClicked;
        }
コード例 #34
0
        public frmMapEditor()
        {
            InitializeComponent();

            MouseWheel += new MouseEventHandler(frmMapEditor_MouseWheel);
        }
コード例 #35
0
ファイル: MouseController.cs プロジェクト: mind0n/hive
        protected void CheckEvent(MouseState state, ButtonState previousState, ButtonState currentState, MouseEventHandler buttonDownEventHandler, MouseEventHandler buttonUpEventHandler)
        {
            MouseEventHandler eventCallback = null;

            if (previousState == ButtonState.Released && currentState == ButtonState.Pressed && buttonDownEventHandler != null)
            {
                eventCallback = buttonDownEventHandler;
            }
            else if (previousState == ButtonState.Pressed && currentState == ButtonState.Released && buttonUpEventHandler != null)
            {
                eventCallback = buttonUpEventHandler;
            }
            else if (previousState == ButtonState.Pressed && currentState == ButtonState.Pressed && buttonDownEventHandler != null)
            {
                eventCallback = buttonDownEventHandler;
            }
            else if (previousState == ButtonState.Released && currentState == ButtonState.Released && buttonUpEventHandler != null)
            {
                eventCallback = buttonUpEventHandler;
            }
            if (eventCallback != null)
            {
                eventCallback(state);
            }
        }
コード例 #36
0
ファイル: Head.cs プロジェクト: Gabatawr/JustCSharp
 public void SubMouseClick(MouseEventHandler method)
 {
     table.MouseClick      += method;
     folderName.MouseClick += method;
 }
コード例 #37
0
 public abstract void AddOnMouseEvent(MouseEventHandler handler);
コード例 #38
0
        void SliderPanel_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            try
            {
                MouseMove -= new MouseEventHandler(SliderPanel_MouseMove);

                MouseFinal = e.GetPosition(this);
                ReleaseMouseCapture();
                if (Orientation == "Horizontal")
                {
                    if ((MouseFinal.X - MouseFirst.X) > 0)
                    {
                        if (Math.Abs(MouseFinal.X - MouseFirst.X) > 50)
                        {
                            Counter = Counter + 1;
                        }
                    }
                    else
                    {
                        if (Math.Abs(MouseFinal.X - MouseFirst.X) > 50)
                        {
                            Counter = Counter - 1;
                        }
                    }
                }
                else
                {
                    if ((MouseFinal.Y - MouseFirst.Y) > 0)
                    {
                        if (Math.Abs(MouseFinal.Y - MouseFirst.Y) > 50)
                        {
                            Counter = Counter + 1;
                        }
                    }
                    else
                    {
                        if (Math.Abs(MouseFinal.Y - MouseFirst.Y) > 50)
                        {
                            Counter = Counter - 1;
                        }
                    }
                }

                double pTo, pFrom;

                if (Orientation == "Horizontal")
                {
                    pTo   = Counter * DesiredSize.Width;
                    pFrom = (MouseFinal.X - MouseFirst.X) > 0 ? (pTo - DesiredSize.Width) + (MouseFinal.X - MouseFirst.X) : (pTo + DesiredSize.Width) + (MouseFinal.X - MouseFirst.X);

                    if (Math.Abs(MouseFinal.X - MouseFirst.X) < 50)
                    {
                        pFrom = pTo + (MouseFinal.X - MouseFirst.X);
                    }

                    if (Counter > 0)
                    {
                        //  pTo = (Counter - 1) * this.DesiredSize.Width;
                        pTo     = (Counter - 1) * (MouseFinal.X - MouseFirst.X);
                        Counter = Counter - 1;
                    }
                    else if (Counter <= Children.Count * -1)
                    {
                        // pTo = (Counter + 1) * this.DesiredSize.Width;
                        pTo     = (Counter + 1) * (MouseFirst.X - MouseFinal.X);
                        Counter = Counter + 1;
                    }
                }
                else
                {
                    pTo   = Counter * DesiredSize.Height;
                    pFrom = (MouseFinal.Y - MouseFirst.Y) > 0 ? (pTo - DesiredSize.Height) + (MouseFinal.Y - MouseFirst.Y) : (pTo + DesiredSize.Height) + (MouseFinal.Y - MouseFirst.Y);

                    if (Math.Abs(MouseFinal.Y - MouseFirst.Y) < 50)
                    {
                        pFrom = pTo + (MouseFinal.Y - MouseFirst.Y);
                    }

                    if (Counter > 0)
                    {
                        //  pTo = (Counter - 1) * this.DesiredSize.Width;
                        pTo     = (Counter - 1) * (MouseFinal.Y - MouseFirst.Y);
                        Counter = Counter - 1;
                    }
                    else if (Counter <= Children.Count * -1)
                    {
                        // pTo = (Counter + 1) * this.DesiredSize.Width;
                        pTo     = (Counter + 1) * (MouseFirst.Y - MouseFinal.Y);
                        Counter = Counter + 1;
                    }
                }


                for (var i = 0; i < Children.Count; i++)
                {
                    var da = new DoubleAnimation(pFrom, pTo, new Duration(TimeSpan.FromSeconds(0.3)));


                    //((TranslateTransform)Children[i].RenderTransform).BeginAnimation(TranslateTransform.XProperty, da);
                }

                SelectedIndex = Math.Abs(Counter);
                e.Handled     = true;
            }
            catch { }
            finally
            {
                canmove = false;
            }
        }
コード例 #39
0
 public Bordure()
 {
     MouseEnter += new MouseEventHandler(Tile_MouseEnter);
     MouseEnter += new MouseEventHandler(Tile_MouseLeave);
 }
コード例 #40
0
        private void CreatePanel()
        {
            this.transform.parent = this.parent.transform;
            this.name             = "IptSettingsPanel";
            this.AlignTo(this.parent, UIAlignAnchor.TopRight);
            this.relativePosition        = new Vector3(this.parent.width + 1f, 0.0f);
            this.width                   = 344f;
            this.height                  = 363f;
            this.backgroundSprite        = "MenuPanel2";
            this.canFocus                = true;
            this.isInteractive           = true;
            this.isVisible               = false;
            this.eventVisibilityChanged += new PropertyChangedEventHandler <bool>(this.OnVisibilityChanged);
            UILabel uiLabel1 = this.AddUIComponent <UILabel>();

            uiLabel1.name          = "Title";
            uiLabel1.text          = Localization.Get("SETTINGS");
            uiLabel1.textAlignment = UIHorizontalAlignment.Center;
            uiLabel1.font          = UIHelper.Font;
            uiLabel1.position      = new Vector3((float)((double)this.width / 2.0 - (double)uiLabel1.width / 2.0), (float)((double)uiLabel1.height / 2.0 - 20.0));
            UIButton uiButton = this.AddUIComponent <UIButton>();

            uiButton.name             = "CloseButton";
            uiButton.width            = 32f;
            uiButton.height           = 32f;
            uiButton.normalBgSprite   = "buttonclose";
            uiButton.hoveredBgSprite  = "buttonclosehover";
            uiButton.pressedBgSprite  = "buttonclosepressed";
            uiButton.relativePosition = new Vector3((float)((double)this.width - (double)uiButton.width - 2.0), 2f);
            uiButton.eventClick      += new MouseEventHandler(this.OnCloseButtonClick);
            UIPanel uiPanel1 = this.AddUIComponent <UIPanel>();
            string  str1     = "ContainerPanel";

            uiPanel1.name = str1;
            int num1 = 13;

            uiPanel1.anchor = (UIAnchorStyle)num1;
            uiPanel1.transform.localPosition = Vector3.zero;
            double num2 = (double)this.width - 12.0;

            uiPanel1.width = (float)num2;
            double num3 = (double)this.height - 60.0;

            uiPanel1.height = (float)num3;
            int num4 = 1;

            uiPanel1.autoLayout = num4 != 0;
            int num5 = 1;

            uiPanel1.autoLayoutDirection = (LayoutDirection)num5;
            RectOffset rectOffset1 = new RectOffset(0, 0, 0, 1);

            uiPanel1.autoLayoutPadding = rectOffset1;
            int num6 = 0;

            uiPanel1.autoLayoutStart = (LayoutStart)num6;
            Vector3 vector3 = new Vector3(6f, 50f);

            uiPanel1.relativePosition = vector3;
            UIPanel uiPanel2 = uiPanel1.AddUIComponent <UIPanel>();

            uiPanel2.width  = uiPanel2.parent.width;
            uiPanel2.height = 30f;
            uiPanel2.autoLayoutDirection = LayoutDirection.Horizontal;
            uiPanel2.autoLayoutStart     = LayoutStart.TopLeft;
            uiPanel2.autoLayoutPadding   = new RectOffset(8, 0, 4, 4);
            uiPanel2.autoLayout          = true;
            uiPanel2.backgroundSprite    = "InfoviewPanel";
            uiPanel2.color = new Color32((byte)128, (byte)128, (byte)128, byte.MaxValue);
            UIPanel uiPanel3  = uiPanel2.AddUIComponent <UIPanel>();
            Vector2 vector2_1 = new Vector2(233f, 30f);

            uiPanel3.size = vector2_1;
            int num7 = 0;

            uiPanel3.autoLayoutDirection = (LayoutDirection)num7;
            int num8 = 0;

            uiPanel3.autoLayoutStart = (LayoutStart)num8;
            RectOffset rectOffset2 = new RectOffset(0, 0, 4, 0);

            uiPanel3.autoLayoutPadding = rectOffset2;
            int num9 = 1;

            uiPanel3.autoLayout = num9 != 0;
            UICheckBox checkBox1 = UIHelper.CreateCheckBox((UIComponent)uiPanel3);

            checkBox1.name               = "BudgetControl";
            checkBox1.text               = Localization.Get("SETTINGS_ENABLE_BUDGET_CONTROL");
            checkBox1.tooltip            = Localization.Get("SETTINGS_BUDGET_CONTROL_TOOLTIP") + System.Environment.NewLine + Localization.Get("EXPLANATION_BUDGET_CONTROL");
            checkBox1.size               = new Vector2(229f, 30f);
            checkBox1.eventCheckChanged += new PropertyChangedEventHandler <bool>(this.OnBudgetCheckChanged);
            this._budgetControl          = checkBox1;
            UIButton button1 = UIHelper.CreateButton((UIComponent)uiPanel2);
            string   str2    = Localization.Get("SETTINGS_UPDATE");

            button1.text = str2;
            string str3 = Localization.Get("SETTINGS_BUDGET_BUTTON_TOOLTIP");

            button1.tooltip = str3;
            double num10 = 0.800000011920929;

            button1.textScale = (float)num10;
            double num11 = 80.0;

            button1.width = (float)num11;
            double num12 = 22.0;

            button1.height = (float)num12;
            MouseEventHandler mouseEventHandler1 = new MouseEventHandler(this.OnUpdateButtonClick);

            button1.eventClick += mouseEventHandler1;
            UIPanel uiPanel4 = uiPanel1.AddUIComponent <UIPanel>();

            uiPanel4.width  = uiPanel4.parent.width;
            uiPanel4.height = 30f;
            uiPanel4.autoLayoutDirection = LayoutDirection.Horizontal;
            uiPanel4.autoLayoutStart     = LayoutStart.TopLeft;
            uiPanel4.autoLayoutPadding   = new RectOffset(8, 0, 4, 4);
            uiPanel4.autoLayout          = true;
            uiPanel4.backgroundSprite    = "InfoviewPanel";
            uiPanel4.color = new Color32((byte)96, (byte)96, (byte)96, byte.MaxValue);
            UIPanel uiPanel5  = uiPanel4.AddUIComponent <UIPanel>();
            Vector2 vector2_2 = new Vector2(uiPanel4.width - 4f, uiPanel4.height);

            uiPanel5.size = vector2_2;
            int num13 = 0;

            uiPanel5.autoLayoutDirection = (LayoutDirection)num13;
            int num14 = 0;

            uiPanel5.autoLayoutStart = (LayoutStart)num14;
            RectOffset rectOffset3 = new RectOffset(0, 0, 4, 0);

            uiPanel5.autoLayoutPadding = rectOffset3;
            int num15 = 1;

            uiPanel5.autoLayout = num15 != 0;
            UICheckBox checkBox2 = UIHelper.CreateCheckBox((UIComponent)uiPanel5);

            checkBox2.name               = "CompatibilityMode";
            checkBox2.text               = Localization.Get("SETTINGS_COMPATIBILITY_MODE");
            checkBox2.tooltip            = Localization.Get("SETTINGS_COMPATIBILITY_MODE_TOOLTIP");
            checkBox2.size               = new Vector2(uiPanel4.width - 8f, uiPanel4.height);
            checkBox2.eventCheckChanged += new PropertyChangedEventHandler <bool>(this.OnCompatibilityModeChanged);
            this._compatibilityMode      = checkBox2;
            UIPanel uiPanel6 = uiPanel1.AddUIComponent <UIPanel>();

            uiPanel6.width  = uiPanel6.parent.width;
            uiPanel6.height = 30f;
            uiPanel6.autoLayoutDirection = LayoutDirection.Horizontal;
            uiPanel6.autoLayoutStart     = LayoutStart.TopLeft;
            uiPanel6.autoLayoutPadding   = new RectOffset(8, 0, 4, 4);
            uiPanel6.autoLayout          = true;
            uiPanel6.backgroundSprite    = "InfoviewPanel";
            uiPanel6.color = new Color32((byte)128, (byte)128, (byte)128, byte.MaxValue);
            UILabel uiLabel2 = uiPanel6.AddUIComponent <UILabel>();
            string  str4     = Localization.Get("SETTINGS_SPAWN_TIME_INTERVAL");

            uiLabel2.text = str4;
            UIFont font1 = UIHelper.Font;

            uiLabel2.font = font1;
            Color32 white1 = (Color32)Color.white;

            uiLabel2.textColor = white1;
            double num16 = 0.800000011920929;

            uiLabel2.textScale = (float)num16;
            int num17 = 0;

            uiLabel2.autoSize = num17 != 0;
            double num18 = 30.0;

            uiLabel2.height = (float)num18;
            double num19 = 180.0;

            uiLabel2.width = (float)num19;
            int num20 = 1;

            uiLabel2.verticalAlignment = (UIVerticalAlignment)num20;
            UITextField uiTextField1 = uiPanel6.AddUIComponent <UITextField>();

            uiTextField1.name                 = "SpawnTimeInterval";
            uiTextField1.text                 = "0";
            uiTextField1.tooltip              = Localization.Get("SETTINGS_SPAWN_TIME_INTERVAL_TOOLTIP");
            uiTextField1.textColor            = (Color32)Color.black;
            uiTextField1.selectionSprite      = "EmptySprite";
            uiTextField1.normalBgSprite       = "TextFieldPanelHovered";
            uiTextField1.focusedBgSprite      = "TextFieldPanel";
            uiTextField1.builtinKeyNavigation = true;
            uiTextField1.submitOnFocusLost    = true;
            uiTextField1.eventTextSubmitted  += new PropertyChangedEventHandler <string>(this.OnSpawnTimeIntervalSubmitted);
            uiTextField1.width                = 45f;
            uiTextField1.height               = 22f;
            uiTextField1.maxLength            = 4;
            uiTextField1.numericalOnly        = true;
            uiTextField1.verticalAlignment    = UIVerticalAlignment.Middle;
            uiTextField1.padding              = new RectOffset(0, 0, 4, 0);
            this._spawnTimeInterval           = uiTextField1;
            UIButton button2 = UIHelper.CreateButton((UIComponent)uiPanel6);
            string   str5    = Localization.Get("SETTINGS_RESET");

            button2.text = str5;
            string str6 = Localization.Get("SETTINGS_SPAWN_TIME_INTERVAL_BUTTON_TOOLTIP");

            button2.tooltip = str6;
            double num21 = 0.800000011920929;

            button2.textScale = (float)num21;
            double num22 = 80.0;

            button2.width = (float)num22;
            double num23 = 22.0;

            button2.height = (float)num23;
            MouseEventHandler mouseEventHandler2 = new MouseEventHandler(this.OnResetButtonClick);

            button2.eventClick += mouseEventHandler2;
            UIPanel uiPanel7 = uiPanel1.AddUIComponent <UIPanel>();

            uiPanel7.width  = uiPanel7.parent.width;
            uiPanel7.height = 30f;
            uiPanel7.autoLayoutDirection = LayoutDirection.Horizontal;
            uiPanel7.autoLayoutStart     = LayoutStart.TopLeft;
            uiPanel7.autoLayoutPadding   = new RectOffset(8, 0, 4, 4);
            uiPanel7.autoLayout          = true;
            uiPanel7.backgroundSprite    = "InfoviewPanel";
            uiPanel7.color = new Color32((byte)96, (byte)96, (byte)96, byte.MaxValue);
            UILabel uiLabel3 = uiPanel7.AddUIComponent <UILabel>();
            string  str7     = Localization.Get("SETTINGS_UNBUNCHING_AGGRESSION");

            uiLabel3.text = str7;
            UIFont font2 = UIHelper.Font;

            uiLabel3.font = font2;
            Color32 white2 = (Color32)Color.white;

            uiLabel3.textColor = white2;
            double num24 = 0.800000011920929;

            uiLabel3.textScale = (float)num24;
            int num25 = 0;

            uiLabel3.autoSize = num25 != 0;
            double num26 = 30.0;

            uiLabel3.height = (float)num26;
            double num27 = 180.0;

            uiLabel3.width = (float)num27;
            int num28 = 1;

            uiLabel3.verticalAlignment = (UIVerticalAlignment)num28;
            UITextField uiTextField2 = uiPanel7.AddUIComponent <UITextField>();

            uiTextField2.name                 = "IntervalAggressionFactor";
            uiTextField2.text                 = "3";
            uiTextField2.tooltip              = Localization.Get("SETTINGS_UNBUNCHING_AGGRESSION_TOOLTIP") + System.Environment.NewLine + Localization.Get("EXPLANATION_UNBUNCHING");
            uiTextField2.textColor            = (Color32)Color.black;
            uiTextField2.selectionSprite      = "EmptySprite";
            uiTextField2.normalBgSprite       = "TextFieldPanelHovered";
            uiTextField2.focusedBgSprite      = "TextFieldPanel";
            uiTextField2.builtinKeyNavigation = true;
            uiTextField2.submitOnFocusLost    = true;
            uiTextField2.eventTextSubmitted  += new PropertyChangedEventHandler <string>(this.OnIntervalAggressionFactorSubmitted);
            uiTextField2.width                = 45f;
            uiTextField2.height               = 22f;
            uiTextField2.maxLength            = 1;
            uiTextField2.numericalOnly        = true;
            uiTextField2.verticalAlignment    = UIVerticalAlignment.Middle;
            uiTextField2.padding              = new RectOffset(0, 0, 4, 0);
            this._intervalAggressionFactor    = uiTextField2;
            UIPanel uiPanel8 = uiPanel1.AddUIComponent <UIPanel>();

            uiPanel8.width  = uiPanel8.parent.width;
            uiPanel8.height = 30f;
            uiPanel8.autoLayoutDirection = LayoutDirection.Horizontal;
            uiPanel8.autoLayoutStart     = LayoutStart.TopLeft;
            uiPanel8.autoLayoutPadding   = new RectOffset(8, 0, 4, 4);
            uiPanel8.autoLayout          = true;
            uiPanel8.backgroundSprite    = "InfoviewPanel";
            uiPanel8.color = new Color32((byte)128, (byte)128, (byte)128, byte.MaxValue);
            UILabel uiLabel4 = uiPanel8.AddUIComponent <UILabel>();
            string  str8     = Localization.Get("SETTINGS_VEHICLE_COUNT");

            uiLabel4.text = str8;
            UIFont font3 = UIHelper.Font;

            uiLabel4.font = font3;
            Color32 white3 = (Color32)Color.white;

            uiLabel4.textColor = white3;
            double num29 = 0.800000011920929;

            uiLabel4.textScale = (float)num29;
            int num30 = 0;

            uiLabel4.autoSize = num30 != 0;
            double num31 = 30.0;

            uiLabel4.height = (float)num31;
            double num32 = 180.0;

            uiLabel4.width = (float)num32;
            int num33 = 1;

            uiLabel4.verticalAlignment = (UIVerticalAlignment)num33;
            UITextField uiTextField3 = uiPanel8.AddUIComponent <UITextField>();

            uiTextField3.name                 = "DefaultVehicleCount";
            uiTextField3.text                 = "0";
            uiTextField3.tooltip              = Localization.Get("SETTINGS_VEHICLE_COUNT_TOOLTIP");
            uiTextField3.textColor            = (Color32)Color.black;
            uiTextField3.selectionSprite      = "EmptySprite";
            uiTextField3.normalBgSprite       = "TextFieldPanelHovered";
            uiTextField3.focusedBgSprite      = "TextFieldPanel";
            uiTextField3.builtinKeyNavigation = true;
            uiTextField3.submitOnFocusLost    = true;
            uiTextField3.eventTextSubmitted  += new PropertyChangedEventHandler <string>(this.OnDefaultVehicleCountSubmitted);
            uiTextField3.width                = 45f;
            uiTextField3.height               = 22f;
            uiTextField3.maxLength            = 1;
            uiTextField3.numericalOnly        = true;
            uiTextField3.verticalAlignment    = UIVerticalAlignment.Middle;
            uiTextField3.padding              = new RectOffset(0, 0, 4, 0);
            this._defaultVehicleCount         = uiTextField3;
            UIPanel uiPanel9 = uiPanel1.AddUIComponent <UIPanel>();

            uiPanel9.width  = uiPanel9.parent.width;
            uiPanel9.height = 30f;
            uiPanel9.autoLayoutDirection = LayoutDirection.Horizontal;
            uiPanel9.autoLayoutStart     = LayoutStart.TopLeft;
            uiPanel9.autoLayoutPadding   = new RectOffset(8, 0, 4, 4);
            uiPanel9.autoLayout          = true;
            uiPanel9.backgroundSprite    = "InfoviewPanel";
            uiPanel9.color = new Color32((byte)96, (byte)96, (byte)96, byte.MaxValue);
            UIPanel uiPanel10 = uiPanel9.AddUIComponent <UIPanel>();
            Vector2 vector2_3 = new Vector2(uiPanel9.width - 4f, uiPanel9.height);

            uiPanel10.size = vector2_3;
            int num34 = 0;

            uiPanel10.autoLayoutDirection = (LayoutDirection)num34;
            int num35 = 0;

            uiPanel10.autoLayoutStart = (LayoutStart)num35;
            RectOffset rectOffset4 = new RectOffset(0, 0, 4, 0);

            uiPanel10.autoLayoutPadding = rectOffset4;
            int num36 = 1;

            uiPanel10.autoLayout = num36 != 0;
            UICheckBox checkBox3 = UIHelper.CreateCheckBox((UIComponent)uiPanel10);

            checkBox3.name               = "ShowLineInfo";
            checkBox3.text               = Localization.Get("SETTINGS_AUTOSHOW_LINE_INFO");
            checkBox3.tooltip            = Localization.Get("SETTINGS_AUTOSHOW_LINE_INFO_TOOLTIP");
            checkBox3.size               = new Vector2(uiPanel9.width - 8f, uiPanel9.height);
            checkBox3.eventCheckChanged += new PropertyChangedEventHandler <bool>(this.OnShowLineCheckChanged);
            this._showLineInfo           = checkBox3;
            UIPanel uiPanel11 = uiPanel1.AddUIComponent <UIPanel>();

            uiPanel11.width  = uiPanel11.parent.width;
            uiPanel11.height = 30f;
            uiPanel11.autoLayoutDirection = LayoutDirection.Horizontal;
            uiPanel11.autoLayoutStart     = LayoutStart.TopLeft;
            uiPanel11.autoLayoutPadding   = new RectOffset(8, 0, 4, 4);
            uiPanel11.autoLayout          = true;
            uiPanel11.backgroundSprite    = "InfoviewPanel";
            uiPanel11.color = new Color32((byte)128, (byte)128, (byte)128, byte.MaxValue);
            UILabel uiLabel5 = uiPanel11.AddUIComponent <UILabel>();
            string  str9     = Localization.Get("SETTINGS_SPEED");

            uiLabel5.text = str9;
            UIFont font4 = UIHelper.Font;

            uiLabel5.font = font4;
            Color32 white4 = (Color32)Color.white;

            uiLabel5.textColor = white4;
            double num37 = 0.800000011920929;

            uiLabel5.textScale = (float)num37;
            int num38 = 0;

            uiLabel5.autoSize = num38 != 0;
            double num39 = 30.0;

            uiLabel5.height = (float)num39;
            double num40 = 180.0;

            uiLabel5.width = (float)num40;
            int num41 = 1;

            uiLabel5.verticalAlignment = (UIVerticalAlignment)num41;
            UITextField uiTextField4 = uiPanel11.AddUIComponent <UITextField>();

            uiTextField4.name                 = "MaxSpeed";
            uiTextField4.text                 = "";
            uiTextField4.textColor            = (Color32)Color.black;
            uiTextField4.selectionSprite      = "EmptySprite";
            uiTextField4.normalBgSprite       = "TextFieldPanelHovered";
            uiTextField4.focusedBgSprite      = "TextFieldPanel";
            uiTextField4.builtinKeyNavigation = true;
            uiTextField4.submitOnFocusLost    = true;
            uiTextField4.eventTextSubmitted  += new PropertyChangedEventHandler <string>(this.OnMaxSpeedSubmitted);
            uiTextField4.width                = 45f;
            uiTextField4.height               = 22f;
            uiTextField4.maxLength            = 4;
            uiTextField4.verticalAlignment    = UIVerticalAlignment.Middle;
            uiTextField4.padding              = new RectOffset(0, 0, 4, 0);
            this._speedString                 = uiTextField4;
            UIPanel uiPanel12 = uiPanel1.AddUIComponent <UIPanel>();

            uiPanel12.width  = uiPanel12.parent.width;
            uiPanel12.height = 90f;
            uiPanel12.autoLayoutDirection = LayoutDirection.Vertical;
            uiPanel12.autoLayoutStart     = LayoutStart.TopLeft;
            uiPanel12.autoLayoutPadding   = new RectOffset(8, 0, 0, 0);
            uiPanel12.autoLayout          = true;
            uiPanel12.backgroundSprite    = "InfoviewPanel";
            uiPanel12.color = new Color32((byte)96, (byte)96, (byte)96, byte.MaxValue);
            UIPanel uiPanel13 = uiPanel12.AddUIComponent <UIPanel>();

            uiPanel13.width  = uiPanel12.width - (float)uiPanel12.autoLayoutPadding.left;
            uiPanel13.height = 30f;
            uiPanel13.autoLayoutDirection = LayoutDirection.Horizontal;
            uiPanel13.autoLayoutStart     = LayoutStart.TopLeft;
            uiPanel13.autoLayoutPadding   = new RectOffset(0, 0, 7, 0);
            uiPanel13.autoLayout          = true;
            UILabel uiLabel6 = uiPanel13.AddUIComponent <UILabel>();
            string  str10    = Localization.Get("SETTINGS_LINE_DELETION_TOOL");

            uiLabel6.text = str10;
            UIFont font5 = UIHelper.Font;

            uiLabel6.font = font5;
            Color32 white5 = (Color32)Color.white;

            uiLabel6.textColor = white5;
            double num42 = 0.800000011920929;

            uiLabel6.textScale = (float)num42;
            int num43 = 0;

            uiLabel6.autoSize = num43 != 0;
            double num44 = 30.0;

            uiLabel6.height = (float)num44;
            double num45 = 241.0;

            uiLabel6.width = (float)num45;
            int num46 = 1;

            uiLabel6.verticalAlignment = (UIVerticalAlignment)num46;
            UIButton button3 = UIHelper.CreateButton((UIComponent)uiPanel13);
            string   str11   = Localization.Get("SETTINGS_DELETE");

            button3.text = str11;
            string str12 = Localization.Get("SETTINGS_LINE_DELETION_TOOL_BUTTON_TOOLTIP");

            button3.tooltip = str12;
            double num47 = 0.800000011920929;

            button3.textScale = (float)num47;
            double num48 = 80.0;

            button3.width = (float)num48;
            double num49 = 22.0;

            button3.height = (float)num49;
            MouseEventHandler mouseEventHandler3 = new MouseEventHandler(this.OnDeleteLinesClick);

            button3.eventClick += mouseEventHandler3;
            UIPanel uiPanel14 = uiPanel12.AddUIComponent <UIPanel>();

            uiPanel14.width  = uiPanel12.width - (float)uiPanel12.autoLayoutPadding.left;
            uiPanel14.height = 30f;
            uiPanel14.autoLayoutDirection = LayoutDirection.Horizontal;
            uiPanel14.autoLayoutStart     = LayoutStart.TopLeft;
            uiPanel14.autoLayoutPadding   = new RectOffset(0, 0, 7, 0);
            uiPanel14.autoLayout          = true;
            this._deleteBusLines          = UIHelper.CreateCheckBox((UIComponent)uiPanel14);
            this._deleteBusLines.text     = ColossalFramework.Globalization.Locale.Get("INFO_PUBLICTRANSPORT_BUS");
            this._deleteBusLines.width    = uiPanel14.width / 3f;
            this._deleteTramLines         = UIHelper.CreateCheckBox((UIComponent)uiPanel14);
            this._deleteTramLines.text    = ColossalFramework.Globalization.Locale.Get("INFO_PUBLICTRANSPORT_TRAM");
            this._deleteTramLines.width   = uiPanel14.width / 3f;
            this._deleteMetroLines        = UIHelper.CreateCheckBox((UIComponent)uiPanel14);
            this._deleteMetroLines.text   = ColossalFramework.Globalization.Locale.Get("INFO_PUBLICTRANSPORT_METRO");
            this._deleteMetroLines.width  = uiPanel14.width / 3f;
            UIPanel uiPanel15 = uiPanel12.AddUIComponent <UIPanel>();

            uiPanel15.width  = uiPanel12.width - (float)uiPanel12.autoLayoutPadding.left;
            uiPanel15.height = 30f;
            uiPanel15.autoLayoutDirection = LayoutDirection.Horizontal;
            uiPanel15.autoLayoutStart     = LayoutStart.TopLeft;
            uiPanel15.autoLayoutPadding   = new RectOffset(0, 0, 7, 0);
            uiPanel15.autoLayout          = true;
            this._deleteTrainLines        = UIHelper.CreateCheckBox((UIComponent)uiPanel15);
            this._deleteTrainLines.text   = ColossalFramework.Globalization.Locale.Get("INFO_PUBLICTRANSPORT_TRAIN");
            this._deleteTrainLines.width  = uiPanel15.width / 3f;
            this._deleteShipLines         = UIHelper.CreateCheckBox((UIComponent)uiPanel15);
            this._deleteShipLines.text    = ColossalFramework.Globalization.Locale.Get("INFO_PUBLICTRANSPORT_SHIP");
            this._deleteShipLines.width   = uiPanel15.width / 3f;
            this._deleteAirLines          = UIHelper.CreateCheckBox((UIComponent)uiPanel15);
            this._deleteAirLines.text     = ColossalFramework.Globalization.Locale.Get("INFO_PUBLICTRANSPORT_PLANE");
            this._deleteAirLines.width    = uiPanel15.width / 3f;
        }
コード例 #41
0
ファイル: FormMain.cs プロジェクト: JustTeRoR/CG-Example4
 private void FormMain_Load(object sender, EventArgs e)
 {
     MouseWheel += new MouseEventHandler(FormMain_MouseWheel);
     g           = CreateGraphics();
     Platon      = new PlatonBody(ClientRectangle.Width, ClientRectangle.Height);
 }
コード例 #42
0
ファイル: MouseHook.cs プロジェクト: macote/Winook
 public void AddHandler(MouseMessageCode mouseMessageCode, MouseEventHandler handler)
 => AddHandler((int)mouseMessageCode, handler);
コード例 #43
0
ファイル: FormLoadGraph.cs プロジェクト: radtek/.NET-Projects
        public FormLoadGraph()
        {
            if (!HasCounterCategory("Network Interface"))
            {
                this.Close();
                throw new Exception("This computer has no: 'Network Interface' counter");
            }//end if

            InitializeComponent();

            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            m_Options    = new Options();
            m_vTrayIcons = new TrayIconList();

            string path = Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)).FullName;

            string sDirectory = Path.Combine(path, Utils.AppName);             //Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            Directory.CreateDirectory(sDirectory);

            m_sSettingsFile = Path.Combine(sDirectory, m_sSettingsFile);

            string dataBaseFileName = Path.Combine(sDirectory, "log.mdb");

            if (!(File.Exists(dataBaseFileName)))
            {
                Stream s      = Assembly.GetExecutingAssembly().GetManifestResourceStream("DUMeterMZ.log.mdb");
                Stream r      = File.Create(dataBaseFileName);
                int    len    = 8192;
                byte[] buffer = new byte[len];
                while (len > 0)
                {
                    len = s.Read(buffer, 0, len);
                    r.Write(buffer, 0, len);
                }
                r.Close();
                s.Close();
            }            //end if

            m_OleDbConnection.ConnectionString =
                @"Provider=Microsoft.Jet.OLEDB.4.0;" +
                @"Password="""";User ID=Admin;" +
                @"Data Source=" + sDirectory + @"\log.mdb;" +
                @"Mode=Share Deny None;" +
                @"Extended Properties="""";" +
                @"Jet OLEDB:System database="""";" +
                @"Jet OLEDB:Registry Path="""";" +
                @"Jet OLEDB:Database Password="""";" +
                @"Jet OLEDB:Engine Type=5;" +
                @"Jet OLEDB:Database Locking Mode=1;" +
                @"Jet OLEDB:Global Partial Bulk Ops=2;" +
                @"Jet OLEDB:Global Bulk Transactions=1;" +
                @"Jet OLEDB:New Database Password="""";" +
                @"Jet OLEDB:Create System Database=False;" +
                @"Jet OLEDB:Encrypt Database=False;" +
                @"Jet OLEDB:Don't Copy Locale on Compact=False;" +
                @"Jet OLEDB:Compact Without Replica Repair=False;" +
                @"Jet OLEDB:SFP=False";

            Application.ApplicationExit += new EventHandler(this.AppExit);
            MouseWheel += new MouseEventHandler(MyMouseWheel);
            m_PictureBoxGraph_Resize(this, null);
            m_NotifyIcon.Icon = m_vTrayIcons[3];
            //icon = Icon.ToBitmap();

            //initialize queue with screen width
            m_recv_all_q = new FixedSizeQueue <float>(Screen.PrimaryScreen.Bounds.Width);
            m_send_all_q = new FixedSizeQueue <float>(Screen.PrimaryScreen.Bounds.Width);
            m_OleDbConnection.Open();
        }        //end Constructor
コード例 #44
0
ファイル: MouseHook.cs プロジェクト: macote/Winook
 public void RemoveHandler(MouseMessageCode mouseMessageCode, MouseEventHandler handler)
 => RemoveHandler((int)mouseMessageCode, handler);
コード例 #45
0
        public override AutoForm showPreview()
        {
            createPreviewForm();
            // TODO refactor to some GfxPreviewForm etc.
            MouseEventHandler mouseHandler = (_, args) => {
                if (args.Button != MouseButtons.Right)
                {
                    return;
                }

                ColorDialog colorDialog = new();
                if (colorDialog.ShowDialog() == DialogResult.OK)
                {
                    previewForm.BackColor = colorDialog.Color;
                }
            };

            previewForm.MouseClick += mouseHandler;
            previewForm.flowLayoutPanel.MouseClick += mouseHandler;

            frames = new Image[demiseAsset.frameCount];

            void addPictureBox(int i)
            {
                Bitmap bmp = demiseAsset[i];

                frames[i] = bmp;

                PictureBox pb = new() {
                    Image    = bmp,
                    SizeMode = PictureBoxSizeMode.AutoSize
                };

                pb.MouseClick += mouseHandler;
                // Console.Out.WriteLine( pb.Size );
                previewForm.add(pb);
                // previewForm.Controls.Add( pb );
            }

            for (int i = 0; i < demiseAsset.frameCount; i++)
            {
                addPictureBox(i);
            }

            // previewForm.flowLayoutPanel.MinimumSize = new( demiseAsset.width + 6, demiseAsset.height + 6 );
            // Console.Out.WriteLine( previewForm.flowLayoutPanel.Size );

            // previewForm.flowLayoutPanel.PerformLayout();
            // previewForm.flowLayoutPanel.Refresh();
            // previewForm.flowLayoutPanel.Invalidate();
            // previewForm.flowLayoutPanel.ResumeLayout(true);

            // previewForm.PerformLayout();
            // previewForm.Refresh();
            // previewForm.Invalidate();
            // previewForm.ResumeLayout(true);
            // previewForm.MinimumSize = new( demiseAsset.width, demiseAsset.height );

            addUnpackMenuAndShow();

            return(previewForm);
        }
コード例 #46
0
 public winFormEX()
 {
     SetStyle(ControlStyles.DoubleBuffer, true);
     FormBorderStyle = FormBorderStyle.None;
     MouseDown      += new MouseEventHandler(_MouseDown);
 }
コード例 #47
0
 public TABPAGEclass(Form form, string name, string text, int sX, int sY, int pX, int pY, MouseEventHandler eh_tabpage)
 {
     this.form       = form;
     this.name       = name;
     this.text       = text;
     this.sX         = sX;
     this.sY         = sY;
     this.pX         = pX;
     this.pY         = pY;
     this.eh_tabpage = eh_tabpage;
 }
コード例 #48
0
 private void InitAppImages(List <AppEntity> apps, MouseEventHandler switchApp, MouseEventHandler updateLaunchButtonStatus)
 {
     foreach (var app in this.apps)
     {
         app.PictureBox.Name  = app.AppName;
         app.PictureBox.Image = Icon.ExtractAssociatedIcon(app.ExecutePath).ToBitmap();
         app.SetSize(new Size(config.IconSize, config.IconSize));
         app.PictureBox.SizeMode    = PictureBoxSizeMode.StretchImage;
         app.PictureBox.MouseClick += switchApp;
         app.PictureBox.MouseClick += updateLaunchButtonStatus;
         Controls.Add(app.PictureBox);
     }
     UpdateAppImagesLocation(apps);
 }
コード例 #49
0
ファイル: MyForm.cs プロジェクト: teach1997/csharp
 public MyForm()
 {
     InitializeComponent();
     // Handle the MouseMove event
     MouseMove += new MouseEventHandler(MyForm_MouseUp);
 }
コード例 #50
0
            public ColorStop(int id, int loc, Color clr, bool selected, EventHandler ColorStop_Click, EventHandler ColorStop_DoubleClick, MouseEventHandler ColorStop_MouseDown, MouseEventHandler ColorStop_MouseMove)
            {
                this.ID             = id;
                this.CSLocation     = loc;
                this.selected       = selected;
                this.colorStopColor = clr;

                this.Image = new PictureBox();

                this.Image.Location     = new Point(this.CSLocation, 0);
                this.Image.Name         = id.ToString();
                this.Image.Size         = ColorStopSize;
                this.Image.TabIndex     = 0;
                this.Image.TabStop      = false;
                this.Image.Visible      = true;
                this.Image.Enabled      = true;
                this.Image.BackColor    = Color.Transparent;
                this.Image.Image        = redraw();
                this.Image.Click       += ColorStop_Click;
                this.Image.DoubleClick += ColorStop_DoubleClick;
                this.Image.MouseDown   += ColorStop_MouseDown;
                this.Image.MouseMove   += ColorStop_MouseMove;
            }
コード例 #51
0
 public SectionAbout()
 {
     ds = new PaintEventHandler(drawSection);
     eh = new MouseEventHandler(clicked);
 }
コード例 #52
0
ファイル: MainForm.cs プロジェクト: Iron-YeHong/DrawTools
 public MainForm()
 {
     InitializeComponent();
     MouseWheel += new MouseEventHandler(MainForm_MouseWheel);
 }
コード例 #53
0
ファイル: MainWindow.xaml.cs プロジェクト: MatejMa2ur/Editor
        public MainWindow()
        {
            InitializeComponent();


            Nullable <Point> dragStart = null;

            MouseButtonEventHandler mouseDown = (sender, args) => {
                foreach (var item in Canvascek.Children)
                {
                    item.GetType().GetProperty("Stroke").SetValue(item, new SolidColorBrush(Color.FromRgb(255, 255, 255)));
                    item.GetType().GetProperty("StrokeThickness").SetValue(item, 0);
                }
                sender.GetType().GetProperty("Stroke").SetValue(sender, new SolidColorBrush(Color.FromRgb(0, 0, 0)));
                sender.GetType().GetProperty("StrokeThickness").SetValue(sender, 2);

                DataObjektu.Text = sender.GetType().ToString().Replace("System.Windows.Shapes.", "") + "\nWidth: " + sender.GetType().GetProperty("Width").GetValue(sender) + "\n" + "Height: " + sender.GetType().GetProperty("Height").GetValue(sender);

                /*
                 * var element = (UIElement)sender;
                 * dragStart = args.GetPosition(element);
                 * element.CaptureMouse();
                 */

                if (MouseHitType == HitType.None)
                {
                    return;
                }
                LastPoint      = Mouse.GetPosition(Canvascek);
                DragInProgress = true;
            };
            MouseButtonEventHandler mouseUp = (sender, args) => {
                /*
                 * var element = (UIElement)sender;
                 * dragStart = null;
                 * element.ReleaseMouseCapture();
                 */
                DragInProgress = false;
            };
            MouseEventHandler mouseMove = (sender, args) => {
                /*
                 * MouseHitType = SetHitType((UIElement)sender, Mouse.GetPosition(Canvascek));
                 * SetMouseCursor();
                 * if (dragStart != null && args.LeftButton == MouseButtonState.Pressed)
                 * {
                 *  var element = (UIElement)sender;
                 *  var p2 = args.GetPosition(Canvascek);
                 *  Canvas.SetLeft(element, p2.X <= 0 ? 0 : Canvas.GetLeft(element) < 0 ? 0 : p2.X - dragStart.Value.X);
                 *  Canvas.SetTop(element, p2.Y <= 0 ? 0 : Canvas.GetTop(element) < 0 ? 0 : p2.Y - dragStart.Value.Y);
                 * }*/
                var fe = sender as FrameworkElement;
                if (DragInProgress)
                {
                    // See how much the mouse has moved.
                    Point  point    = Mouse.GetPosition(Canvascek);
                    double offset_x = point.X - LastPoint.X;
                    double offset_y = point.Y - LastPoint.Y;

                    // Get the rectangle's current position.
                    double new_x      = Canvas.GetLeft(fe);
                    double new_y      = Canvas.GetTop(fe);
                    double new_width  = fe.Width;
                    double new_height = fe.Height;

                    // Update the rectangle.
                    switch (MouseHitType)
                    {
                    case HitType.Body:
                        new_x += offset_x;
                        new_y += offset_y;
                        break;

                    case HitType.UL:
                        new_x      += offset_x;
                        new_y      += offset_y;
                        new_width  -= offset_x;
                        new_height -= offset_y;
                        break;

                    case HitType.UR:
                        new_y      += offset_y;
                        new_width  += offset_x;
                        new_height -= offset_y;
                        break;

                    case HitType.LR:
                        new_width  += offset_x;
                        new_height += offset_y;
                        break;

                    case HitType.LL:
                        new_x      += offset_x;
                        new_width  -= offset_x;
                        new_height += offset_y;
                        break;

                    case HitType.L:
                        new_x     += offset_x;
                        new_width -= offset_x;
                        break;

                    case HitType.R:
                        new_width += offset_x;
                        break;

                    case HitType.B:
                        new_height += offset_y;
                        break;

                    case HitType.T:
                        new_y      += offset_y;
                        new_height -= offset_y;
                        break;
                    }

                    // Don't use negative width or height.
                    if ((new_width > 0) && (new_height > 0))
                    {
                        // Update the rectangle.
                        Canvas.SetLeft(fe, new_x);
                        Canvas.SetTop(fe, new_y);
                        fe.Width  = new_width;
                        fe.Height = new_height;

                        // Save the mouse's new location.
                        LastPoint = point;
                    }
                }
                else
                {
                    MouseHitType = SetHitType(fe,
                                              Mouse.GetPosition(Canvascek));
                    SetMouseCursor();
                }
            };
            MouseEventHandler mouseLeave = (sender, args) => {
                /*
                 * MouseHitType = HitType.None;
                 * SetMouseCursor();
                 */
            };

            Action <UIElement> enableDrag = (element) => {
                element.MouseDown  += mouseDown;
                element.MouseMove  += mouseMove;
                element.MouseUp    += mouseUp;
                element.MouseLeave += mouseLeave;
            };


            var rand = new Random();

            Elipsa.Click += (sender, e) =>
            {
                var myElipse = (Ellipse)Create_Element(new Ellipse());

                enableDrag(myElipse);

                Canvascek.Children.Add(myElipse);

                int j = Canvascek.Children.Count;
                int i = 0;
                DataObjektu.Text = myElipse.GetType().ToString().Replace("System.Windows.Shapes.", "") + "\nWidth: " + myElipse.Width + "\n" + "Height: " + myElipse.Height;
                foreach (UIElement item in Canvascek.Children)
                {
                    var that = new SolidColorBrush(Color.FromRgb(255, 255, 255));
                    item.GetType().GetProperty("Stroke").SetValue(item, that);
                    item.GetType().GetProperty("StrokeThickness").SetValue(item, 0);
                    i++;
                    if (i == j)
                    {
                        Canvas.SetLeft(item, rand.NextDouble() * (Canvascek.ActualWidth - myElipse.Width));
                        Canvas.SetTop(item, rand.NextDouble() * (Canvascek.ActualHeight - myElipse.Height));
                    }
                }
            };

            Kruh.Click += (sender, e) =>
            {
                var myKruh = (Ellipse)Create_Element(new Ellipse());
                myKruh.Width = myKruh.Height;
                enableDrag(myKruh);

                Canvascek.Children.Add(myKruh);

                int j = Canvascek.Children.Count;
                int i = 0;
                DataObjektu.Text = myKruh.GetType().ToString().Replace("System.Windows.Shapes.", "") + "\nWidth: " + myKruh.Width + "\n" + "Height: " + myKruh.Height;
                foreach (UIElement item in Canvascek.Children)
                {
                    var that = new SolidColorBrush(Color.FromRgb(255, 255, 255));
                    item.GetType().GetProperty("Stroke").SetValue(item, that);
                    item.GetType().GetProperty("StrokeThickness").SetValue(item, 0);
                    i++;
                    if (i == j)
                    {
                        Canvas.SetLeft(item, rand.NextDouble() * (Canvascek.ActualWidth - myKruh.Width));
                        Canvas.SetTop(item, rand.NextDouble() * (Canvascek.ActualHeight - myKruh.Height));
                    }
                }
            };

            Stvorec.Click += (sender, e) =>
            {
                var mySquare = (Rectangle)Create_Element(new Rectangle());
                mySquare.Width = mySquare.Height;
                enableDrag(mySquare);

                Canvascek.Children.Add(mySquare);

                int j = Canvascek.Children.Count;
                int i = 0;
                DataObjektu.Text = mySquare.GetType().ToString().Replace("System.Windows.Shapes.", "") + "\nWidth: " + mySquare.Width + "\n" + "Height: " + mySquare.Height;
                foreach (UIElement item in Canvascek.Children)
                {
                    var that = new SolidColorBrush(Color.FromRgb(255, 255, 255));
                    item.GetType().GetProperty("Stroke").SetValue(item, that);
                    item.GetType().GetProperty("StrokeThickness").SetValue(item, 0);
                    i++;
                    if (i == j)
                    {
                        Canvas.SetLeft(item, rand.NextDouble() * (Canvascek.ActualWidth - mySquare.Width));
                        Canvas.SetTop(item, rand.NextDouble() * (Canvascek.ActualHeight - mySquare.Height));
                    }
                }
            };

            Obdlznik.Click += (sender, e) =>
            {
                var myRectangle = (Rectangle)Create_Element(new Rectangle());

                enableDrag(myRectangle);

                Canvascek.Children.Add(myRectangle);

                int j = Canvascek.Children.Count;
                int i = 0;
                DataObjektu.Text = myRectangle.GetType().ToString().Replace("System.Windows.Shapes.", "") + "\nWidth: " + myRectangle.Width + "\n" + "Height: " + myRectangle.Height;
                foreach (UIElement item in Canvascek.Children)
                {
                    var that = new SolidColorBrush(Color.FromRgb(255, 255, 255));
                    item.GetType().GetProperty("Stroke").SetValue(item, that);
                    item.GetType().GetProperty("StrokeThickness").SetValue(item, 0);
                    i++;
                    if (i == j)
                    {
                        Canvas.SetLeft(item, rand.NextDouble() * (Canvascek.ActualWidth - myRectangle.Width));
                        Canvas.SetTop(item, rand.NextDouble() * (Canvascek.ActualHeight - myRectangle.Height));
                    }
                }
            };

            Načítať.Click += (sender, e) =>
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter           = "Text file (*.txt)|*.txt";
                ofd.InitialDirectory = "c:\\";
                if (ofd.ShowDialog() == true)
                {
                    if (MessageBox.Show("Do you want to load this items?" + File.ReadAllText(ofd.FileName), "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        Canvascek.Children.Clear();
                        var Source = File.ReadAllText(ofd.FileName).Split("Color\n")[1].Split("\n");
                        foreach (var item in Source)
                        {
                            var splittedRow = item.Split(";");
                            var createItem  = new Object();
                            switch (splittedRow[0])
                            {
                            case "System.Windows.Shapes.Ellipse":
                                createItem = new Ellipse();
                                break;

                            case "System.Windows.Shapes.Rectangle":
                                createItem = new Rectangle();
                                break;
                            }
                            if (splittedRow.Length > 1)
                            {
                                createItem.GetType().GetProperty("Width").SetValue(createItem, Convert.ToInt32(splittedRow[1]));
                                createItem.GetType().GetProperty("Height").SetValue(createItem, Convert.ToInt32(splittedRow[2]));
                                SolidColorBrush brush = new SolidColorBrush();
                                brush.Color = (Color)ColorConverter.ConvertFromString(splittedRow[5]);
                                createItem.GetType().GetProperty("Fill").SetValue(createItem, brush);
                                enableDrag((UIElement)createItem);
                                Canvascek.Children.Add((UIElement)createItem);
                                Canvas.SetLeft((UIElement)createItem, Convert.ToDouble(splittedRow[3]));
                                Canvas.SetTop((UIElement)createItem, Convert.ToDouble(splittedRow[4]));
                            }
                        }
                    }
                }
            };
        }
コード例 #54
0
ファイル: ResizeController.cs プロジェクト: Weesals/ModHQ
        private void RegisterDragEvents(FrameworkElement nub, float xweight, float yweight, float widthWeight, float heightWeight)
        {
            bool  hasUndoEvent = false;
            Point downPos      = new Point();
            Rect  originalRect = Rect.Empty;

            MouseEventHandler       onMove = null;
            MouseButtonEventHandler onUp   = null;

            nub.MouseDown += (o, e) => {
                if (e.Handled)
                {
                    return;
                }
                nub.MouseMove += onMove;
                nub.MouseUp   += onUp;
                hasUndoEvent   = false;
                nub.CaptureMouse();
                downPos   = new Point();
                e.Handled = true;
            };
            onMove += (o, e) => {
                if (!hasUndoEvent)
                {
                    hasUndoEvent = true;
                    var origRect = View.Gadget.Rectangle1024;
                    UndoManager.PushRestore(() => {
                        var dx = origRect.X - View.Gadget.Rectangle1024.X;
                        var dy = origRect.Y - View.Gadget.Rectangle1024.Y;
                        OffsetChildren(View.Gadget.Children, dx, dy);
                        View.Gadget.Rectangle1024 = origRect;
                    });
                    originalRect = origRect;
                }
                var pos = e.GetPosition(nub);
                if (downPos == new Point())
                {
                    downPos = pos;
                }
                var         rect     = View.Gadget.Rectangle1024;
                var         space    = View.Space;
                var         x        = rect.X + xweight * (pos.X - downPos.X) / space.WidthRatio;
                var         y        = rect.Y + yweight * (pos.Y - downPos.Y) / space.HeightRatio;
                var         w        = rect.Width + widthWeight * (pos.X - downPos.X) / space.WidthRatio;
                var         h        = rect.Height + heightWeight * (pos.Y - downPos.Y) / space.HeightRatio;
                const float Rounding = 10;
                if ((Keyboard.Modifiers & ModifierKeys.Alt) != ModifierKeys.Alt)
                {
                    x = originalRect.X + Math.Round((x - originalRect.X) / Rounding) * Rounding;
                    y = originalRect.Y + Math.Round((y - originalRect.Y) / Rounding) * Rounding;
                    w = originalRect.Width + Math.Round((w - originalRect.Width) / Rounding) * Rounding;
                    h = originalRect.Height + Math.Round((h - originalRect.Height) / Rounding) * Rounding;
                }
                if (rect.X != x || rect.Y != y)
                {
                    OffsetChildren(View.Gadget.Children, x - rect.X, y - rect.Y);
                }
                rect.X      = x;
                rect.Y      = y;
                rect.Width  = Math.Max(w, 0);
                rect.Height = Math.Max(h, 0);
                View.Gadget.Rectangle1024 = rect;
            };
            onUp += (o, e) => {
                nub.ReleaseMouseCapture();
                nub.MouseMove -= onMove;
                nub.MouseUp   -= onUp;
            };
        }
コード例 #55
0
 private void setupListeners()
 {
     MouseLeave += new EventHandler(ErrorGraph_MouseLeave);
     MouseMove  += new MouseEventHandler(ErrorMouseInteractions);
     Resize     += new EventHandler(drawError);
 }
コード例 #56
0
 /// <summary>Sets an event handler to listen for dragging the mouse.</summary>
 /// <param name="mouseDragHandler">The mouse drag event handler.</param>
 /// <remarks>
 /// <para>A mouse drag event occurs when the mouse is moved while a button is held down.</para>
 /// <para>
 /// This event will be raised once for each new position the mouse moves to while the button
 /// is held down.
 /// </para>
 /// </remarks>
 public void SetMouseDragHandler(MouseEventHandler mouseDragHandler)
 {
     this._mouseDragHandler = mouseDragHandler;
 }
コード例 #57
0
        private void InitEvent()
        {
            Image image = btnDownload;

            if (CS_0024_003C_003E9__CachedAnonymousMethodDelegate11 == null)
            {
                CS_0024_003C_003E9__CachedAnonymousMethodDelegate11 = new MouseEventHandler(_003CInitEvent_003Eb__6);
            }
            image.MouseEnter += CS_0024_003C_003E9__CachedAnonymousMethodDelegate11;
            Image image2 = btnDownload;

            if (CS_0024_003C_003E9__CachedAnonymousMethodDelegate12 == null)
            {
                CS_0024_003C_003E9__CachedAnonymousMethodDelegate12 = new MouseEventHandler(_003CInitEvent_003Eb__7);
            }
            image2.MouseLeave += CS_0024_003C_003E9__CachedAnonymousMethodDelegate12;
            btnDownload.MouseLeftButtonDown += new MouseButtonEventHandler(btnDownload_MouseLeftButtonDown);
            Image image3 = btnOpen;

            if (CS_0024_003C_003E9__CachedAnonymousMethodDelegate13 == null)
            {
                CS_0024_003C_003E9__CachedAnonymousMethodDelegate13 = new MouseEventHandler(_003CInitEvent_003Eb__8);
            }
            image3.MouseEnter += CS_0024_003C_003E9__CachedAnonymousMethodDelegate13;
            Image image4 = btnOpen;

            if (CS_0024_003C_003E9__CachedAnonymousMethodDelegate14 == null)
            {
                CS_0024_003C_003E9__CachedAnonymousMethodDelegate14 = new MouseEventHandler(_003CInitEvent_003Eb__9);
            }
            image4.MouseLeave           += CS_0024_003C_003E9__CachedAnonymousMethodDelegate14;
            btnOpen.MouseLeftButtonDown += new MouseButtonEventHandler(btnOpen_MouseLeftButtonDown);
            Image image5 = btnPause;

            if (CS_0024_003C_003E9__CachedAnonymousMethodDelegate15 == null)
            {
                CS_0024_003C_003E9__CachedAnonymousMethodDelegate15 = new MouseEventHandler(_003CInitEvent_003Eb__a);
            }
            image5.MouseEnter += CS_0024_003C_003E9__CachedAnonymousMethodDelegate15;
            Image image6 = btnPause;

            if (CS_0024_003C_003E9__CachedAnonymousMethodDelegate16 == null)
            {
                CS_0024_003C_003E9__CachedAnonymousMethodDelegate16 = new MouseEventHandler(_003CInitEvent_003Eb__b);
            }
            image6.MouseLeave            += CS_0024_003C_003E9__CachedAnonymousMethodDelegate16;
            btnPause.MouseLeftButtonDown += new MouseButtonEventHandler(btnPause_MouseLeftButtonDown);
            Image image7 = btnPausing;

            if (CS_0024_003C_003E9__CachedAnonymousMethodDelegate17 == null)
            {
                CS_0024_003C_003E9__CachedAnonymousMethodDelegate17 = new MouseEventHandler(_003CInitEvent_003Eb__c);
            }
            image7.MouseEnter += CS_0024_003C_003E9__CachedAnonymousMethodDelegate17;
            Image image8 = btnPausing;

            if (CS_0024_003C_003E9__CachedAnonymousMethodDelegate18 == null)
            {
                CS_0024_003C_003E9__CachedAnonymousMethodDelegate18 = new MouseEventHandler(_003CInitEvent_003Eb__d);
            }
            image8.MouseLeave += CS_0024_003C_003E9__CachedAnonymousMethodDelegate18;
            btnPausing.MouseLeftButtonDown += new MouseButtonEventHandler(btnPausing_MouseLeftButtonDown);
            if (fileItem.CanUpdate)
            {
                TextBlock textBlock = txtFileName;
                if (CS_0024_003C_003E9__CachedAnonymousMethodDelegate19 == null)
                {
                    CS_0024_003C_003E9__CachedAnonymousMethodDelegate19 = new MouseEventHandler(_003CInitEvent_003Eb__e);
                }
                textBlock.MouseEnter += CS_0024_003C_003E9__CachedAnonymousMethodDelegate19;
                TextBlock textBlock2 = txtFileName;
                if (CS_0024_003C_003E9__CachedAnonymousMethodDelegate1a == null)
                {
                    CS_0024_003C_003E9__CachedAnonymousMethodDelegate1a = new MouseEventHandler(_003CInitEvent_003Eb__f);
                }
                textBlock2.MouseLeave           += CS_0024_003C_003E9__CachedAnonymousMethodDelegate1a;
                txtFileName.MouseLeftButtonDown += new MouseButtonEventHandler(txtFileName_MouseLeftButtonDown);
            }
            Task.Factory.StartNew(new Action(_003CInitEvent_003Eb__10));
        }
コード例 #58
0
 public void pickMouseDown(MouseEventHandler mouseEventHandler)
 {
     this.MouseDown += mouseEventHandler;
 }
コード例 #59
0
        private void FillGrid(Grid planogramGrid, IEnumerable <Shelf> result, bool usePerfColor = false, MouseEventHandler mouseEnterHandler = null, MouseEventHandler mouseLeaveHandler = null, IEnumerable <Shelf> comparisonResult = null, bool isRLM = true)
        {
            if (result == null || planogramGrid == null)
            {
                return;
            }

            var itemRectangles = planogramGrid.Children.Cast <Rectangle>();

            int slotNumber = 0;
            int row        = 0;

            foreach (var shelf in result)
            {
                int col = 0;
                //bool highlight = false;
                foreach (var item in shelf.Items)
                {
                    Rectangle itemRect = itemRectangles.ElementAt(slotNumber);
                    itemRect.Fill   = GetBrushFromColor(item.Color);
                    itemRect.Stroke = GetBrushFromColor(Colors.Black);
                    itemRect.Tag    = item;

                    itemRect.MouseEnter -= ItemAttrbutes_MouseEnter_Tensorflow;
                    itemRect.MouseEnter -= ItemAttributes_Compare_MouseEnter;
                    itemRect.MouseEnter -= ItemAttributes_MouseEnter;

                    itemRect.MouseLeave -= ItemAttrbutes_MouseLeave_Tensorflow;
                    itemRect.MouseLeave -= ItemAttributes_Compare_MouseLeave;
                    itemRect.MouseLeave -= ItemAttributes_MouseLeave;

                    if (comparisonResult == null)
                    {
                        if (mouseEnterHandler != null)
                        {
                            itemRect.MouseEnter += mouseEnterHandler;
                        }
                        if (mouseLeaveHandler != null)
                        {
                            itemRect.MouseLeave += mouseLeaveHandler;
                        }
                    }
                    else
                    {
                        var compItem = comparisonResult.ElementAt(row).Items.ElementAt(col);

                        if (compItem.ItemID != item.ItemID)
                        {
                            itemRect.Stroke          = GetBrushFromColor(Colors.White);
                            itemRect.StrokeThickness = 2;
                            itemRect.Tag             = new KeyValuePair <ShelfItem, ShelfItem>(item, compItem);

                            if (mouseEnterHandler != null)
                            {
                                itemRect.MouseEnter += mouseEnterHandler;
                            }
                            if (mouseLeaveHandler != null)
                            {
                                itemRect.MouseLeave += mouseLeaveHandler;
                            }
                        }
                    }

                    if (slotNumber == selectedSlotIndex)
                    {
                        HighlightItem(itemRect);
                    }

                    col++;
                    slotNumber++;
                }
                row++;
            }
        }
コード例 #60
-1
ファイル: WindowManager.cs プロジェクト: wshanshan/DDD
        public void BindGameController()
        {

            _mouse_up = new MouseEventHandler(OnMouseUp);
            _game_control.GetTargetControl().MouseUp += _mouse_up;

            _mouse_click = new MouseEventHandler(OnMouseClick);
            _game_control.GetTargetControl().MouseClick += _mouse_click;

            _mouse_down = new MouseEventHandler(OnMouseDown);
            _game_control.GetTargetControl().MouseDown += _mouse_down;

            _mouse_move = new MouseEventHandler(OnMouseMove);
            _game_control.GetTargetControl().MouseMove += _mouse_move;

            _mouse_wheel = new MouseEventHandler(OnMouseWheel);
            _game_control.GetTargetControl().MouseWheel += _mouse_wheel;

            _mouse_double_click = new MouseEventHandler(OnMouseDoubleClick);
            _game_control.GetTargetControl().MouseDoubleClick += _mouse_double_click;

            _key_press = new KeyPressEventHandler(OnKeyPress);
            _game_control.GetTargetControl().KeyPress += _key_press;

            _key_down = new KeyEventHandler(OnKeyDown);
            _game_control.GetTargetControl().KeyDown += _key_down;

            _key_up = new KeyEventHandler(OnKeyUp);
            _game_control.GetTargetControl().KeyUp += _key_up;

        }