Суббота, 17 Августа 2019, 17:41

Приветствую Вас Гость

[ Новые сообщения · Игроделы · Правила · Поиск ]
  • Страница 4 из 4
  • «
  • 1
  • 2
  • 3
  • 4
Форум игроделов » Программирование » Общие обсуждения программистов » На каких языках программирования пишете?
На каких языках программирования пишете?
-Mikle-Дата: Среда, 29 Мая 2013, 13:57 | Сообщение # 61
Изобретатель велосипедов
Сейчас нет на сайте
Цитата (First)
как сделать, что она становилась ярче

Просто же - замени в "Color.FromArgb(a, 0, 0, 0)" нули на нужный тебе цвет, к которому должно стремиться, например "Color.FromArgb(a, 255, 255, 255)".

Простой пример на VB6:


Простой пример на C++:
UndeadДата: Среда, 29 Мая 2013, 14:12 | Сообщение # 62
NeoAxis User
Сейчас нет на сайте
Жуткий костыль, но пока ещё работает biggrin
Код
    public sealed class DataBlock
         {
         public sealed class Attribute
             {
             internal string name;
             internal string value;
             public string Name
                 {
                 get
                     {
                     return name;
                     }
                 }
             public string Value
                 {
                 get
                     {
                     return value;
                     }
                 }
             }
         string name;
         string info;
         DataBlock parent;
         List<DataBlock.Attribute> attributes = new List<DataBlock.Attribute>();
         ReadOnlyCollection<DataBlock.Attribute> attributesAsReadOnly;
         List<DataBlock> children = new List<DataBlock>();
         ReadOnlyCollection<DataBlock> childrenAsReadOnly;
        public string Name
             {
             get
                 {
                 return name;
                 }
             set
                 {
                 if( name == value )
                     return;
                 name = value;
                 }
             }
        public string Info
             {
             get
                 {
                 return info;
                 }
             set
                 {
                 info = value;
                 }
             }
         public DataBlock Parent
             {
             get
                 {
                 return parent;
                 }
             }
         public IList<DataBlock.Attribute> Attributes
             {
             get
                 {
                 return attributesAsReadOnly;
                 }
             }
         public IList<DataBlock> Children
             {
             get
                 {
                 return childrenAsReadOnly;
                 }
             }
         public DataBlock()
             {
             attributesAsReadOnly = new ReadOnlyCollection<Attribute>(attributes);
             childrenAsReadOnly = new ReadOnlyCollection<DataBlock>(children);
             }
         public DataBlock(string _name)
             {
             attributesAsReadOnly = new ReadOnlyCollection<Attribute>(attributes);
             childrenAsReadOnly = new ReadOnlyCollection<DataBlock>(children);
             name = _name;
             }
         public DataBlock(string _name, string _info)
             {
             attributesAsReadOnly = new ReadOnlyCollection<Attribute>(attributes);
             childrenAsReadOnly = new ReadOnlyCollection<DataBlock>(children);
             name = _name;
             Info = _info;
             }
         public DataBlock FindChild(string name)
             {
             for( int n = 0; n < children.Count; n++ )
                 {
                 DataBlock child = children[n];
                 if( child.name == name )
                     return child;
                 }
             return null;
             }
         public DataBlock AddChild(string _name,string _info)
             {
             if( string.IsNullOrEmpty(_name) )
                 return null;
             DataBlock child = new DataBlock();
             child.parent = this;
             child.name = _name;
             child.info = _info;
             children.Add(child);
             return child;
             }
         public DataBlock AddChild(string _name)
             {
             return AddChild(_name, "");
             }
         public DataBlock AttachChild(DataBlock child)
             {
             child.parent = this;
             children.Add(child);
             return child;
             }
         public void DeleteChild(DataBlock child)
             {
             children.Remove(child);
             child.parent = null;
             child.name = "";
             child.info = "";
             child.children = null;
             child.attributes = null;
             }
         public void DetachChild(DataBlock child)
             {
             if( child.parent != this )
                 return;
             children.Remove(child);
             child.parent = null;
             }
         public string GetAttribute(string name, string defaultValue)
             {
             for( int n = 0; n < attributes.Count; n++ )
                 {
                 Attribute attribute = attributes[n];
                 if( attribute.Name == name )
                     return attribute.Value;
                 }
             return defaultValue;
             }
         public string GetAttribute(string name)
             {
             return GetAttribute(name, "");
             }
         public bool IsAttributeExist(string name)
             {
             for( int n = 0; n < attributes.Count; n++ )
                 {
                 Attribute attribute = attributes[n];
                 if( attribute.Name == name )
                     return true;
                 }
             return false;
             }
         public void SetAttribute(string name, string value)
             {
             if( string.IsNullOrEmpty(name) )
                 return;
             if( value == null )
                 return;

             for( int n = 0; n < attributes.Count; n++ )
                 {
                 Attribute attribute = attributes[n];
                 if( attribute.Name == name )
                     {
                     attribute.value = value;
                     return;
                     }
                 }
             Attribute a = new Attribute();
             a.name = name;
             a.value = value;
             attributes.Add(a);
             }
         public void DeleteAllAttributes()
             {
             attributes.Clear();
             }
         public void DeleteAttribute(String name)
             {
             for( int i = 0; i < attributes.Count; i++ )
                 {
                 if( attributes[i].Name == Name )
                     {
                     attributes.RemoveAt(i);
                     break;
                     }
                 }
             }
         public XmlDocument ToXmlDocument()
             {
             XmlDocument document = new XmlDocument();
             document.AppendChild(ToXml(document));
             return document;
             }
         public XmlElement ToXml(XmlDocument doc)
             {
             XmlElement DataBlockElement = doc.CreateElement("DataBlock");
             DataBlockElement.SetAttribute("Name", name);
             DataBlockElement.SetAttribute("Data", info);
             if( attributes.Count > 0 )
                 {
                 XmlElement AttributeRootElement = doc.CreateElement("Attributes");
                 foreach( DataBlock.Attribute a in attributes )
                     {
                     XmlElement AttributeElement = doc.CreateElement("Attribute");
                     AttributeElement.SetAttribute(a.name, a.value);
                     AttributeRootElement.AppendChild(AttributeElement);
                     }
                 DataBlockElement.AppendChild(AttributeRootElement);
                 }
             if( children.Count > 0 )
                 {
                 XmlElement childrenElement = doc.CreateElement("Children");
                 foreach( DataBlock block in children )
                     {
                     childrenElement.AppendChild(block.ToXml(doc));
                     }
                 DataBlockElement.AppendChild(childrenElement);
                 }
             return DataBlockElement;
             }
         }
     public static class DataBlockUtils
         {
         public static DataBlock GetFromXml(XmlElement dataBlockElement)
             {
             DataBlock root = new DataBlock();
             root.Name = dataBlockElement.Attributes.GetNamedItem("Name").Value;
             root.Info = dataBlockElement.Attributes.GetNamedItem("Data").Value;
             if( dataBlockElement.HasChildNodes )
                 {
                 if( dataBlockElement.GetElementsByTagName("Attributes") != null )
                     {
                     XmlElement attributes = (XmlElement)dataBlockElement.GetElementsByTagName("Attributes")[0];
                     foreach( XmlElement ae in attributes.ChildNodes )
                         {
                         root.SetAttribute(ae.Name, ae.Value);
                         }
                     }
                 if( dataBlockElement.GetElementsByTagName("Children") != null )
                     {
                     XmlElement children = (XmlElement)dataBlockElement.GetElementsByTagName("Children")[0];
                     foreach( XmlElement ae in children.ChildNodes )
                         {
                         root.AttachChild(GetFromXml(ae));
                         }
                     }
                 }

             return root;
             }
         public static void SaveToFile(string path, DataBlock block)
             {
             XmlTextWriter xtw = new XmlTextWriter(path, System.Text.Encoding.Unicode);
             xtw.Formatting = Formatting.Indented;
             block.ToXmlDocument().WriteContentTo(xtw);
             xtw.Close();
             }
         public static DataBlock LoadFormFile(string path)
             {
             XmlDocument doc = new XmlDocument();
             doc.Load(path);
             return DataBlockUtils.GetFromXml((XmlElement)doc.FirstChild);
             }
         }


Вcем зла.
FirstДата: Среда, 29 Мая 2013, 17:41 | Сообщение # 63
Уолтер Брайт
Сейчас нет на сайте
-Mikle-, спасибо. Как-то пока я логически с трудом язык понимаю dry
zisXДата: Среда, 29 Мая 2013, 18:19 | Сообщение # 64
Neto Zis
Сейчас нет на сайте
LUA -> GML -> C#

Форум игроделов » Программирование » Общие обсуждения программистов » На каких языках программирования пишете?
  • Страница 4 из 4
  • «
  • 1
  • 2
  • 3
  • 4
Поиск:

Все права сохранены. GcUp.ru © 2008-2019 Рейтинг