|
|
Search
|
|||||||
| Home | Register | Downloads | FAQ | Members List | Calendar | Arcade | Mark Forums Read |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#21 (permalink) |
|
Emu author
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2002
Location: Austria (originally from Dominican Republic)
Posts: 2,380
|
mmm i donīt really understand what exactly you mean/want but one thing i donīt get..... why are you using VS2002??? anyways controls in VS2002(which i hated in the past and drived me to hate C# aswell) should have the .Background property aswell as Foreground etc.. anyways iīve noticed youīre writing lots of code in order to change sinple colors... you believe it or not C# offers lots of great stuff to do your task very easy and in a very simple way. each form contains lots of features that arenīt visible in the editor or in the properties window but they are accessable via code and by moving the mouse over them you can find and see thatīs behind it. one of those properties is ".Controls" which is a collection of contros on the current window. that property not only holds the elements but it allows you to add new ones or do whatever you want to it and at the same time it give you access to every control so you can easily interact on each of them via code.. so now what do i want to show you with this??? the main idea is to show you how to change several properties on every control in a form without the need to write there IDīs each time and property and in that way waste time and code lol.. here is an example: Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace testingControls
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btn_change_Click(object sender, EventArgs e)
{
foreach (Control control in this.Controls)
{
if (control is Button)
control.BackColor = Color.Red;
else if (control is PictureBox)
control.BackColor = Color.Blue;
}
}
}
}
how do i do that? check out the following pic ![]() thatīs why i think C# is a beauty and also the reason why i love it now. Regards @ruantec
__________________
Current development tools: Visual C++.net, Visual C#.net Visual VB.net, Visual Webdeveloper.net Bloodshed Dev C++, Borland C++ Visual Basic 6 Last edited by @ruantec; June 20th, 2009 at 20:34.. |
|
|
|
| Advertisement | [Remove Advertisement] | ||
|
|
|
|
#22 (permalink) |
![]() ![]() ![]() ![]() Join Date: Jan 2006
Location: Planet Earth...
Posts: 593
|
This is all really great and you have no idea how much I appreciate your help,but it didn't really help me in the contextMenu control.I tried the following: foreach(Control control inthis.Controls) { if(control is MenuItem) { control.BackColor=Color.Red; } } I will try something else to see if that will do the trick... By default the first created button in the contextMenu control is called "menuItem1",and here instead of the "MenuItem" I tryed to type "menuItem1",but then I get an error that says:" 'TEST.Form1.menuItem1' denotes a 'field' where a 'class' was expected". Take a look at these pictures bellow to see what I exactly want to do:
__________________
|
|
|
|
|
|
#23 (permalink) |
|
Emu author
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2002
Location: Austria (originally from Dominican Republic)
Posts: 2,380
|
mmmm i think iīve finally got you lol... anyways that was one of the reasons why i hated .net and C# in the past because the old visual studio was just too stupid and didnīt had stuff you need.. anyways there are several ways to do that... but(now it comes) its not a simple task to do if you are not experienced. here are the two ways to go: 1. by using the "SetBkColor" API which requires a HDC of each menuItem and a color value(both of them are long numbers just in case). 2. by using a DrawingBrush or a Brush you can draw custom rectangles on each item and so create even animations or change the color of each item. now in the following pic from you iīve seen all you need to embedded and draw the items as you want(check out the red marked area) ![]() custom events can be embedded when the form is initializing by doing this for example(iīll use the two properties available as shown in your pic): Code:
this.mymenuItem.OwnerDraw = true;
this.mymenuItem.Text = "MymenuItem";
this.mymenuItem.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.DrawItem);
this.mymenuItem.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(this.MeasureItem);
now the bad news..... none of those two options are easy todo and there are several things you have to take in mind including api management and a good knowledge of what youīre doing. if i get some free time iīll probably provide you an example... i just hope you can understand whatīs the idea behind.. now last but not least.... i know iīve asked that several times but why do you care that much about VS2002??? if you ask me i would drop it because its a waste of time(My opinion)
__________________
Current development tools: Visual C++.net, Visual C#.net Visual VB.net, Visual Webdeveloper.net Bloodshed Dev C++, Borland C++ Visual Basic 6 Last edited by @ruantec; June 21st, 2009 at 14:34.. |
|
|
|
|
|
#25 (permalink) | |
![]() ![]() ![]() ![]() Join Date: Jan 2006
Location: Planet Earth...
Posts: 593
|
Quote:
![]() Well the reason why I use Visual C# 2002 is because many things are harder to make and on that way I am forced to learn how to make custom,even though I suck at it still xD Like this contextMenu control.In Visual C# 2002 I NEED to learn how to make my own otherwise I do not have a choice like I had in Visual C# 2005 or 2008.I will probably need few years to learn doing that lol....
__________________
Last edited by S.T.A.R.S.; June 21st, 2009 at 21:09.. |
|
|
|
|
|
|
#26 (permalink) |
![]() ![]() ![]() ![]() Join Date: Jan 2006
Location: Planet Earth...
Posts: 593
|
I am the happiest man on the world!!!I wrote the code,(with a help from the internet),with which I have successfuly changed the back and fore color for mouse leave and mouse enter(hover)!!!The code works perfect! I read what you said and I used those 2 events: DrawItem and MeasureItem.I wrote the cfode for both of them and everything works like charm.Here is the entire code: privatevoid menuItem1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { Rectangle rc=new Rectangle(e.Bounds.X,e.Bounds.Y,e.Bounds.Width,e.B ounds.Height); e.Graphics.FillRectangle(new SolidBrush(Color.Black),rc); MenuItem s=(MenuItem)sender; string s1=s.Text; StringFormat sf=new StringFormat(); sf.Alignment=StringAlignment.Near; sf.LineAlignment=StringAlignment.Center; Rectangle rcText=rc; rcText.Width+=5; e.Graphics.DrawString(s1,new Font("Verdana",10),new SolidBrush(Color.Blue),rcText,sf); if(e.State==(DrawItemState.NoAccelerator|DrawItemSta te.Selected)) { e.Graphics.FillRectangle(new SolidBrush(Color.Yellow),rc); } if(e.State==(DrawItemState.NoAccelerator|DrawItemSta te.Selected)) { e.Graphics.DrawString(s1,new Font("Verdana",10),new SolidBrush(Color.Red),rcText,sf); } } privatevoid menuItem1_MeasureItem(object sender, System.Windows.Forms.MeasureItemEventArgs e) { e.ItemWidth=75; e.ItemHeight=20; } I think this code is pretty good I will now try to make letters to be bold,change their size and see will I make it...If I do,I will give you the code. By the way...this is EXACTLY why I use Visual C# 2002.If I was using Visual C# 2005 or 2008,I would never learn this because I would be simply doing this in the properties window.In Visual C# 2002 with the .NET 1.0 I need to create my own and that is exactly what I want. ![]()
__________________
|
|
|
|
|
|
#27 (permalink) |
![]() ![]() ![]() ![]() Join Date: Jan 2006
Location: Planet Earth...
Posts: 593
|
The ENTIRE code is the same.Only I needed to change those 2 statements.They are both the same.One of them is this one: e.Graphics.DrawString(s1,new Font("Verdana",10),new SolidBrush(Color.Red),rcText,sf); Only what I needed to add was: "FontStyle.Bold".It looks like this: e.Graphics.DrawString(s1,new Font("Verdana",10,FontStyle.Bold),new SolidBrush(Color.Red),rcText,sf); Weee!! It works EXACTLY as I wanted!![]() Here are two pictures to see how it looks like.The first picture shows the unhovered menu item and the second one shows the hovered menu item:
__________________
|
|
|
|
|
|
#28 (permalink) |
|
Emu author
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2002
Location: Austria (originally from Dominican Republic)
Posts: 2,380
|
so i think thereīs no need of a example as you already found your answer...it seems tho that was right when i said the use of a Brush to draw the rectangles over the items is one of the ways to do it ![]() btw in my case i never have such problems because i do not use Windows/Tools controls but instead i create my own ![]() good job anyways
__________________
Current development tools: Visual C++.net, Visual C#.net Visual VB.net, Visual Webdeveloper.net Bloodshed Dev C++, Borland C++ Visual Basic 6 |
|
|
|
|
|
#29 (permalink) |
![]() ![]() ![]() ![]() Join Date: Jan 2006
Location: Planet Earth...
Posts: 593
|
You do realize that it was all thanks to you.You gave me an idea of how to do it. Thanks again.I just woke up now and I am going to try to make the colors to change on MOUSE DOWN too.If I make it... ![]() Heh it didn't work just as I thought.Anyway I am trying to display an image,but I am getting an error that says "The name 'TEST_IMAGE' does not exist in the class or namespace 'TEST.Form1'" Any idea??? ![]() Here is the picture of how I did it:
__________________
Last edited by S.T.A.R.S.; June 22nd, 2009 at 10:41.. |
|
|
|
|
|
#30 (permalink) |
|
Canadian Spaceman
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: May 2002
Location: Canada
Posts: 8,743
|
Looks pretty rad, can't wait for a release!
__________________
CPU: Core i7 920 \ MB: EVGA X58 \ RAM: 12GB OCZ DDR3-1600 \ GPU: SLI 8800GTX HDD: 2x 150GB VelociRaptor R0 / PSU: Enermax Galaxy 850w / OS: Windows 7 x64 |
|
|
|
|
|
#31 (permalink) |
|
Behind ur girlfriend :D
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Feb 2006
Location: Sydney, Australia
Posts: 18,851
|
ah heck, someones doped up RF.
__________________
![]() ![]() VBA-M | Xtemu | NGOHQ | Post Impact Productions | TNHW | XBCD 0.2.6 | Satanic666's Emulator Compiles Don't be a NOOB, READ THE NGEmu/EmuForums Rules of Conduct Need Help with ePSXe? This is your first stop!. If you don't post all the required information, you don't get help. Everytime someone posts a romsite, God kills a beautiful woman. |
|
|
|
|
|
#32 (permalink) |
![]() ![]() ![]() ![]() Join Date: Jan 2006
Location: Planet Earth...
Posts: 593
|
I just finished the MOUSE HOVER and MOUSE CLICK sounds.I think they sound pretty good.And I just finished almost all talking sounds and it will be pretty cool.Talking is sometimes better when you are in the middle of playing the game and DO NOT want to exit the game just to remove the text message. You will just hear the talking sound of about 4 to 5 seconds long WHILE you are playing the game,watching the movie or doing anything on your computer.I just tryed it.I was playing some game and in the middle of my playing I heard the talking sound and I wasn't interrupted at all,BUT I knew that the Virus Killer found a process that I put as a threat! And also he automatically terminated it and the second talking sound confirmed that...again WITHOUT interrupting and closing ANY of my work...wether that is a game,movie,music,browsing the internet,reading the text in any text program such as notepad,wordpad...and so on.........!![]() I just showed it to my brother and he says it's great! ![]() Anyway right now I am working on the code for the "Form3_Load" event and it will take me quite some time...few days probably,BUT after that everything else SHOULD go faster...I guess...I hope... ![]() Here is more info on this software.I will compress it as ".7zip".When you download that ".7zip" file,extract it with any good compressing software such as 7zip,WinRar and so on... After you have extracted the file,all what you will get is the ISO file called "Virus Killer version 0.1.iso".All what you have to do is to open that iso file with PowerIso software or any other software for ISO files,and burn ALL the files on the CD-ROM disc.NOTE: Do NOT modify ANY of the files inside that ISO file!!! After you have burned it to the CD-ROM disc,just put that CD-ROM in your CD-ROM drive and the installer will start automatically. Notes on the installer: The installer is also programmed in the Visual C# 2002.It will provide you to INSTALL the Virus Killer 0.1,it will provide you to REINSTALL it and also it will provide you to UNINSTALL it. Notes on the installer for older versions of Windows such as Windows 98 First and Second Edition: The installer also works on ALL old versions of Windows except Windows 95.If you are using operating system that is older then Windows 2000 Professional,this installer will also provide you to choose to install some of the Windows XP files in order to make the Virus Killer 0.1 run fully correct.So you do NOT have to worry about the missing Windows files if you are on Windows 98 First Ediiton,Windows 98 Second Edition,Windows Millennium and so on... ![]() IF YOU ARE AFRAID THAT THIS INSTALLER WILL INSTALL THIS WINDOWS XP FILES IN YOUR WINDOWS FOLDER AND THEN DESTROY YOUR OPERATING SYSTEM,THEN DON'T.INSTALLER WILL INSTALL THEM IN THE FOLDER WHERE THE VIRUS KILLER 0.1 IS LOCATED IN.SO EVEN IF YOU INSTALL THESE FILES ON WINDOWS XP,NOTHING BAD WILL NOT HAPPEN. To run the INSTALLER and Virus Killer software,you will need the .NET framework 1.0 and his SP3.These 2 components will also be included in that ISO file.However...if you have .NET 1.1 or newer version installed on your computer,then you do NOT need to install .NET 1.0 and his SP3. NOTE for the installer: Whenever you want to install,reinstall and uninstall the Virus Killer or install the Windows XP files,the CD-ROM disc MUST be in your CD-ROM drive!!! Notes on the Virus Killer HELP section: By clicking the "Help" button,you will no longer be faced with large boring text.Oh I know that feeling... By clicking the "Help" button,you will get the video,(with nice background music which you can enable or disable),that will guide you through ALL posibilities of the Virus Killer.In short it will show you how to use the software and ANY of it's options.It will also recommend you HOW you should configure the settings and options.Ohh by the way...the talking in the video that you will hear will be me![]() Note that this Virus Killer software/program is just a SMALL part of the actual UAC Internet Explorer.Virus Killer is based on the UAC technology. This is all for now.If I get lucky,this will be finished soon.Again...soon--->UNKNOWN DATE
__________________
Last edited by S.T.A.R.S.; June 23rd, 2009 at 23:21.. |
|
|
|
|
|
#33 (permalink) |
|
AEON'S HERITAGE
![]() ![]() ![]() ![]() ![]() Join Date: Apr 2006
Location: Tamazgha
Posts: 2,042
|
Its your work again
__________________
العرب بدو الفلاة، رعاة النوق اكتشفوا الصفر وظل لصيقاً بهم وفياً لهم حتى تمنوا التبرء منه وعيروني بالواحد الأحد 1 = Aothem, 0 = Thaothemth ^_^ | Markunda Princess of Tamazgha(^_^) | Tinariwen | General Emulation | Xtemulation | |
|
|
|
|
|
#34 (permalink) |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Oct 2001
Location: Waterloo, NE
Posts: 2,569
|
How can a human being be so unbelievably oblivious?
__________________
.: Flaretech.Net :: Flaretech.Biz Web Hosting :: H3 Stats :: My Blog :.
![]() .: Mac Pro :: Dual Quad-Core Intel Xeon 5400s :: 6 GB 800MHz DDR2 ECC FB-DIMMs :: NVIDIA GeForce 8800 GT 512 MB GDDR3 :. .: Macbook Pro 17" :: 2.33 GHz Intel Core 2 Duo :: 2 GB 667 MHz DDR2 :: ATI Radeon X1600 :. |
|
|
|
|
|
#35 (permalink) |
|
Emu author
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2002
Location: Austria (originally from Dominican Republic)
Posts: 2,380
|
While i have to agree with you at almost 100% there is still something i like from S.T.A.R.S and thats the fact that this guy either have guts or dunno what he got.... to be honest i think thatīs what i like most from him... a lot more than his work and thatīs for sure
__________________
Current development tools: Visual C++.net, Visual C#.net Visual VB.net, Visual Webdeveloper.net Bloodshed Dev C++, Borland C++ Visual Basic 6 |
|
|
|
|
|
#37 (permalink) |
|
AEON'S HERITAGE
![]() ![]() ![]() ![]() ![]() Join Date: Apr 2006
Location: Tamazgha
Posts: 2,042
|
Well, we should support him for that though :/ Seriously : go for it STARS, oh and rename the *od*amn program.
__________________
العرب بدو الفلاة، رعاة النوق اكتشفوا الصفر وظل لصيقاً بهم وفياً لهم حتى تمنوا التبرء منه وعيروني بالواحد الأحد 1 = Aothem, 0 = Thaothemth ^_^ | Markunda Princess of Tamazgha(^_^) | Tinariwen | General Emulation | Xtemulation | |
|
|
|
|
|
#38 (permalink) |
|
Emu author
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Nov 2002
Location: Austria (originally from Dominican Republic)
Posts: 2,380
|
Well i think heīs doing nice but he will need to re-design his app and rename it just as you mentioned in order to change his bad image here at ngemu... anyways sometimes S.T.A.R.S sounds to me like he thinks his app is the "Big Booom"(probably am wrong) when in reality is quite the oposite(donīt get me wrong S.T.A.R.S). the thing is apps/emus or whatever people code is just a piece of code that may get people attention but its not good to expect too much of your apps.. even the greatest projects here such as PCSX2 or Dolphin are praised now but in few years both of them will belong to the past and not get the attention they are getting atm(just as the greatest emus in the past such as ePSXe and the semi Shareware now PJ64)... thatīs a normal cicle and the worst thing you can do(even if youīre part of a team) is expect too much or try to hunt some attention/glory... both things are given to you if you deserve it but never ask for them... in my case i donīt care what people think about me or about my terrible english and either about my apps... what really matters to me is have fun and code things i like, use the tools i like and donīt let myself get confuse with stupid languages/tools propaganda which is definitelly confusing millions of great people with potential in this world... probably am too old for those things who knows ... you are probably not the best coder or the best guy but you seems to be quite funny and your threads are epic S.T.A.R.S so keep it up!
__________________
Current development tools: Visual C++.net, Visual C#.net Visual VB.net, Visual Webdeveloper.net Bloodshed Dev C++, Borland C++ Visual Basic 6 Last edited by @ruantec; July 6th, 2009 at 16:54.. |
|
|
|
|
|
#39 (permalink) |
|
AEON'S HERITAGE
![]() ![]() ![]() ![]() ![]() Join Date: Apr 2006
Location: Tamazgha
Posts: 2,042
|
well said.
__________________
العرب بدو الفلاة، رعاة النوق اكتشفوا الصفر وظل لصيقاً بهم وفياً لهم حتى تمنوا التبرء منه وعيروني بالواحد الأحد 1 = Aothem, 0 = Thaothemth ^_^ | Markunda Princess of Tamazgha(^_^) | Tinariwen | General Emulation | Xtemulation | |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|