예제 #1
0
 // Меняем цвет кнопки,ободка при наезде мышки на кнопку
 private void button1_MouseEnter(object sender, System.EventArgs e)
 {
     pen         = new Pen(Color.Red, 10);
     brushinside = new SolidBrush(Color.Yellow);
     // Вызываем здесь перерисовку нашей кнопки
     button1.Invalidate();
 }
예제 #2
0
        private Button newButton(string name, string text)
        {
            System.Windows.Forms.Button b = new System.Windows.Forms.Button();

            b.ForeColor = System.Drawing.Color.White;
            b.BackColor = System.Drawing.Color.FromArgb(95, 95, 95);
            b.FlatAppearance.BorderColor        = System.Drawing.Color.FromArgb(31, 31, 31);
            b.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(62, 62, 62);
            b.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(127, 127, 127);
            b.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            b.UseVisualStyleBackColor = false;

            b.Font = new System.Drawing.Font(
                "Microsoft Sans Serif",
                9.25F, System.Drawing.FontStyle.Bold,
                System.Drawing.GraphicsUnit.Point,
                0);

            b.Anchor   = System.Windows.Forms.AnchorStyles.None;
            b.TabIndex = 1;

            b.AutoSize     = true;
            b.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            b.Padding      = new System.Windows.Forms.Padding(0, 0, 0, 0);
            b.Margin       = new System.Windows.Forms.Padding(0);

            b.Name = name;
            b.Text = text;

            b.Invalidate();
            b.Update();
            b.Click += new System.EventHandler(this.button_click);
            return(b);
        }
예제 #3
0
        //rofl this tooooooooooooo
        protected void _OnClientSizeChange(System.Object sender, System.EventArgs e)
        {
            int xSize = this.Width;
            int ySize = this.Height;

            System.Windows.Forms.PictureBox pictureBox =
                (System.Windows.Forms.PictureBox)tabs.Controls[currentTab].Controls[0];
            // if( !IsCloned )
            {
                this.closeButton.Location = new Point(xSize - 100, ySize - 130);
                this.prevButton.Location  = new Point((xSize / 2) - 80, ySize - 150);
                this.nextButton.Location  = new Point((xSize / 2) + 10, ySize - 150);

                this.tabs.Size = new Size((xSize) - 100, (ySize) - 200);
                FormTab        = tabs.Size;
                TabLocation    = tabs.Location;

                //change picturebox sizes
                for (int i = 0; i < tabs.TabCount; i++)
                {
                    pictureBox      = (System.Windows.Forms.PictureBox)tabs.Controls[i].Controls[0];
                    pictureBox.Size =
                        new Size(tabs.Width - 50, tabs.Height - 100);

                    //change picturebox locations
                    pictureBox.Location = new Point(20, 20);
                }
            }
            //else
            {
                this.closeButton.Location = new Point(xSize - 100, ySize - 130);
                this.prevButton.Location  = new Point((xSize / 2) - 80, ySize - 150);
                this.nextButton.Location  = new Point((xSize / 2) + 10, ySize - 150);

                this.tabs.Size = new Size((xSize) - 100, (ySize) - 200);

                System.Windows.Forms.PictureBox clonedBox =
                    (System.Windows.Forms.PictureBox)tabs.Controls[currentTab].Controls[1];

                //change both pictureboxs' size
                //pictureBox
                pictureBox.Size =
                    new Size(Convert.ToInt32(tabs.Width / 2.2d), tabs.Height - 100);
                //clonedBox
                clonedBox.Size = pictureBox.Size;

                //change both pictureboxs' location
                //pictureBox
                pictureBox.Location = new Point(20, 20);
                //clonedBox
                clonedBox.Location = new Point(pictureBox.Location.X + pictureBox.Width + 10,
                                               pictureBox.Location.Y);

                //closebutton for clone
                cloneClosebtn.Location = new Point(clonedBox.Location.X + clonedBox.Width + 10
                                                   , clonedBox.Location.Y + 5);
                cloneClosebtn.Invalidate();
            }
        }
예제 #4
0
 private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
 {
     if (clicked == true)
     {
         Pen pen = new Pen(Brushes.Red, 1);
         pictureBox1.CreateGraphics().DrawRectangle(pen, previousPoint.X, previousPoint.Y, Cursor.Position.X, Cursor.Position.Y);
         pictureBox1.Invalidate();
     }
     foreach (Rectangle box in boxesToDraw)
     {
         if (e.Location.X == box.X && e.Location.Y == box.Y)
         {
             deleteButton           = new System.Windows.Forms.Button();
             deleteButton.Location  = new Point(box.X, box.Y);
             deleteButton.BackColor = Color.Red;
             deleteButton.Text      = "x";
             deleteButton.Width     = 40;
             deleteButton.Height    = 40;
             deleteButton.Invalidate();
         }
     }
 }
예제 #5
0
 private void UpdateButtonEnabled(Button button, Command command)
 {
     button.Enabled = command != null && command.Enabled;
     //doesn't work becuase the forecolor is ignored when disabled...
     button.ForeColor = button.Enabled ? _enabledToolbarColor : _disabledToolbarColor;//.DimGray;
     button.Invalidate();
 }
예제 #6
0
 private void OnBtnMouseEnter(object sender, System.EventArgs e)
 {
     m_state = State.Hot;
     m_btn.Invalidate();
 }
예제 #7
0
 private void UpdateButtonEnabled(Button button, Command command)
 {
     var enabled = command != null && command.Enabled;
     // DuplicatePage and DeletePage are a bit tricky to get right.
     // See https://silbloom.myjetbrains.com/youtrack/issue/BL-2183.
     if(enabled && command.Implementer != null)
     {
         var target = command.Implementer.Target as EditingModel;
         if(target != null)
         {
             if(command is DuplicatePageCommand)
                 enabled = target.CanDuplicatePage;
             else if(command is DeletePageCommand)
                 enabled = target.CanDeletePage;
         }
     }
     //doesn't work because the forecolor is ignored when disabled...
     var foreColor = enabled ? _enabledToolbarColor : _disabledToolbarColor; //.DimGray;
     // BL-2338: signficant button flashing is apparently caused by setting these and
     // invalidating when nothing actually changed. So only do it if something DID change.
     if(enabled != button.Enabled || button.ForeColor != foreColor)
     {
         button.Enabled = enabled;
         button.ForeColor = foreColor;
         button.Invalidate();
     }
 }