Мои вопросы по C#

Discussion in 'Болталка' started by X-Venom, 24 Apr 2011.

  1. X-Venom

    X-Venom Banned

    Joined:
    29 Apr 2008
    Messages:
    569
    Likes Received:
    365
    Reputations:
    21
    добрый день
    помогите найти исходники следующих программ:

    пинг-понг

    калькулятор. нужна только функция вычисления логарифма

    текстовый редактор я нашел.
     
    #1 X-Venom, 24 Apr 2011
    Last edited: 24 Apr 2011
  2. X-Venom

    X-Venom Banned

    Joined:
    29 Apr 2008
    Messages:
    569
    Likes Received:
    365
    Reputations:
    21
    ПОМОГИТЕ СКОМПИЛИРОВАТЬ

    как его скомпилировать? в вижуал студие создаю windows forms application
    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    
    namespace WindowsApplication3
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
                this.txtSize.KeyPress += new KeyPressEventHandler(txtSize_KeyPress);
                this.txtSize.Validating += new CancelEventHandler(txtSize_Validating);
                this.rtfText.LinkClicked += new LinkClickedEventHandler(rtfText_LinkClicked);
            }
    
            void rtfText_LinkClicked(object sender, LinkClickedEventArgs e)
            {
                // открыть браузер (по умолчанию) и перейти по ссылке
                System.Diagnostics.Process.Start(e.LinkText); 
            }
    
            private void txtSize_Validating(object sender, CancelEventArgs e)
            {
                TextBox txt = (TextBox)sender;
                
                ApplyTextSize(txt.Text);
                this.rtfText.Focus();
            }
    
            private void txtSize_KeyPress(object sender, KeyPressEventArgs e)
            {
                if ((e.KeyChar < 48 || e.KeyChar > 57) && e.KeyChar != 8 && e.KeyChar != 13)
                {
                    e.Handled = true;
                }
                else if (e.KeyChar == 13)
                {
                    TextBox txt = (TextBox)sender;
                    if (txt.Text.Length > 0)
                        ApplyTextSize(txt.Text);
                    e.Handled = true;
                    this.rtfText.Focus();
                }
            }
    
            private void ApplyTextSize(string text)
            {
                float newSize = Convert.ToSingle(text);
                FontFamily currentFontFamily;
                Font newFont;
    
                currentFontFamily = this.rtfText.SelectionFont.FontFamily;
                newFont = new Font(currentFontFamily, newSize);
    
                this.rtfText.SelectionFont = newFont;
            }
    
            private void btnBold_Click(object sender, EventArgs e)
            {
                Font oldFont, newFont;
    
                oldFont = this.rtfText.SelectionFont;
                if (oldFont.Bold == true)
                    // если уже жирный то убираем выделение
                    newFont = new Font(oldFont, oldFont.Style & ~FontStyle.Bold);
                else newFont = new Font(oldFont, oldFont.Style | FontStyle.Bold); // выделяем жирным
    
                this.rtfText.SelectionFont = newFont;
                this.rtfText.Focus();
            }
    
            private void btnItalic_Click(object sender, EventArgs e)
            {
                Font oldFont, newFont;
    
                oldFont = this.rtfText.SelectionFont;
                if (oldFont.Italic == true)
                    newFont = new Font(oldFont, oldFont.Style & ~FontStyle.Italic);
                else newFont = new Font(oldFont, oldFont.Style | FontStyle.Italic); 
    
                this.rtfText.SelectionFont = newFont;
                this.rtfText.Focus();
            }
    
            private void btnUnderline_Click(object sender, EventArgs e)
            {
                Font oldFont, newFont;
    
                oldFont = this.rtfText.SelectionFont;
                if (oldFont.Underline == true)
                    newFont = new Font(oldFont, oldFont.Style & ~FontStyle.Underline);
                else newFont = new Font(oldFont, oldFont.Style | FontStyle.Underline); 
    
                this.rtfText.SelectionFont = newFont;
                this.rtfText.Focus();
            }
    
            private void btnCenter_Click(object sender, EventArgs e)
            {
                if (this.rtfText.SelectionAlignment == HorizontalAlignment.Center)
                    this.rtfText.SelectionAlignment = HorizontalAlignment.Left;
                else this.rtfText.SelectionAlignment = HorizontalAlignment.Center;
                this.rtfText.Focus();
            }
    
            private void btnLoad_Click(object sender, EventArgs e)
            {
                try
                {
                    this.rtfText.LoadFile("C:\\example.txt");
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.Message);
                }
            }
    
            private void btnSave_Click(object sender, EventArgs e)
            {
                try
                {
                    this.rtfText.SaveFile("C:\\example.txt");
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.Message);
                }
            }
        }
    }
    скрин ошибок

    [​IMG]
     
  3. CodeSender:)

    CodeSender:) Elder - Старейшина

    Joined:
    29 Jul 2010
    Messages:
    245
    Likes Received:
    115
    Reputations:
    23
    Ну снеси метод диспоза, чо...
    проект сам выложи
     
    #3 CodeSender:), 24 Apr 2011
    Last edited: 24 Apr 2011
Loading...
Similar Threads - вопросы
  1. Shawn1x
    Replies:
    5
    Views:
    1,952
  2. G0mer
    Replies:
    1
    Views:
    1,272