|
Have you looked at the MSDN documentation for PrinterSettings.SupportsColor? There is an example there that prints 2 pages, only the first in color. If this works for your printer, then you have the solution.
I had assumed that you had exhausted, all possibilities and that is why I suggested what I did, as if you had then there must be a peculiarity with your printer which my code might have overcome. I would suggest that you investigate the MSDN documentation further, and experiment with the examples you find there. You will learn more by doing that, than by asking on here.
If you do get stuck, by all means come back yo CP and ask a new question.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thank you Henry,
Generally I don't like to get information on MSDN , because most times my ideas are clear when I get in to, and confused after I read the items that explain what they want and not what you are looking for.
I said "most times" , but not all times. Probably this time is right time. ( I hope!)
Thanks again.
|
|
|
|
|
I need to place some text rotated at 45 degrees onto a bitmap. The text needs to be centred on a specific point. Placing normal text centred on a point on a bitmap is easy enough, and I’ve googled a number of different solutions to rotating text ... but I can’t rotate *and* centre on a point at the same time. An added complication is the text may sometimes contain CRLFs.
Can anyone show me the code how to do this (in VS2005)? Thanks.
|
|
|
|
|
Hi,
this is my view on this:
1. first attempt to paint the text without rotation; the text height can be measured using Graphics.MeasureString; when given the available width it will optionally do word wrapping, and anyway it will calculate the effective width and necessary height. So you know the distance from topleft to center now.
2. you can ask a Graphics to do all transformations for you; first order a translation to the point where your text should be centered; then order a rotation; now draw the string with Graphics.DrawString at location (0,0). That should do it.
|
|
|
|
|
Hi Luc
Sorry to sound like a newbie but can you give me the code to show how this is done? I tried but got myself muddled.
|
|
|
|
|
No, sorry, I am not going to create and provide code. That is not how this site works. You do the effort, show some results, then ask specific questions.
So I suggest you raise the level of your knowledge where it is lacking by studying serious material (preferably a book) and/or performing some experiments.
Hint: when playing with TranslateTransform and RotateTransform, make sure to make your view much larger than you consider necessary, things go out of sight pretty soon, especially if you choose the wrong polarity for some of the factors.
|
|
|
|
|
Hello,
i have no problem to start a presentation by an c#-program (interop), but i need to navigate to slides by an externel source (via serial-interface).
Is there a way to "call" a special slide via PowerPoint-automation?
Heiko
|
|
|
|
|
I'm running a little code that should write code to a text file within the application directory, however I'm getting the following error:
Access to the path c:\inetpub\wwwroot\MapFile\Mapped.txt is denied
I'm logged on as Administrator on Windows Server 2008 and running VS 2008 SP1 / .NET 3.5.
Any ideas?
Jon
|
|
|
|
|
Navigate to that folder, view the properties -> security. Give Users write permissions.
|
|
|
|
|
This can also come up if the file has already been opened somewhere else in your code and you've forgotten to close it.
|
|
|
|
|
If this is an ASP.NET application, the accout you're using to run this code under the debugger doesn't matter. It's actually running under the ASPNET account, which IIRC, by default, does not have Write permissions to the application folder. In order to make this work, and I do NOT recommend this, you have to give the ASPNET account Write permissions to the C:\inetpub\www\MapFile folder.
|
|
|
|
|
Yeah I thought so, but what is the ASP.net acct used? When checking the users on the OS there were none other than the Administrator and another one created by sql server.
This is not a production environment, so I'm not worried about security, but it's good to know.
Jon
|
|
|
|
|
jon_80 wrote: but what is the ASP.net acct used?
Depends on the server being used. If it's the development web server that comes with Visual Studio, it's "ASPNET". If it's IIS 6.0 and below, it'll probably be something like "IUSR_machineName". For IIS 7.0 and above, I think this name got changed to just "IUSR".
|
|
|
|
|
This method should work for you.
public static void AddFileSecurity(string FileName, string Account, FileSystemRights Rights, AccessControlType ControlType)
{
try
{
// Create a new FileInfo object.
FileInfo fInfo = new FileInfo(FileName);
// Get a FileSecurity object that represents the
// current security settings.
FileSecurity fSecurity = fInfo.GetAccessControl();
// Add the FileSystemAccessRule to the security settings.
fSecurity.AddAccessRule(new FileSystemAccessRule(Account,
Rights,
ControlType));
// Set the new access settings.
fInfo.SetAccessControl(fSecurity);
}
catch (Exception exp)
{
Console.WriteLine(exp.Message.ToString());
Console.Read();
}
}
You can use it with something like this:
FileWritePermission.AddFileSecurity(path, "everyone", System.Security.AccessControl.FileSystemRights.FullControl, System.Security.AccessControl.AccessControlType.Allow);
Cheers
|
|
|
|
|
Cute code, but an account (and core running under that account) cannot grant more permissions to itself, nor anyone else, than it already has.
|
|
|
|
|
Good morning everybody,
I would like to show stocked data in ListView to send DataTable aprés Select. DataTable contains a colonne of type Byte [] Array, I do not succeed show pictures in gate.somebody address can help me SVP?
|
|
|
|
|
I think that I understand what you want to do. If I am right, this[^] link should help you.
If I am wrong, please edit your original post and try to explain you problem more clearly.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Good morning,
Excuse me, I am French, I speak the language badly Englishman. My question is the following:
I have one banks on look at foundation of data which contains columns Name, Forename, Photograph
I make a request SQL which is the following:
cmd.CommandText ="SELECT NAME, FIRSTNAME, PHOTO FROM USER";
I fill ListView in the following way:
sqlDa = new SqlDataAdapter();
sqlDa.SelectCommand = cmd;
try
{
sqlDa.Fill(dt_ListeUtilisateur);
if (dt_ListeUtilisateur.Rows.Count > 0)
{
lstUtilisateur.DataContext = dt_ListeUtilisateur.DefaultView;
}} //lstUtilisateur = ListView
XAML :
<listview margin="7,10,15,48" name="lstUtilisateur" itemssource="{Binding}" borderbrush="{x:Null}" listboxitem.selected="lstUtilisateur_Selected" selectionchanged="lstUtilisateur_SelectionChanged">
<listview.view>
<gridview>
<gridviewcolumn header="NAME" displaymemberbinding="{Binding Path=NAME}" selector.isselected="True">
<gridviewcolumn header="FIRSTNAME" displaymemberbinding="{Binding Path=FIRSTNAME}">
<gridviewcolumn header="Picture" width="100" displaymemberbinding="{Binding Path=MyImage}">
<gridviewcolumn.celltemplate>
<datatemplate>
In the column Picture of my ListView, I have unfortunately not the photograph but Byte [] Array you can help me please.
|
|
|
|
|
Good morning,
Excuse me, I am French, I speak the language badly Englishman. My question is the following:
I have one banks on look at foundation of data which contains columns Name, Forename, Photograph
I make a request SQL which is the following:
cmd.CommandText ="SELECT NAME, FIRSTNAME, PHOTO FROM USER";
I fill ListView in the following way:
sqlDa = new SqlDataAdapter();
sqlDa.SelectCommand = cmd;
try
{
sqlDa.Fill(dt_ListeUtilisateur);
if (dt_ListeUtilisateur.Rows.Count>0)
{
lstUtilisateur.DataContext = dt_ListeUtilisateur.DefaultView;
}} //lstUtilisateur = ListView
XAML :
<listview margin="7,10,15,48" name="lstUtilisateur" itemssource="{Binding}" borderbrush="{x:Null}" listboxitem.selected="lstUtilisateur_Selected" selectionchanged="lstUtilisateur_SelectionChanged">
<listview.view>
<gridview>
<gridviewcolumn header="NAME" displaymemberbinding="{Binding Path=NAME}" selector.isselected="True">
<gridviewcolumn header="FIRSTNAME" displaymemberbinding="{Binding Path=FIRSTNAME}">
<gridviewcolumn header="Picture" width="100" displaymemberbinding="{Binding Path=MyImage}">
<gridviewcolumn.celltemplate>
<datatemplate>
In the column Picture of my ListView, I have unfortunately not the photograph but Byte [] Array you can help me please.
|
|
|
|
|
Your English is quite good. Part of what you are trying to do, is what I thought from your first post, so it must be reasonable.
I must admit that I didn't read all of the link I gave, but I thought that it dealt with reading and saving images to and from a database. If that is not where your problem is, then can I suggest that you post in the WPF forum here on CP, as your application would seem to be a WPF one.
If loading the photo is your problem, then perhaps you might like to Google for yourself. The search term I used was 'Loading Image from SQLServer C#', to see if there is anything more appropriate.
You seem to be slightly annoyed by my suggesting that you re-word your question. You shouldn't be, I often find that trying to ask something using different words makes me understand it a little better, myself.
Anyway, Good Luck! (Bon chance ????)
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi all,
I have a byte[] to unit function, I would like to have a reverse function that convert unit to byte[], please help. thanks a lot.
public static uint ParseUint(byte[] buffer, int uintLengthInBytes, ref int offset)
{
uint value = 0;
int i, j;
for (i = offset + uintLengthInBytes - 1, j = 0; i >= offset; i--, j++)
value |= (uint)(buffer[i] << (8 * j));
offset += uintLengthInBytes;
return value;
}
Regards,
unruledboy_at_gmail_dot_com
http://www.xnlab.com
|
|
|
|
|
|
hi, I know that method, the result is wrong. please take a closer look at the original code
Regards,
unruledboy_at_gmail_dot_com
http://www.xnlab.com
|
|
|
|
|
What? Is it in Big Endian or something? Just Array.Reverse the result?
|
|
|
|
|
sorry, my debugging mistake, you are right. thanks a lot.
Regards,
unruledboy_at_gmail_dot_com
http://www.xnlab.com
|
|
|
|
|