|
Because the window caption font is set by the Display settings on your machine. It is a non-client area. You can set fonts in your client-area. It is possible set the font in a caption but there is no functionality to do this in the .NET FCL. You have to override WndProc for your main Form and handle the WM_NCPAINT message, for example, to have a different font than what the user preferences specify for a window caption font.
If you search CodeProject, there should be a few articles on non-client painting.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath, you really don't like it when people don't search CP or Google before asking questions on the message boards, do you?
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
People that can't research they own simple problems do not belong in this field, IMO. Asking questions like "What does this method do?" is stupid - consult the documentation for that method. If you still don't understand it - fine - then ask about it.
That doesn't really apply to this guy, though. Read me response a little more carefully. I told him what the problem was and asked him to search CodeProject. There are articles about this, so why should I waste my time typing a bunch of code that's already been written. I actually have some example code dealing with non-client painting in this forum that pre-date said articles that I've seen (good and bad articles) alike. Asking him to search here is merely a way to save time and typing. He didn't even know what to search for before; now he does.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I know I don't like it. What's wrong with going to MSDN and searching for
classname class .net
Bam! Everything you wanted to know about the class...
If you want to write code for a living or just be semi-good in the IT Industry, you absolutely have to posses the skills to do research and teach yourself! What good are you to your company if you can't research an answer to a support question or learn new design/coding techniques?
I come here to answer as many questions I can and learn during the process. Mostly, I read questions and if I already know the answer, post it. Otherwise, it's off to MSDN i go, do a little research, then post come back and an answer. But, after that, I'll watch for the answers that Heath posts so I can learn the finer points from him and see where I went wrong! He's corrected me on a bunch of occasions, and I don't have any problem with that all! I actually look forward to it.
It's all part of the learning process...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
I know I don't like it. What's wrong with going to MSDN and searching for "classname class .net"
I don't see anything wrong with it.
Dave Kreskowiak wrote:
Bam! Everything you wanted to know about the class...
And then some...
Dave Kreskowiak wrote:
I come here to answer as many questions I can and learn during the process. Mostly, I read questions and if I already know the answer, post it. Otherwise, it's off to MSDN i go, do a little research, then post come back and an answer. But, after that, I'll watch for the answers that Heath posts so I can learn the finer points from him and see where I went wrong! He's corrected me on a bunch of occasions, and I don't have any problem with that all! I actually look forward to it.
I think that Heath is omniscient. He seems to know everything. I wonder if that is a requirement to be a Microsoft MVP
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
Hi,
I'm trying to create a DataBinding of a text box to via a DataView by using a parent relation not a child relation:
eg: (the classical) Customers-Orders relation.
I have a DataView on the Orders Table (for very good reasons it's impossible to set the DataView to the Customers Table).
Now, I want to set a text box to the value of:
Orders.Customers2Orders.CustomerName .. or something like that.
If I do:
textbox1.DataBindings.Add ( "Text", dataView1, "Customers2Orders.CustomerName" )
I get a nice:
{"Cannot create a child list for field Customers2Orders." }
System.SystemException: {"Cannot create a child list for field Customers2Orders."}
m_paramName: null
Message: "Cannot create a child list for field Customers2Orders."
ParamName: null
Is this possible somehow ?
Maybe by implementing my own Binding object?
Thanks alot,
Tutu.
|
|
|
|
|
Hi,
Any one knows about how to implement chart control(financial related). please help me out how to go about it.
thanks
gs
|
|
|
|
|
Your first step is to layout EXACTLY what you want your control to do. What type of data is your control going to need? How is this data going to be stored so that it is accessible by the client app and still quickly usuable by your control? How is the data going to be passed to the control? Do you want to implement databinding? Are there other standard controls that come close to the functionality you need (probably not in your case!)? Now, what do you want your control to look like? What graph types do you want to support? Do you want to add axis labels? How about automatic range scaling? What do you want to happen when the control is resized? Do you want to support horizontal scrolling?
Now, after all that, you can start designing your control. The painting code, by itself, is going to depend on answers to ALL of those questions. It may seem like alot, and it is!, but a control like this is nothing less than a full application written to do a very specific task.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
To add to what Dave said, there's lots of examples here on CodeProject.Just search for chart controls in C#. There everything from line graphs to bar graphs. For anything else, you really need to know the math behind it.
As Dave said, this is a big task. I recommend you just get a third-party control like ChartFX from Software FX[^]. It's cheap and full-featured. You'll spend a lot more in man hours than what it costs for this develop-licensed, royalty-free product, especially if you don't even have an idea of where to start!
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi, I'm writing a program that attempts to open a file stream using FileInfo.OpenRead(), this seems to fail when another application is accessing the same file. As I need to be able to read this file whilst another has it open or access it, is there anyway I can get it to open instead of throwing IOException in C#?
Thanks.
Here's a code snippet
//check file exists
System.IO.FileInfo info = new System.IO.FileInfo(sFileName);
if(info!=null&&info.Exists==true)
{
//ok, file exits, lets read it in...
try
{
System.IO.Stream stream = info.OpenRead();
//do stuff here
stream.Close();
}
catch(IOException exception)
{
}
|
|
|
|
|
If the other app has the file opened DenyShareRead at the least, you're screwed. The other problem is that you have to request that the file be opened with Shared Read/Write access. If the other open opens and closes the file frequently, you have to open the file with Shared access so the other app won't fail when it tries to open the file. The FileOpen method does not do this. Instead, you'll have to use the FileStream class to open the file:
FileStream myFileStream = New FileStream("C:\myFile.txt", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
Now, the rub is that you can request Shared access to the file, but it only takes effect for subsequent requests by other processes (apps) to open the file. It will NOT give you access to a file that is opened and locked by another process.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hey Dave, thanks, that worked a treat! Good stuff.
|
|
|
|
|
Hi To All
Yes the subject says a lot!!!
I have a webform which contains buttons, for one button i need to populate a modal dialog window and I will create a server object which will be in session in modal dialog.
But for the same button event I need to perform the insertion to database using session object which is created in modal dialog window.
The following is the code which will tell you what i am trying to do...
Response.write(openModalDialog);
str=Session["test"]//this will be created after I perform in modal dialog window
Database.insert(str)
please note that I am trying to execute all the lines in same button event
But i want to execute second and third line after i popup modal window and second should be executed once i close the modal window.
Please let me know if you have any idea on how to do that or any other way through which i can achieve.
Regards,
|
|
|
|
|
First of all, this belongs in the ASP.NET forum.
Second of all, you can't open a modal dialog from the server! All you're doing is writing the HTML to the client, but it's not a synchronous operation. Your HTML to open a popup window is writen. This is not like programming in Windows Forms at all.
The ASP.NET server (or any server-side technology, really) writes HTML to a response stream. The client reads it. Period.
The code to insert records into your database should be in the server-side page that opens in the modal dialog (via server-side events), or in another page that processes query string (GET) or form (POST) data. This is the way that HTTP and HTML work. There is no direct two-way communication between the client and server and anything you do on the server only produces content that is downloaded to the client. Again, it is not a synchronous operation.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath
Thanks for the reply, sorry for pasting the question here, as it was urgent i put here,
anyway thanks for your reply...The answer is wonderful, i can explain this to my team members.
Regards
|
|
|
|
|
Hi I am Begginer for .Net I am working on Login and passoword webform
could U pls help abt How to write the method for double click button And I need to read the text from Text Box
|
|
|
|
|
There is no double-click in web form buttons, or any other web controls as far as I can remember...
To read the Text from a TextBox? The text is stored in the TextBox's Text property...
String username = TextBox1.Text;
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Unless you override the default behavior or a button or link and handle the ondblclick event, no. There are lots of people, however, that like to double click and wonder why they ended up with two $4,500 Segways on their credit card bill!
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Does anyone have a code sample that they could send me showing how to go from a main menu program to several different windows? I can build each individually, but can't figure out how to bring them all together.
Thanks in advance
Daniel Stagg
dstagg@universalsolutions.com
|
|
|
|
|
Do you mean that you want to create an MDI (Multiple Document Interface) app or just a program which presents different windows (forms) for options, etc?
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
On a MenuItem just set MdiList to true . That MenuItem will become a popup and it's children will automatically display all the MDI child windows.
If you want a menu to simply show a new dialog (like an owned form), then do something like this:
MyForm form = new MyForm();
this.AddOwnedForm(form);
form.Show(); Each menu would probably either open a new form. If you want to communicate with an existing form, then declare a variable in your class. When a menu is clicked, check that the variable isn't null and then call methods or get/set properties or fields.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
this isn't a question....but....
i've just ordered and am waiting for the Wrox Press Professional C# Third Edition to come out on the 16th ,- anybody else got or getting this or something like it? i've always quite liked books by wrox: normally clear, with good examples, ideas, and covering a wide range of stuff in depth.
any suggestions for any future books on C# by any of you lot? any you've read and would recommend? i'm mainly interested in forms, gdi+, controls &etc. not so much in databases but all comments welcome...
-------------------------------------------------------
ithium is the best.
'Science without religion is lame, religion without science is blind.' --Albert Einstein
'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein
|
|
|
|
|
|
It's my favorite place to find everything I need!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|