|
i want to set my own images for the scrollbar object to the up and down arrow button, for the bar, and the base.
How?
|
|
|
|
|
Best to create this control from scratch. I've tried in the past to OwnerDraw with the .NET scrollbar, but you end up recreating the entire control. You can construct one quick easily with a few buttons and a little GDI+ magic.
|
|
|
|
|
Hallo,
I'm not sure if here is the right place to post this question...
I'm using D3D 9.0c with C# and I have a little problem with Texture. Can anyone help me?
The strange things happens is the follow:
When I use PositionNormalColored and lighting=true it is all ok, all lights and shadows,
When I use PositionNormalTextured and light=true I see all black. When I set lighting=false the objects are correctly rendered, clearly without lights and shadows. Does anyon know why I'm having this problem? Maybe I'm doing something wrong?
Thank you very much...
_Comet_Keeper_ (from Italy)
|
|
|
|
|
Have you applied an actual texture? PositionNormalTextured won't have colored vertices. If you've assigned a texture, you may need to set the texture mappings. I'm not an expert myself in Managed DirectX 9 (or DirectX for that matter), so you may have better luck in a MDX forum (such as the GameDev.net Managed game programming forum[^])
|
|
|
|
|
i wanted to create an program to show an image as a crosshair in the center of the screen for some games. ive created the crosshair with a transparent form, the image background is transparent also, it works when im running a normal program like a web browser, but when i run a game such as Wolfenstein or Counter Strikc Source (running some resolution as windows) the form loses its always-on-top property. it is moved to the background. is there a way i can make the form ALWAYS stay on top?
thanks in advance,
sam kline
|
|
|
|
|
Not in a DirectX game. The window IS "on top" of the all the other windows on the desktop. But the game isn't drawn in a window on the desktop. DirectX draws directly to the video cards frame buffer, overwriting what GDI draws in a window.
Your form is still on top, but is only drawn when the form is visible. Since the DirectX games completely hides the desktop, your form is no longer visible and will no longer get any WM_PAINT messages to tell it to repaint itself.
You'll have to re-write this as a mod to the games. There's no "generic" way to do this for all games.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Have a very simple form (form2) that checks for the credentials.
The following code works but it leaves the dialog (form2) open. I just want to display Form1 if credentials are good.
if(textBox1.Text=="username")
{
//MessageBox.Show("good user, check password","Info");
if(textBox2.Text=="password")
{
//credentials are good, display Form1
Form1 firstForm = new Form1();
firstForm.ShowDialog(this);
}
else
{
MessageBox.Show("Bad user or password","Info");
}
}
else
{
MessageBox.Show("Bad user or password","Info");
} }
|
|
|
|
|
This is very easy to do. I just need to understand a few things of what you are trying to do:
1. Does this check happen on start up? If yes, there is a better way to do this.
2. After the MessageBox tells you "Wrong password...etc. what do you want to happen - everything to close?
3. You seem to have only OK button n the MessageBox that displays wrong password... do you want the same thing to happen if a person presses OK or cancels the dialog?
This will close and release all the resources associated with the form (including memory) the main form after the dialog has opened that tells the password is incorrect and OK is pressed or that dialog has exited.
if (MessageBox.Show("Bad user or password", "Info") == DialogResult.OK)
{
this.Dispose();
}
Let me know if this helps.:->
|
|
|
|
|
Hi peshkunta
I started the main project then later I decided to add another form (form2)to check credentials.
So what I did is change the code to point to second form2
-Application.Run(new Form2());-
This causes the second form2 to be displayed first.
Then if credentials are OK, form2 dispaears and form1 is displayed
I tried this code
using (Form1 f = new Form1())
{
this.Hide();
f.ShowDialog();
}
this.Show();
but when I close the main form (Form1), the first form (Form2) is displayed again.
|
|
|
|
|
I think you are making this harder than it has to be - your approach.
The most straight forward and easier for you in the long run would be:
1. Leave Form1 to start in the Application.Run function
2. Go to the Form1 events and add an on Load event handler(function). In this function add your code to start and show your Form2 - the authentication form. This will make Form2 open first and get the focus (be in front). Although both forms will be open (not sure if this is a problem in your case) if you make it as modal with ShowDialog() - that way the person will have to work with Form2 and not be able to mess with Form1 until it's been authenticated.
OR
If you want when you close Form1, Form2 to not be displayed, go to the event handler for Closing in Form1 and tell it to close Form2 when form1 is closing and that should solve the problem. I would use Dispose().
|
|
|
|
|
Hello, if I have a string object with RTF tags and I want to display it on richTextBox, is there a way to convert it so that the text would appear bolded (for example) instead of the tags for bold?
Mike - I love to program!
|
|
|
|
|
how can i send email using net.mail namespace. it gives me always unreadable adresess error.
Thanks
|
|
|
|
|
if you have same prob you should add
Mesaj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate","0");
anybody didnot answer but nop
|
|
|
|
|
I have started a thread. And in the process of this thread I need to show another form and wait until user clicks OK. Since form is shown and until user clicks "OK" I need to pause this thread.
myThread.Suspend() dont work:
Warning 2 'System.Threading.Thread.Suspend()' is obsolete: 'Thread.Suspend has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202'
How can I make Suspend() work ... or is there any another way to do it?
|
|
|
|
|
First, you cannot start a form from another thread. Create and use forms & controls ONLY on the UI thread. This is a golden rule of Windows UI programming.
If you need to show a form, show it on the UI thread. If a background thread needs to wait, have it watch a variable and Sleep(0) in a while loop while that variable is true:
while(myFormIsVisible)
{
Thread.Sleep(0);
}
I might be misunderstanding what your problem is. If you could better explain what you're trying to do, we might be able to help you further.
|
|
|
|
|
Judah Himango wrote: First, you cannot start a form from another thread.
That is a common misconception. The actual rule is "You can only access and manipulate UI/Form elements from the thread they were created on."
It's perfectly legal to create forms on separate threads as long as you obey the above rule.
Jared Parsons
jaredp@beanseed.org
http://jaredparsons.blogspot.com/
|
|
|
|
|
Yes, you're right, my mistake. I just never use controls from background threads period, so I've blurred the distiction I guess. My mistake.
|
|
|
|
|
First of all, thank You very much for your answer. I've understood how to pause a thread, but now I don't understand how to show a form (before: form showed only after thread was finished).
I have a form "mainForm" with button. When I click button: thread "fP" starts.
Button event:
private void fileProccessing_Click(object obj, EventArgs ea)
{
fP = new Thread(new ThreadStart(fProc));
fP.Start();
}
Thread:
public void fProc()
{
editForm edtFrm = new editForm();
...someText...
if( ... )
{
edtFrm.Show();
edtFrm.cmbBox.DataSource = fieldsBaseD;
while (edtFrm.Visible == true)
{
Thread.Sleep(0);
}
}
}
And in another file I have second form "editForm" (which I want to show)
class editForm : Form
{
public ComboBox cmbBox;
private Button buttonOk;
public Label label1;
public editForm()
{
InitializeComponent();
}
....
}
but thats dont work... it tries to show a form and programm becomes to not responding
|
|
|
|
|
Try changing fProc to the following.
<br />
public void fProc(){<br />
<br />
editForm edtFrm = new editForm();
...someText...<br />
if( ... )<br />
{<br />
editForm.cmbBox.DataSource = fieldsBaseD;
Application.Run(editForm);<br />
}<br />
}<br />
Jared Parsons
jaredp@beanseed.org
http://jaredparsons.blogspot.com/
|
|
|
|
|
It helped. Thank you very much!
|
|
|
|
|
hey. im kinnda new to the programming world. well i just want to know how do i start programming in C#, i mean like any good book to rec. or something that actually eexplains the basic. thats all i need the basic. i dont really hhave any strong backkground. i done vb6 before but i suucked at it and some pascal too. thx.
|
|
|
|
|
Jesse Liberty's "Programming C#" might be what you're looking for. It spends a lot of time explaining the basics before moving on to advanced topics. Its what I used to learn C#(although I did already have skill in C++).
|
|
|
|
|
if i were in your position, i would recommend starting with a bit of programming theory. I dont know how familiar you are with the Object Oriented Paradigm but i would definatley start on literature that is indepenedent of a programming language. The internet is GOLD for literature out there. Wikipedia.com has a lot about Object Oriented Analysis and Design, and Design Patterns. Here is my suggestion:
1. Learn Object Oriented Analysis and Design and what it all means (google it and read up on it at Wikipedia...there is so much out there and i hope you enjoy the theories presented)
2. Learn about design patterns: these are frequently reoccuring problems that show up in many programming projects (there are apporoximatly 30 or so patterns). This will provide a good base for solving problems.
3. Search of "best programming practices in C#", this will get you used to the language its, syntax and what is considered elegent coding.
4. Start learning the .Net framework (www.microsoft.com and F1), there are a lot of examples at microsoft.com, they have 30 examples that show some basic GUI interactions and many other basics that will prove to be useful
5. If you are rusty on looping, branching, function calling and some simple coding logic then start with console based projects. And play around with it.
The key to becoming a good programmer is to have a good understanding of software design. With a good base (steps 1-3), any programming language will come easy to you. If you just want to jump right in then i would check out the c# examples on Microsofts website. They will definately give you a big jump start into c#.
good luck
|
|
|
|
|
if I have a statement like ..
myArrayList.Add ( new MyStructure );
does the structure get allocated on the heap or the stack? Seems like it should be the heap, but most of what I have read says structures are always allocated on the stack. I saw where if you assigned the results of the new to a local variable that it would be on the stack - that I can understand; but what about the case above? The stack just doesn't make sense to me, but I wanted to confirm.
Thanks,
Brett
|
|
|
|
|
All structures get stored on the stack. All classes get stored on the heap. This means MyStructure will get stored on the stack since it is a structure, not a class.
However, if you look at ArrayList.Add method, you'll notice it takes a System.Object as a paramter. Since System.Object is a class, there will be an expensive, slow operation known as boxing will occur: a new object will be created on the heap and will copy the MyStructure from the stack onto the heap.
And when you retrieve your MyStructure out of myArrayList, you'll need to cast it back to MyStructure, which will induce unboxing which is also overhead.
Boxing is slow, causes heap allocations, and eventually forces costly garbage collections. That is why you need a list that can hold MyStructure objects without boxing them. If you're using .NET 2.0, you can go
System.Collections.Generic.List<MyStructure> list = new List<MyStructure>();
list.Add(new MyStructure());
This will allow you to have a very fast & efficient list for storing MyStructure objects without any boxing.
|
|
|
|