|
I want to display text in a certain font, but I don't know how..
how can I do it?
and another thing - if I want to include a font that isn't on the user's machine, how is it done?
thanks
|
|
|
|
|
If you type "Font" into your Managed DirectX 9.0 help (which you should've installed), you'll have all the information you should need if you read the rest of the documentation. Alternatively, pick up a book on Managed DirectX 9.0 like Managed DirectX 9 Kick Start: Graphics and Game Programming[^].
This allows you to use the System.Drawing.Font class provided in the .NET BCL. You can keep a collection of private fonts (those not installed on a system) by distributing the fonts with your application (or embed them as manifest resources and extract them before proceeding) and use the PrivateFontCollection class to add them to the font collection (along with installed fonts, which is encapsulated in the InstalledFontCollection ).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Recently i come accross forums, or websites, claiming people are losing there job related to C# experiences, and saying that C# wont exist for much longer? one post is located at http://www.mail-archive.com/c_sharp@p2p.wrox.com/msg02322.html[^]
I HOPE this is CERTINALY NOT TRUE, i just started learning C#, and i obsolutely LOVE its language, its much better than C++, and more reliable
|
|
|
|
|
C# is at the core of Microsoft's .NET strategy. I don't see it failing.
What you are reading is a Sun zealots FUD. Just look at his sig.
Michael
CP Blog [^]
|
|
|
|
|
Michael is right. Just some Sun zealot trying to spread FEAR (False Evidence Appearing Real)
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Gary Busey! Do you know the FRIENDS one? I loved that show...
/\ |_ E X E GG
|
|
|
|
|
What are you talking about?
Who is "Gary Busey"?
The FRIENDS one what?
I'm so confused...
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
Hi everyone,
I was wondering if it is possible to disable addition of new rows when using the DataGrid control? The only possible way I found is to set the AllowNew property of the DataView to false, but this only works when the DataGrid is data bound to this instance of DataView.
My problem is that I'm using the same instance of DataGrid with several table styles to edit several tables of a DataSet, and the user is allowed to navigate among them using the relations of this DataSet. But this way, I'm unable to achieve this.
I have tried setting the DefaultView.AllowNew=false for the table that shouldn't allow new rows, but the DataGrid will probably use another instance of the DataView, so this doesn't work.
I guess that the only solution would be to use the Navigate event of the DataView and get the instance of the DataView that DataGrid is using, but I just don't know if this is the way, and how to get that damn DataView instance.
Thanks for any clues in advance!
Rado
Radoslav Bielik
http://www.neomyz.com/poll [^] - Get your own web poll
|
|
|
|
|
I have it! I've been trying to make it work since Friday, and finally found what I've been doing wrong. This code in the Navigate event handler will do the trick:
private void dataGridModules_Navigate(object sender, System.Windows.Forms.NavigateEventArgs ne)
{
if(this.dataGridModules.DataMember.IndexOf("name-of-the-table")!=-1)
{
CurrencyManager cm=(CurrencyManager)
this.dataGridModules.BindingContext
[this.dataGridModules.DataSource,
this.dataGridModules.DataMember];
((DataView)cm.List).AllowNew=false;
}
}
My problem was that I was using only the name of the table for the BindingContext indexer, when I replaced it with this.dataGridModules.DataMember it started to work .
Rado
Radoslav Bielik
http://www.neomyz.com/poll [^] - Get your own web poll
|
|
|
|
|
Hy everyone!
I know I already posted a lot of questions. I hope I did not anoy anyone of you, but I am very new to C#, trying to get along with my C/C++ knowledge, but C# is different in some ways. I also do have the MSDN to look up some things, but I don't know why, because if I do not know for sure what to look for (a class e.g.) then I feel lost in there .....
On the otherhand I should have finished a special task (a programm) at the end of August ....
Well but back to my question:
I do want to assign a field of an array of strings to a TextBox (the TextBox is called lTextBox in there and the field I want to assign is called ltemparray[1]).
The relevant code looks like this.
......
// definition
TextBox lTextBox = sender_txtNameKeyDragDrop as TextBox;
....
// part of the ContextMenu definition
menuItem1.Index=0;
menuItem1.Text=ltemparray[1].ToString();
menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
.....
// display contextmenu for the TextBox
ctNameKeyMenu.Show(lTextBox, lTextBox.PointToClient(Cursor.Position));
.....
private void menuItem1_Click(object sender_menuItem1Click, System.EventArgs e_menuI1C)
{
// assign data to TextBox in here
}
But the problem is: how do I get the TextBox. Well I do think I have to adress it via the parent, but I am not quit sure.
So if anyone of you could tell me what the lines of code to assign the string in the arrayelemnt to the TextBox (in the Click event) has to look like, it would help me a lot.
And besides I guess I would learn a lot!
Thanks!
Stephan.
|
|
|
|
|
Hy everyone!
I just did it!
But well, it's not perfect because at the moment I do use a global variable.
If someone of you knew a better solution please let me know.
My solution:
TextBox gsenderdst;<br />
......<br />
<br />
TextBox lTextBox = sender_txtNameKeyDragDrop as TextBox;<br />
....<br />
gsenderdst=lTextBox;<br />
menuItem1.Index=0;<br />
menuItem1.Text=ltemparray[1].ToString();<br />
menuItem1.Click += new System.EventHandler(this.menuItem1_Click);<br />
.....<br />
ctNameKeyMenu.Show(lTextBox, lTextBox.PointToClient(Cursor.Position));<br />
<br />
.....<br />
<br />
private void menuItem1_Click(object sender_menuItem1Click, System.EventArgs e_menuI1C)<br />
{<br />
MenuItem lsender=sender_menuItemClick as MenuItem;<br />
gsenderdst.Text=lsender.Text;<br />
}
Well as I said before I used a global variable and to me it doesn't look nice this way, but well, it works and that's what counts.
So if anyone of you knows a better solution (e.g. without the global) then please let me know!
Stephan.
|
|
|
|
|
Hello,
I am jayasree. I am working on speech processing device interface. I have a doubt in that. As i couldn't find relevant topic to post in in that, i have chosen this.
Presently I am taking data from waveIn device and looping it back to the waveOut device in the sound card. Now I am working on mixer interface. My doubt is is it possible to use LINE pin of the sound card. means is it possible to use as another destination when i am using both waveIn and waveOut devices. Or i have to bypass and use the same one.
As presently I am working on this, I need info about this very urgently.
jaya
|
|
|
|
|
Hi Gurus!
I writting some kind of Web Application and here I got a few WebForms and I need to exchange some variables between these pages. Usually when on page1 user pick up some value in Grid I wrote following code
Response.Redirect("../page1.aspx?MyVar="+textBox1.Text);
actually I just making a page redirect on itself and then in page class I defined private static string MyVar=""; and OnLoad I wrote
if(!this.IsPostBack)
{
if(Request["MyVar"]!="")
{
MyVar = Request["MyVar"];
DoSomeWork(MyVar);
}
}
So i want ot ask you is this optimal solution to store page variables? I mean maybe exists some better solution then redirect page on itself? Maybe I should use ViewState to store page variables or somth.?
xedom developers team
|
|
|
|
|
|
I would like to set up the formatting for hex to display as:
FF EE FF FD (instead of FFEEFFFD)
Also for Binary with digits in group of 8's
(i.e. 11111111 11101110 11111111 11111101)
these are to be displayed in editboxes.
Any Suggestion?
|
|
|
|
|
If I use inpout32.dll to access parallel port port on WinXP,
How can I use it in my source code?
Thanx
ahmedadel
|
|
|
|
|
hi guys,
i am new to C# programming. i want a small help. i have two tables in my sql database. suppose emp and salary.
In emp i have id,name and designation
In salary i have id and salary.
then coming to the problem i want to put up a form with 4 test boxes for id,name,designation and salary and databind.
Databinding works fine if it has only one table.(Simple Databinding)
But when i try to update both tables it gives error that id cannot take null value.
That is i want the id to be updated in both tables from a single textbox value.
Is it possible. How to go for that. This may seem simple to many. But i am new to all this, Help me.
Thanks in advance for ur help
hap
|
|
|
|
|
First - always bind to the DataSet , then set the binding member (like DataGrid.DataMember ) to the name of the DataTable when possible. This allows you to use relationships to navigate tables.
Second - the problem is that you haven't defined your DataTable yet. If your SQL database would use an identity field (auto-incrementing), then you must set the DataColumn.AutoIncrement property to true . The easiest way to do this is to add a new DataSet to your project in VS.NET and use the designer to create a DataSet . Create elements that represents DataTable s, and elements under those represent fields, which you can set properties for in the PropertyGrid. Then instead of using a generic DataSet , you can instantiate the DataSet derivative that you just created, which will - when instantiated - have the correct structure.
The problem you're having is that an identity column is not being assigned automatically, and since identity columns are typically non-null, you can insert the DataRow because that identity column would be null. The solution I provided above fixes this.
It's important to note that if you use a SqlDataAdapter to easily update a database (see SqlDataAdapter.Update(DataSet) in the .NET Framework SDK) your InsertCommand should be both an INSERT and SELECT SQL statement combined (INSERT ...; SELECT ...). This makes sure that the identity columns are updated to the correct numbers once inserted into a table (since the database may assign different numbers in a multi-user environment). If you just assign the auto-assigned numbers in your local DataSet will match those in the database, you will have problems.
You should read about ADO.NET more in the .NET Framework SDK and I suggest you try using the designers to create connections, commands, and adapters (as well as data sets as I mentioned above) and view the source code to see how it's done. Learning by example can often open the flood gates of understanding (so long as you have at least some knowledge of what's going on...which is why you should read the class and member documentation for those classes and members being used).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello
I'm working on a DirectX application, and I want it to have a configuration set window befor it works.
How can I load one form, and when it's done load the other?
thanks
|
|
|
|
|
You could just create a new form then do something like...
<br />
ConfigDialog dialog = new ConfigDialog();<br />
if (dialog.ShowDialog == DialogResult.OK)<br />
{<br />
Application.Run(new DXForm());<br />
}<br />
Make sure that your OK button sends the dialog ok message. This is the DialogResult property of the button.
|
|
|
|
|
|
somebody tell me can use IDocHostUIHandler can relize this idea,but how can do this by c#?
ok
|
|
|
|
|
IDocHostUIHandler is defined in the MsHtmHst.idl file. Basic idea is you can write your own idl file and use the midl compiler to generate the type library. Following that you can use the .NET Framework's command line tool tlbimp to generate a .NET assembly you can include within your application.
[
uuid(47F05070-FD66-45cc-AD99-74260F94A16B)
]
library WebInterop
{
import "MsHtmHst.idl";
enum tagDOCHOSTUIDBLCLK;
enum tagDOCHOSTUIFLAG;
enum tagDOCHOSTUITYPE;
interface ICustomDoc;
interface IDocHostShowUI;
interface IDocHostUIHandler;
interface IDocHostUIHandler2;
interface IHostDialogHelper;
}
Then create the type library:
midl WebInterop.idl /tlb bin\WebInterop.tlb
Then create the .NET assembly:
tlbimp bin\WebInterop.tlb /out:bin\WebInterop.dll
Now create a class that inherits from IDocHostUIHandler and of course implements the appropriate methods.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi,
I'm overloading the ++ operator for my Day Class. I have the implementation for this overload within my class and when I tested this in the debug mode, my Day which is supposed to increment as I've coded doesn't increse. It basically gives out an object of type Day itself with the next date. Here is my code. Any help with this would be appreciated. Please do help me out with this.
<br />
public static Day operator ++(Day d)<br />
<br />
{<br />
<br />
Day nxtDay;<br />
<br />
int nxtDate;<br />
<br />
<br />
try<br />
<br />
{<br />
<br />
nxtDate = d._dayofmonth + 1;<br />
<br />
nxtDate += 1 ;<br />
<br />
nxtDay = new Day(new DateTime(d.Year, d.Month, nxtDate));<br />
<br />
}<br />
<br />
catch (Exception e)<br />
<br />
{<br />
<br />
e.GetType();<br />
<br />
int nxtDayMonth = (d.Month == 12) ? 1 : d.Month + 1;<br />
<br />
int nxtDayYear = (nxtDayMonth == 1)? d.Year + 1: d.Year;<br />
<br />
nxtDay = new Day(gc.ToDateTime(nxtDayYear,nxtDayMonth,1,1,1,1,1));<br />
<br />
}<br />
<br />
return nxtDay;<br />
<br />
}<br />
Thanks
~~~~~~~~~~~~~~~~~~~~~~~~
Shravan Addaypally
.NET Apps Developer
BellSouth Billing Inc.
Birmingham, AL 35205
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
This might seem like a dumb question, but why not use the already built-in DateTime object? Check this example out from MSDN:
<br />
System.DateTime dTime = new System.DateTime(1980, 8, 5);<br />
<br />
System.TimeSpan tSpan <br />
= new System.TimeSpan(17, 4, 2, 1); <br />
<br />
System.DateTime result = dTime + tSpan;<br />
<br />
It seems to me to get the same job done without all the hassle of making your own object.
~javier lozano
(blog || email)
|
|
|
|