Exemplo n.º 1
0
 public Board()
 {
     BackColor = Color.Black;
     DoubleBuffered = true;
     this.ClientSize = new Size(width, height);
     try {
         dot   = new Bitmap("dot.png");
         apple = new Bitmap("apple.png");
         head  = new Bitmap("head.png");
     } catch (Exception e) {
         Console.WriteLine(e.Message);
         Environment.Exit(1);
     }
     for (int z = 0; z < dots; z++) {
         x[z] = startPos - z * dotSize;
         y[z] = startPos;
     }
     locateApple();
     timer = new Timer();
     timer.Enabled = true;
     timer.Interval = 100;
     timer.Tick += new System.EventHandler(this.OnTick);
     Paint += new PaintEventHandler(this.OnPaint);
     KeyUp += new KeyEventHandler(OnKeyUp);
 }
Exemplo n.º 2
0
 public MkaColorButton()
 {
     MouseEnter += new EventHandler(OnMouseEnter);
     MouseLeave += new EventHandler(OnMouseLeave);
     MouseUp    += new MouseEventHandler(OnMouseUp);
     Paint      += new PaintEventHandler(ButtonPaint);
 }
Exemplo n.º 3
0
        private void label1_Click(object sender, EventArgs e)
        {
            //Paint += new PaintEventHandler(Form1_Paint);

            for (int i = 0; i < graph.Row * graph.Row; i++)
            {
                if (BoardArr[i % graph.Row, i / graph.Row] != 0)
                {
                    BoardArr[i % graph.Row, i / graph.Row] = 0;
                    graph.DrawQuanCo(i % graph.Row, i / graph.Row, 0, gr);
                }
            }
            Paint += new PaintEventHandler(Form1_Paint);
            if (fEnd == 1)
            {
                playerFlag = 2;
            }
            else
            {
                playerFlag = 1;
            }
            if (playerFlag == 2)
            {
                Random r = new Random();
                _x = r.Next(3);
                _y = r.Next(3);
                BoardArr[_x + 7, _y + 7] = 2;
                listUndo.Add(new Point(_x + 7, _y + 7));
                gr = this.CreateGraphics();
                graph.DrawQuanCo(_x + 7, _y + 7, BoardArr[_x + 7, _y + 7], gr);
                playerFlag = 1;
            }
            fEnd = 0;
        }
Exemplo n.º 4
0
        public BasicForm()
        {
            Version v = System.Environment.Version;

            if (v.Major < 2)
            {
                this.SetStyle(ControlStyles.DoubleBuffer, true);
            }
            else
            {
                this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            }

            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.DoubleBuffered = true;
            InitializeComponent();

            Text            = "";
            Resizable       = true;
            ControlBox      = false;
            StartPosition   = FormStartPosition.CenterScreen;
            FormBorderStyle = FormBorderStyle.None;
            Paint          += new PaintEventHandler(BasicForm_Paint);
            ParamUpdate();
        }
Exemplo n.º 5
0
        public Form1()
        {
            InitializeComponent();
            languageDictionary.Load("english", "alpha");
            writingObserver.Initialize(languageDictionary);
            Logger.Initialize(lastMessageLabel);
            StatusManager.Initialize(statusLabel);
            UIUpdater.Initialize(this, predictedWordsTextBox, writingObserver);
            MessagesInterpreter.Initialize(connectedComponentsTool, writingObserver);

            Logger.LogInfo("app started");

            this.FormClosed += Form1_FormClosed;

            this.drawPanelPublic           = this.drawPanel;
            drawPanelPaintEventHandler     = new PaintEventHandler(this.drawPanel_Paint);
            drawPanelMouseUpEventHandler   = new MouseEventHandler(this.drawPanel_MouseUp);
            drawPanelMouseMoveEventHandler = new MouseEventHandler(this.drawPanel_MouseMove);
            drawPanelMouseDownEventHandler = new MouseEventHandler(this.drawPanel_MouseDown);

            ApplicationUseManager appUseManagerInstance = ApplicationUseManager.Instance;

            appUseManagerInstance.Initialize(this);
            appUseManagerInstance.TriggerApplicationNotReady();

            ConnectionManager.StartListeningToConnections();
            // !!!!!!!!!!!!!!!!!!!!!!!!!  LET THE CLIENT START ALONG WITH THE MAIN APP!!!!!!!!!!!!!!
            ApplicationStarter.StartPythonClientFromStartingPoint();

            m_connectedComponents  = new List <ConnectedComponent>();
            this.m_auxiliaryBitmap = new Bitmap(drawPanel.Width, drawPanel.Height, drawPanel.CreateGraphics());
            Graphics.FromImage(m_auxiliaryBitmap).Clear(Color.White);
            connectedComponentsTool.Initialize(m_auxiliaryBitmap);
        }
Exemplo n.º 6
0
        public Form1()
        {
            closestNeighbours = 5;


            InitializeComponent();
            DoubleBuffered = true;
            radius         = 5;

            searchRadius = 0;
            radiusPen    = new Pen(Color.White, 1);

            isRedsSelected = true;
            bDragFlag      = false;
            formWidth      = this.Width;
            formHeight     = this.Height;

            arRedPoints    = new List <Point>();
            isRedsSelected = true;

            arBluePoints = new List <Point>();

            isCandidateSet = false;

            Paint     += new PaintEventHandler(Form1_Paint);
            MouseDown += button1_MouseDown;


            KeyPreview = true;
            KeyDown   += new KeyEventHandler(Form1_KeyDown);
            MouseUp   += MouseUpper;

            MouseMove += new MouseEventHandler(MouseMoving);
        }
 protected virtual void CreateEventHandlers()
 {
     h1 = new MouseEventHandler(mPictureBox_MouseDown);
     h2 = new MouseEventHandler(mPictureBox_MouseUp);
     h3 = new MouseEventHandler(mPictureBox_MouseMove);
     h4 = new PaintEventHandler(mPictureBox_Paint);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Initialize a new instance of the DropDockingIndicatorsSquare class.
        /// </summary>
        /// <param name="paletteDragDrop">Drawing palette.</param>
        /// <param name="renderer">Drawing renderer.</param>
        /// <param name="showLeft">Show left hot area.</param>
        /// <param name="showRight">Show right hot area.</param>
        /// <param name="showTop">Show top hot area.</param>
        /// <param name="showBottom">Show bottom hot area.</param>
        /// <param name="showMiddle">Show middle hot area.</param>
        public DropDockingIndicatorsSquare(IPaletteDragDrop paletteDragDrop,
                                           IRenderer renderer,
                                           bool showLeft, bool showRight,
                                           bool showTop, bool showBottom,
                                           bool showMiddle)
        {
            _paletteDragDrop = paletteDragDrop;
            _renderer        = renderer;

            // Initialize the drag data that indicators which docking indicators are needed
            _dragData = new RenderDragDockingData(showLeft, showRight, showTop, showBottom, showMiddle);

            // Ask the renderer to measure the sizing of the indicators that are displayed
            _renderer.RenderGlyph.MeasureDragDropDockingGlyph(_dragData, _paletteDragDrop, PaletteDragFeedback.Square);

            // Setup window so that it is transparent to the Silver color and does not have any borders etc...
            BackColor       = Color.Silver;
            ClientSize      = _dragData.DockWindowSize;
            ControlBox      = false;
            FormBorderStyle = FormBorderStyle.None;
            Location        = new Point(100, 200);
            MaximizeBox     = false;
            MinimizeBox     = false;
            MinimumSize     = Size.Empty;
            Name            = "DropIndicators";
            ShowInTaskbar   = false;
            SizeGripStyle   = SizeGripStyle.Hide;
            StartPosition   = FormStartPosition.Manual;
            Text            = "DropIndicators";
            TransparencyKey = System.Drawing.Color.Silver;
            Paint          += new PaintEventHandler(DropIndicators_Paint);
        }
Exemplo n.º 9
0
        //public frmMenu MainFormMenu { get; set; }

        private void frmSveFakture_Load(object sender, EventArgs e)
        {
            //if (MainFormMenu == null)
            //{
            //    int heigt = SystemInformation.VirtualScreen.Height;
            //    this.Height = heigt - 60;
            //    this.Location = new Point((SystemInformation.VirtualScreen.Width / 2) - 411, 5);
            //}
            //else
            //{
            int heigt = SystemInformation.VirtualScreen.Height;

            this.Height   = heigt - 140;
            this.Location = new Point((SystemInformation.VirtualScreen.Width / 2) - 411, 5);
            //}

            PaintRows(dgv);
            fillCB();
            fillDataGrid();
            DTpostavke = classDBlite.LiteSelect("SELECT * FROM postavke", "postavke").Tables[0];

            //if (DTpostavke.Rows[0]["on_off_postotak"].ToString() == "NE")
            //{
            //    txtIspisBona.Visible = false;
            //}

            Paint += new PaintEventHandler(Funkcije.Form1_Paint);
        }
Exemplo n.º 10
0
        public Game()
        {
            InitializeComponent();
            CenterToScreen();

            screenWidth            = this.Width;
            screenHeight           = this.Height;
            sceneManager           = SceneManager.GetInstance();
            sceneManager.CurrScene = new Menu();

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

            //Create Event Handler for Timer Tick. Every time timer Ticks run UpdateGame method
            Timer timer = new Timer();

            timer.Interval = 1;
            timer.Start();
            timer.Tick += new EventHandler(UpdateGame);

            //Create Event Handler for Paint run. Every time Windows says it's time to repaint the canvas, run DrawGame method
            Paint += new PaintEventHandler(DrawGame);
        }
Exemplo n.º 11
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();
        }
Exemplo n.º 12
0
 private void InitializeComponent()
 {
     colorGrid    = Color.LightGray;
     colorBg      = Color.White;
     colorAxis    = Color.Black;
     fontAxis     = new Font("Arial", 8f);
     penWidth     = 2;
     drawMode     = DGChartControl.DrawModeType.Line;
     borderTop    = 30;
     borderLeft   = 50;
     borderBottom = 50;
     borderRight  = 30;
     xRangeStart  = 0.0;
     xRangeEnd    = 100.0;
     yRangeStart  = 0.0;
     yRangeEnd    = 100.0;
     xGrid        = 10.0;
     yGrid        = 10.0;
     xLogBase     = 0;
     yLogBase     = 0;
     showData1    = true;
     showData2    = false;
     showData3    = false;
     showData4    = false;
     showData5    = false;
     colorSet1    = Color.DarkBlue;
     colorSet2    = Color.Red;
     colorSet3    = Color.Lime;
     colorSet4    = Color.Gold;
     colorSet5    = Color.Magenta;
     Resize      += new EventHandler(Chart_Resize);
     Paint       += new PaintEventHandler(Chart_Paint);
 }
Exemplo n.º 13
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Width           = Screen.GetBounds(this).Width;
            Location        = new Point(0, 0);
            TransparencyKey = BackColor;
            Paint          += new PaintEventHandler(AutoHeight);

            StatusLabel.BackColor = BackColorDefault;
            StatusLabel.Paint    += (object o, PaintEventArgs pea) =>
            {
                Graphics g     = CreateGraphics();
                SizeF    sizeF = g.MeasureString(StatusLabel.Text, TranslationFont);
                g.Dispose();
                StatusLabel.Size     = new Size((int)Math.Ceiling(sizeF.Width) + 4, (int)Math.Ceiling(sizeF.Height));
                StatusLabel.Location = new Point((Width - StatusLabel.Width) / 2, WordsTopMargin);
            };

            TextPanel.Width    = TextMaxWidth;
            TextPanel.Height   = 0;
            TextPanel.Location = new Point((Width - TextPanel.Width) / 2, WordsTopMargin);
            TextPanel.Paint   += (object o, PaintEventArgs pea) =>
            { TranslationPanel.Location = new Point(TranslationPanel.Location.X, TextPanel.Bottom + TranslationTopMargin); };

            TranslationPanel.Width    = TextMaxWidth;
            TranslationPanel.Height   = 0;
            TranslationPanel.Location = new Point((Width - TranslationPanel.Width) / 2, TranslationTopMargin);

            DicPanel.MouseLeave += HideDic;
        }
Exemplo n.º 14
0
        public Form2()
        {
            InitializeComponent();
            try
            {
                StreamReader sr = new StreamReader(path,
                                                   Encoding.Default);
                header = sr.ReadLine();
                N      = File.ReadAllLines(path).Length - 1;
                d      = new double[N];

                int    i  = 0;
                string st = sr.ReadLine();
                while ((st != null) && (i < N))
                {
                    d[i++] = Convert.ToDouble(st);
                    st     = sr.ReadLine();
                }
                sr.Close();
                Paint += new PaintEventHandler(Graf);
            }
            catch (FileNotFoundException ex)
            {
                MessageBox.Show(ex.Message + "\n" + "(" + ex.GetType().ToString() + ")", "График", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "График", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 15
0
 private void frmOdabir_Load(object sender, EventArgs e)
 {
     DTBojeForme      = classDBlite.LiteSelect("SELECT * FROM FormColors", "FormColors").Tables[0];
     lblOdDatuma.Text = "Od datuma: " + OD_datuma;
     lblDodatuma.Text = "Do datuma: " + DO_datuma;
     Paint           += new PaintEventHandler(Funkcije.Form1_Paint);
 }
Exemplo n.º 16
0
 public MButton()
 {
     BackColor = Color.FromArgb(0, 128, 255);
     Font      = AppControl.AppFont;
     Cursor    = Cursors.Hand;
     Paint    += new PaintEventHandler(MyPaint);
 }
Exemplo n.º 17
0
        public AreaSelectForm(AreaSelectFormTooltip asft, Actions actions)
        {
            this.asft    = asft;
            this.actions = actions;

            InitializeComponent();
            WindowState      = FormWindowState.Minimized;
            asft.WindowState = FormWindowState.Minimized;
            Rectangle bounds = Screen.PrimaryScreen.Bounds;

            using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
                using (Graphics g = Graphics.FromImage(bitmap))
                {
                    g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty, bounds.Size);


                    bgimage = new Bitmap(bitmap);
                    this.pictureBox1.Image = bgimage;
                    WindowState            = FormWindowState.Maximized;
                    asft.WindowState       = FormWindowState.Normal;
                }
            Paint += new PaintEventHandler(AreaSelectForm_Paint);

            pictureBox1.Paint += new PaintEventHandler(pictureBox1_Paint);

            RetTeszt = "keksz";
        }
Exemplo n.º 18
0
        public void ByteViewer_OnPaint_InvokeWithHandle_CallsPaint()
        {
            using var image         = new Bitmap(10, 10);
            using Graphics graphics = Graphics.FromImage(image);
            var eventArgs = new PaintEventArgs(graphics, Rectangle.Empty);

            using var control = new SubByteViewer();
            int callCount             = 0;
            PaintEventHandler handler = (sender, e) =>
            {
                Assert.Same(control, sender);
                Assert.Same(eventArgs, e);
                callCount++;
            };

            // Call with handler.
            control.Paint += handler;
            control.OnPaint(eventArgs);
            Assert.Equal(1, callCount);
            Assert.False(control.IsHandleCreated);

            // Remove handler.
            control.Paint -= handler;
            control.OnPaint(eventArgs);
            Assert.Equal(1, callCount);
            Assert.False(control.IsHandleCreated);
        }
Exemplo n.º 19
0
 public ImageRendererControl()
 {
     Size           = new Size(800, 700);
     DoubleBuffered = true;
     ResizeRedraw   = true;
     Paint         += new PaintEventHandler(OnPaint);
 }
Exemplo n.º 20
0
        public Form1()
        {
            InitializeComponent();
            SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
            Text            = "JDDestroyer";
            FormBorderStyle = FormBorderStyle.FixedDialog;
            MaximizeBox     = false;
            MinimizeBox     = false;
            StartPosition   = FormStartPosition.CenterScreen;
            int ScreenHeight = (int)(Screen.PrimaryScreen.Bounds.Height * 0.6);

            ClientSize = new Size(ScreenHeight, ScreenHeight);
            Timer GameTimer = new Timer
            {
                Interval = 10
            };

            GameTimer.Tick += new EventHandler(Tick);
            GameTimer.Start();
            Load         += new EventHandler(Init);
            Paint        += new PaintEventHandler(FormPaint);
            this.KeyDown += new KeyEventHandler(Form1_KeyDown);
            this.KeyUp   += new KeyEventHandler(Form1_KeyUp);
            Connect();
        }
        public RichTextBoxBordered()
        {
            InitializeComponent();

            Paint  += new PaintEventHandler(UserControl1_Paint);
            Resize += new EventHandler(UserControl1_Resize);
        }
 /// <summary>
 /// 增加事件
 /// </summary>
 public void AddPanelTriggerEvent()
 {
     MouseDown += new MouseEventHandler(PrintPreviewControlPanel_MouseDown);
     MouseMove += new MouseEventHandler(PrintPreviewControlPanel_MouseMove);
     MouseUp   += new MouseEventHandler(PrintPreviewControlPanel_MouseUp);
     Paint     += new PaintEventHandler(PrintPreviewControlPanel_Paint);
 }
Exemplo n.º 23
0
    public Simple()
    {
        Text = "Viewer";
        Size = new Size(250, 200);
        BackColor = System.Drawing.Color.Black;
        DoubleBuffered = true;
        //texture = new Bitmap(Image.FromFile("NeHe.bmp"));
        rx = 0;
        ry = 0;
        rz = 0;
        butdown = false;
        zoom = 0;
        trans = 0;

        oldx = 0;
        oldy = 0;

        MouseMove += new System.Windows.Forms.MouseEventHandler(OnMouseMove);
        MouseDown += new System.Windows.Forms.MouseEventHandler(OnMouseDown);
        MouseUp += new System.Windows.Forms.MouseEventHandler(OnMouseUp);

        Paint += new PaintEventHandler(OnPaint);
        ResizeEnd += new EventHandler(OnResize);
        SizeChanged += new EventHandler(OnResize);
        CenterToScreen();
    }
Exemplo n.º 24
0
        protected void Init()
        {
            SuspendLayout();
            this.DoubleBuffered = true;

            this.clientWidth  = ClientRectangle.Width;
            this.clientHeight = ClientRectangle.Height;

            this.selectedColor = Color.Red;
            this.drawStyle     = DrawStyles.HSBHue;

            bmp = new Bitmap(clientWidth, clientHeight, PixelFormat.Format32bppArgb);

            mouseMoveTimer          = new Timer();
            mouseMoveTimer.Interval = 10;
            mouseMoveTimer.Tick    += new EventHandler(MouseMoveTimer_Tick);

            ClientSizeChanged += new EventHandler(ClientSizeChanged_Event);
            MouseDown         += new MouseEventHandler(MouseDown_Event);
            MouseEnter        += new EventHandler(MouseEnter_Event);
            MouseUp           += new MouseEventHandler(MouseUp_Event);
            Paint             += new PaintEventHandler(Paint_Event);

            ResumeLayout(false);
        }
Exemplo n.º 25
0
 void InitializeComponent()
 {
     // Thread t = new Thread(UGV_Paint);
     // t.Start();
     //
     Paint += new PaintEventHandler(UGV_Paint);
 }
        void FactoryViewer_Load(object sender, EventArgs e)
        {
            // do not process if design mode
            if (this.DesignMode)
            {
                return;
            }

            _picGraphics = new PicGraphicsControl(this);

            // define event handlers
            Paint += new PaintEventHandler(FactoryViewer_Paint);

            // mouse event handling
            MouseMove  += new MouseEventHandler(FactoryViewer_MouseMove);
            MouseWheel += new MouseEventHandler(FactoryViewer_MouseWheel);
            MouseDown  += new MouseEventHandler(FactoryViewer_MouseDown);
            MouseUp    += new MouseEventHandler(FactoryViewer_MouseUp);

            // event global cotation properties notification
            PicGlobalCotationProperties.Modified += new PicGlobalCotationProperties.OnGlobalCotationPropertiesModified(PicGlobalCotationProperties_Modified);

            showCotationsToolStripMenuItem.Checked = _showCotations;
            reflectionXToolStripMenuItem.Checked   = _reflectionX;
            reflectionYToolStripMenuItem.Checked   = _reflectionY;
        }
Exemplo n.º 27
0
        public SectionYellow()
        {
            SectionRed.setTextboxSize(widthBox, 173, 21);
            SectionRed.setTextboxSize(heightBox, 173, 21);

            widthBox.Left  = 85;
            widthBox.Top   = 180;
            heightBox.Left = 85;
            heightBox.Top  = 258;

            widthBox.Text  = "10";
            heightBox.Text = "10";

            ds = new PaintEventHandler(drawSection);

            collisionList.Items.AddRange(new object[] { "Rectangle", "Circle" });
            collisionList.SelectedIndex         = 0;
            collisionList.DropDownStyle         = ComboBoxStyle.DropDownList;
            collisionList.ForeColor             = Color.White;
            collisionList.BackColor             = Color.Black;
            collisionList.Left                  = 130;
            collisionList.Top                   = 104;
            collisionList.Size                  = new Size(83, 19);
            collisionList.SelectedIndexChanged += new EventHandler(changedList);
        }
Exemplo n.º 28
0
 private void button1_Click(object sender, EventArgs e)
 {
     // イベントハンドラの登録と再描画;;
     Paint -= new PaintEventHandler(Form1_Paint);
     Paint += new PaintEventHandler(Form1_Paint);
     Invalidate();
 }
Exemplo n.º 29
0
 public ColorExample()
 {
     Text = "Colors";
     Size = new Size(360, 120);
     Paint += new PaintEventHandler(OnPaint);
     CenterToScreen();
 }
Exemplo n.º 30
0
        public flowindow()
        {
            InitializeComponent();

            DoubleBuffered        = true;
            FileParser.fileFolder = "Assets\\Levels\\";
            method = new PuzzleRetriever("4x6.txt", PuzzleRetriever.RetrievalMethod.FromFile, colors.Length - 1);

            // timer setup
            ticker          = new Timer();
            ticker.Interval = 1;
            ticker.Tick    += new EventHandler(OnTick);
            ticker.Start();

            FontSetup();
            ReplaceEdgeDockedControls();

            // events
            Paint     += new PaintEventHandler(OnPaint);
            Resize    += new EventHandler(OnResize);
            MouseMove += new MouseEventHandler(OnMouseMove);
            MouseDown += new MouseEventHandler(OnMouseDown);
            MouseUp   += new MouseEventHandler(OnMouseUp);
            KeyPress  += new KeyPressEventHandler(OnKeyPress);

            OnResize(this, new EventArgs());

            currentPuzzle = method.Next();

            mouseX = 0;
            mouseY = 0;
        }
Exemplo n.º 31
0
        public void Test01(PictureBox pic)
        {
            //取pic作为画布尺寸
            _canvaswidth  = pic.Width;
            _canvasheight = pic.Height;

            PaintEventHandler callback = (s, e) =>
            {
                e.Graphics.Clear(System.Drawing.Color.Black);
                _draw01(e.Graphics);
            };

            //指定pic的刷新函数
            pic.Paint += callback;

            //刷新pic,这会调用paint函数
            pic.Refresh();

            pic.Paint  -= callback;
            updateevent = () =>
            {
                startAngle += 3;
                pic.Paint  += callback;
                pic.Refresh();

                pic.Paint -= callback;
            };
        }
Exemplo n.º 32
0
        private void frmSobe_Load(object sender, EventArgs e)
        {
            DTBojeForme = classDBlite.LiteSelect("SELECT * FROM FormColors", "FormColors").Tables[0];

            DataTable DTtip_sobe = RemoteDB.select("SELECT * FROM tip_sobe", "tip_sobe").Tables[0];

            cbTipSoba.DataSource    = DTtip_sobe;
            cbTipSoba.DisplayMember = "Tip";
            cbTipSoba.ValueMember   = "id";

            //fill tip sobe
            //fill zemlja
            DataTable DT_zemlja = RemoteDB.select("SELECT * FROM tip_sobe WHERE aktivnost='1'", "tip_sobe").Tables[0];

            DataTable DTSK = new DataTable("tip_sobe");

            DTSK.Columns.Add("id", typeof(string));
            DTSK.Columns.Add("Tip", typeof(string));
            for (int i = 0; i < DT_zemlja.Rows.Count; i++)
            {
                DTSK.Rows.Add(DT_zemlja.Rows[i]["id"], DT_zemlja.Rows[i]["tip"]);
            }

            tip_sobe.DataSource       = DTSK;
            tip_sobe.DataPropertyName = "Tip";
            tip_sobe.DisplayMember    = "Tip";
            tip_sobe.HeaderText       = "Tip";
            tip_sobe.Name             = "Tip";
            tip_sobe.Resizable        = System.Windows.Forms.DataGridViewTriState.True;
            tip_sobe.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            tip_sobe.ValueMember      = "id";

            SetSobe();
            Paint += new PaintEventHandler(Funkcije.Form1_Paint);
        }
Exemplo n.º 33
0
 private void button1_Click(object sender, EventArgs e)
 {
     Paint -= new PaintEventHandler(Form1_Paint);
     // Paintイベントの再登録
     Paint += new PaintEventHandler(Form1_Paint);
     Invalidate(); // 画面の再描画 → Paintイベントを追加しているのでイベント発火しForm1_Paintが追加される。
 }
Exemplo n.º 34
0
    public MForm5()
    {
        Text = "You know I'm No Good";
        Size = new Size(380, 450);

        Paint += new PaintEventHandler(OnPaint);
        CenterToScreen();
    }
Exemplo n.º 35
0
 public ImageExample()
 {
     Text = "Image";
     loadImage();
     ClientSize = new Size(image.Width, image.Height);
     Paint += new PaintEventHandler(OnPaint);
     CenterToScreen();
 }
Exemplo n.º 36
0
    public MForm2()
    {
        Text = "Colors";
        Size = new Size(360, 300);

        Paint += new PaintEventHandler(OnPaint);

        CenterToScreen();
    }
Exemplo n.º 37
0
    public MForm3()
    {
        Text = "Hatches";
        Size = new Size(360, 300);

        Paint += new PaintEventHandler(OnPaint);

        CenterToScreen();
    }
Exemplo n.º 38
0
    public MForm4()
    {
        Text = "Gradients";
        Size = new Size(350, 350);

        Paint += new PaintEventHandler(OnPaint);

        CenterToScreen();
    }
Exemplo n.º 39
0
    public MForm6()
    {
        Text = "Red Rock";
        loadImage();
        ClientSize = new Size(castle.Width, castle.Height);

        Paint += new PaintEventHandler(OnPaint);

        CenterToScreen();
    }
Exemplo n.º 40
0
	public MainForm ()
	{
		// 
		// MainForm
		// 
		Location = new Point (125, 100);
		Size = new Size (550, 270);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #82167";
		Load += new EventHandler (MainForm_Load);
		Paint += new PaintEventHandler (MainForm_Paint);
	}
Exemplo n.º 41
0
	public MainForm ()
	{
		// 
		// MainForm
		// 
		ClientSize = new Size (350, 350);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #82202";
		Load += new EventHandler (MainForm_Load);
		Paint += new PaintEventHandler (MainForm_Paint);
	}
Exemplo n.º 42
0
	public InvalidateForm ()
	{
		timer = new Timer ();
		timer.Interval = 500;
		timer.Tick += new EventHandler (TimerTick);
		timer.Enabled = true;

		BackColor = Color.Blue;

		Paint += new PaintEventHandler (PaintHandler);
		Click += new EventHandler (ClickHandler);
	}
Exemplo n.º 43
0
    // The Constructor for our application
    MainForm()
    {
        SuspendLayout();
        Size = new Size(350, 200);
        AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange;
        Text = "Graphic Input Output";
        CenterToScreen();
        ResumeLayout(false);

        // Create OnPaint Event Handler: fired every time Windows says it's time to repaint the canvas
        Paint += new PaintEventHandler(OnPaint);
    }
Exemplo n.º 44
0
	public MainForm ()
	{
		// 
		// MainForm
		// 
		ClientSize = new Size (270, 270);
		Location = new Point (275, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #338233";
		Load += new EventHandler (MainForm_Load);
		Paint += new PaintEventHandler (MainForm_Paint);
	}
Exemplo n.º 45
0
        internal virtual void Init(int width, int height)
        {
            formWidth = width;
            formHeight = height;
            Location = new Point((MainForm.Instance.Width - Width) / 2, (MainForm.Instance.Height - Height) / 2);

            if (Controls.ContainsKey("bitmapButtonClose"))
            {
                Controls["bitmapButtonClose"].Location = new Point(Width - 35, 2);
            }
            flows = new List<FlowData>();
            Paint += new PaintEventHandler(BasePanel_Paint);
        }
Exemplo n.º 46
0
    MainForm()
    {
        Text = "Speed Racer";        // for the window's title
        Size = new Size(450, 450);
        MaximizeBox = false;
        FormBorderStyle = FormBorderStyle.FixedSingle;
        SetStyle(ControlStyles.UserPaint, true);
        SetStyle(ControlStyles.AllPaintingInWmPaint, true);
        SetStyle(ControlStyles.DoubleBuffer, true);

        Paint += new PaintEventHandler(OnPaint);    // creates an "alarm" that goes off every 8 milliseconds

        car1 = new Car(12, 5, Brushes.DeepPink, 3);     // x position, y position, brush, speed
    }
Exemplo n.º 47
0
    MainForm()
    {
        Text = "Mmmmm Pizza";        // for the window's title
        Size = new Size(600, 450);
        MaximizeBox = false;
        FormBorderStyle = FormBorderStyle.FixedSingle;
        SetStyle(ControlStyles.UserPaint, true);
        SetStyle(ControlStyles.AllPaintingInWmPaint, true);
        SetStyle(ControlStyles.DoubleBuffer, true);

        Paint += new PaintEventHandler(OnPaint);
        timer.Interval = 10;
        timer.Tick += new EventHandler(Ticker);
        timer.Start();
    }
Exemplo n.º 48
0
 public BoardSimple()
 {
     BackColor = Color.Black;
     this.ClientSize = new Size(width, height);
     try {
         dot   = new Bitmap("dot.png");
         apple = new Bitmap("apple.png");
         head  = new Bitmap("head.png");
     } catch (Exception e) {
         Console.WriteLine(e.Message);
         Environment.Exit(1);
     }
     for (int z = 0; z < dots; z++) {
         x[z] = startPos - z * dotSize;
         y[z] = startPos;
     }
     Paint += new PaintEventHandler(this.OnPaint);
 }
Exemplo n.º 49
0
    public MForm2()
    {
        Text = "ColorDialog";

        color = Color.Blue;

        toolbar = new ToolBar();
        open = new ToolBarButton();

        toolbar.Buttons.Add(open);
        toolbar.ButtonClick += new ToolBarButtonClickEventHandler(OnClicked);

        LocateRect();

        SetStyle (ControlStyles.ResizeRedraw, true);
        Controls.Add(toolbar);
        Paint += new PaintEventHandler(OnPaint);

        CenterToScreen();
    }
Exemplo n.º 50
0
    public ImageDragDrop()
    {
        ClientSize = new Size(350, 250);
        Text = "Dragging Image";
        Paint += new PaintEventHandler(OnPaint);

        isDragging = false;
        dropRect = new Rectangle(10, 10, 200, 160);
        brush = Brushes.Gray;
        picBox = new PictureBox();
        loadImage();

        picBox.Parent = this;
        picBox.Location = new Point(100, 50);
        picBox.Size = new Size(image.Width, image.Height);
        picBox.Image = image;
        picBox.Cursor = Cursors.Hand;

        picBox.MouseDown += new MouseEventHandler(OnMouseDown);
        picBox.MouseUp += new MouseEventHandler(OnMouseUp);
        picBox.MouseMove += new MouseEventHandler(OnMouseMove);

        CenterToScreen();
    }
Exemplo n.º 51
0
Arquivo: test.cs Projeto: mono/gert
	public MainForm ()
	{
		Paint += new PaintEventHandler (MainForm_Paint);
	}
Exemplo n.º 52
0
 public void InitializeComponent()
 {
     BackColor = Color.White;
     Name = "DiagnosticReportControl";
     Paint += new PaintEventHandler(DiagnosticReportControl_Paint);
 }
Exemplo n.º 53
0
    private void initGame()
    {
        dots = 3;

        for (int z = 0; z < dots; z++) {
            x[z] = 50 - z * 10;
            y[z] = 50;
        }

        locateApple();
        KeyUp += new KeyEventHandler(OnKeyUp);

        timer = new Timer(this.components);
        timer.Enabled = true;
        timer.Interval = 100;
        timer.Tick += new System.EventHandler(this.OnTick);

        Paint += new PaintEventHandler(this.OnPaint);
    }
Exemplo n.º 54
0
	private FormsHello()
	{
		// Force the entire form to repaint when it is resized.
		SetStyle(ControlStyles.ResizeRedraw, true);

		// Set some initial form properties.
		Size = new Size(400, 270);
		Text = "Forms Hello";

		// Create a button control on the form.
		button = new Button();
		button.Text = "Click Me!";
		button.Location = new Point(30, 130);
		Controls.Add(button);
		
		// Create a progress bar control
		progress = new ProgressBar();
		progress.Location = new Point(30, 175);
		progress.Anchor = AnchorStyles.Top |
						  AnchorStyles.Left |
						  AnchorStyles.Right;
		Controls.Add(progress);

		// Create a label and dock it to the bottom.
		Label label = new Label();
		label.Text = "This is a label, docked to the bottom ...";
		label.BackColor = Color.White;
		label.Dock = DockStyle.Bottom;
		Controls.Add(label);

		// Hook up interesting events.
		Paint += new PaintEventHandler(HandlePaint);
		button.Click += new EventHandler(HandleClick);

		// Create a scrollbar control.
		scrollbar = new HScrollBar();
		scrollbar.Dock = DockStyle.Bottom;
		Controls.Add(scrollbar);
		scrollbar = new VScrollBar();
		scrollbar.Dock = DockStyle.Right;
		Controls.Add(scrollbar);

		// Create a toolbar control and some toolbar buttons.
		toolbar = new ToolBar();
		toolbar.Buttons.Add("Hello");
		ToolBarButton tbb = new ToolBarButton();
		tbb.Style = ToolBarButtonStyle.Separator;
		toolbar.Buttons.Add(tbb);
		tbb = new ToolBarButton("World!");
		toolbar.Buttons.Add(tbb);
		toolbar.Appearance = ToolBarAppearance.Flat;
		toolbar.BorderStyle = BorderStyle.FixedSingle;
		Controls.Add(toolbar);

		// Create another toolbar.
		// This reveals some layout bugs, so
		// the Controls.Add is commented out
		// to keep the sample looking good
		toolbar = new ToolBar();
		toolbar.Buttons.Add("This one's");
		tbb = new ToolBarButton();
		tbb.Style = ToolBarButtonStyle.Separator;
		toolbar.Buttons.Add(tbb);
		tbb = new ToolBarButton("left docked.");
		tbb.Style = ToolBarButtonStyle.DropDownButton;
		toolbar.Buttons.Add(tbb);
		toolbar.BorderStyle = BorderStyle.Fixed3D;
		toolbar.Dock = DockStyle.Left;
		//toolbar.DropDownArrows = false;
		//Controls.Add(toolbar);

		checkbox=new CheckBox();
		checkbox.Location=new Point(70,95);
		checkbox.Text="Any Good ?";
		checkbox.Checked=true;
		checkbox.CheckStateChanged += new EventHandler(HandleCheck);
		Controls.Add(checkbox);
	}