Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 01:16

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Custom Button

Discussion on Custom Button within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
'Aleo's Avatar
 
elite*gold: 175
Join Date: Jun 2013
Posts: 157
Received Thanks: 44
Question Custom Button

Hallo,

Ich habe mich einmal an einem eigen Button versucht, jedoch habe ich nach kurzer Zeit einem Problem in die Augen schauen müssen. Ich habe hier den Code von meinem Steuerelement in C#.
[Spoiler]
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace akButton
{
    public partial class Button : UserControl
    {
        public Color _fcolor = Color.Blue;
        public Color _bcolor = Color.Green;
        public State _state
        {
            get { return _state; }

            set
            {
                _state = value;
                this.Refresh();
            }
        }

        public Button()
        {
            InitializeComponent();
            
        }

        public enum State
        {
            Normal, Hover, MouseDown
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            System.Drawing.Pen _pen = new Pen(_fcolor);
            System.Drawing.Rectangle _rec = new Rectangle();
            System.Drawing.Drawing2D.LinearGradientBrush _brush = null;

            switch (_state)
            {
                case State.Normal:
                    _rec = new Rectangle(0, 0, this.Width - 1, this.Height - 1);
                    _brush = new System.Drawing.Drawing2D.LinearGradientBrush(_rec, _fcolor, _bcolor, 90, true);
                    break;

                case State.Hover:
                    _rec = new Rectangle(0, 0, this.Width - 1, this.Height - 1);
                    _brush = new System.Drawing.Drawing2D.LinearGradientBrush(_rec, _fcolor, Color.Red, 90, true);
                    break;
            }


            e.Graphics.DrawRectangle(_pen, _rec);
            e.Graphics.FillRectangle(_brush, _rec);
            _pen.Dispose();
        }

        private void Button_MouseHover(object sender, EventArgs e)
        {
            _state = State.Hover;
            this.Refresh();
        }
    }
}
[Spoiler]
Wenn ich versuche die .dll in ein visual studio projekt einzubinden, stürtzt mein VS 2012 sofort ab.

Ich würde mich über hilfreiche Antworten freuen.
'Aleo is offline  
Reply


Similar Threads Similar Threads
[B] Push Button [S] 10 e*gold/Button; 25 e*g/psd+Button
09/20/2013 - elite*gold Trading - 4 Replies
Moin, Hier könnt ihr folgenden Push Button kaufen: http://i.epvpimg.com/YlrYe.jpg Pro Button wären das 10e*g, pro Button mit .psd dazu 25e*g. Wenn ihr einen Button kaufen wollt, schreibt mir eine PN, damit ich den Namen ändern kann, alles hochladen kann und euch dann per Treasure schicken kann. ;) Schrift kann auch geändert werden. Dazu einfach in der PN schreiben, welche Schrift ihr haben wollt^^
Beta-Max Online ~ 120 CAP ~ D13 ~ Custom Events ~ Custom Quests ~ Custom Areas
03/19/2012 - SRO PServer Advertising - 6 Replies
Fantastic Server. If reliablility is what you want then Beta-Max is for you. Unique PVP Battles - Pets - Items - Quests - Jobs - Wonga and so much more Server Details: Level Cap: 120 Skill Cap: 120 Chinese Mastery Cap: 360 European Mastery Cap: 240 Item Degree: 13th Degree Active Areas: All (Including Jupiter)



All times are GMT +1. The time now is 01:16.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.