|
If you use the /codebase option of regasm.exe, then the registry will contain the path to that dll.
If the other DLLs are .NET dlls then they can be in the same directory as DLL_1, and DLL_1 should find them fine.
my blog
|
|
|
|
|
Ex
Duplex = ture/false
Copies = ?
Color = ture/false
|
|
|
|
|
Maybe this is what your looking for.
.NET Framework Class Library
PrinterSettings Members
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDrawingPrintingPrinterSettingsMembersTopic.asp?frame=true
|
|
|
|
|
I'm trying to simply print some text, along with one or more illustrations. The illustrations print fine, and the text does as well, as long as the font is huge.
I've tested this bug using sizes 73, 60, 50, 30, 20, and 10, and all sizes smaller than 50 appear as random characters. I've used both times new roman and Arial font families with identical results. Does anyone know why it is doing this?
I'm using C# in a windows forms application. Any Ideas?
|
|
|
|
|
hi,
I wrote an article for the same. But i forgot the discusson group where i kept that. but still i have that source which will help you to print your page and content while keeping the font size in mind.
private void menuItem6_Click(object sender, System.EventArgs e)
{
try
{
PrintDia=new PrintDialog();
PrintDia.Document=printDocument1;
string content=this.Editor.Text;
StrReader=new StringReader(content);
if(PrintDia.ShowDialog()==DialogResult.OK)
{
this.printDocument1.Print();
}
}
catch(Exception Ex)
{
MessageBox.Show(Ex.Message.ToString());
}
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
try
{
float Lines_Per_Page = 0;
float Y_Position = 0;
int Count = 0;
float Left_Margin = e.MarginBounds.Left;
float Top_Margin = e.MarginBounds.Top;
string Line = null;
Font fnt = Editor.Font;
SolidBrush Solid = new SolidBrush(Color.Black);
Lines_Per_Page=e.MarginBounds.Height/Font.GetHeight(e.Graphics);
while(Count < Lines_Per_Page && ((Line=StrReader.ReadLine())!=null ))
{
// calculate the next line position based on
// the height of the font according to the printing device
Y_Position =Top_Margin + (Count * fnt.GetHeight(e.Graphics));
// draw the next line in the rich edit control
e.Graphics.DrawString(Line ,fnt ,Solid ,Left_Margin ,Y_Position ,new StringFormat());
Count++;
}
if(Line !=null)
e.HasMorePages=true;
else
e.HasMorePages=false;
}
catch(Exception Ex)
{
MessageBox.Show(Ex.Message.ToString());
}
}
private void menuItem4_Click(object sender, System.EventArgs e)
{
try
{
string Content=Editor.Text;
StrReader = new StringReader(Content);
PrintPreviewDialog Print_Preview=new PrintPreviewDialog();
Print_Preview.Document=printDocument1;
Print_Preview.ShowDialog();
}
catch(Exception Ex)
{
MessageBox.Show(Ex.Message.ToString());
}
}
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Thanks, but my main issue has to do with beintg able to specify a particular font family and size without it appearing as gibberish. I don't need to worry about line spacing or anything like that. The text I'm printing is essentialy captions for a picture. The text displays perfectly at sizes of 50 points or higher, but immediately turns to random characters at smaller sizes.
|
|
|
|
|
Maybe I am just over fussy, but I would like to exactly replicate the OS Font when ownerdrawing a control. I have looked at the examples on CodeProject and the Web and all of them seem to fail to correctly render.
To demonstrate this try,
Create a new windows form application, and set the form to Tahoma.
Add a standard label, Textbox or other control, and set it to be FlatStyle=System. Set it's .Text to be "Debug"
Then add a new user control, override the OnPaint and Drawstring("Debug"...);
You will notice that the D and e have a different spacing and also that the final point of the e raises on the Drawstring text. (Use the XP magnifier or download the taskbar magnifier from MS powertools to see it more easily).
I have so far tried:
StringFormat, SmoothingMode, InterpolationMode and TextRenderingHint and yet I have failed to have much effect.
Does anybody have the answer?
|
|
|
|
|
Hi
I am in the need to develop a .net component that can communicate two different sql server databases. These two servers are physically different location. That .net application will be in server A and it update some data into Server B located in some other place.
Can any one help me to develop database connectivity in either VB.net or C#.NET?
M.Sendilkumar
TVS Infotech Ltd
Chennai
|
|
|
|
|
The SqlConnection object will take a connection string that gives the name of the server. All you need to do is ensure that your .NET component can see both databases. There is nothing different involved from connecting normally.
Do you want to know more?
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
In my development two servers are in different location that means first one is in New Delhi and second one in singapore, not even in private network like VPN.My problems is how to construct a connect string either for SQLServer provider or OleDB Provider
Please find something for me...!
M.Sendilkumar
TVS Infotech Ltd
Chennai
|
|
|
|
|
|
Yes we do have a VPN.
M.Sendilkumar
TVS Infotech Ltd
Chennai
|
|
|
|
|
Can any one help me to understand 'What is 'Thread Safe' in .Net?
Almost all class explanation of MSDN help having this word 'Thread Safe'.
Please help me to understand this.!
M.Sendilkumar
TVS Infotech Ltd
Chennai.
|
|
|
|
|
When you have more than one thread accessing the same object then problems can arise, mostly due to the scheduling performed by the OS.
One thread can start modifying the object and before it's done another thread gets permission to run and will work on inconsistent data.
In this respect, such an object would be not thread safe.
Because implementing a thread safe object can be quite tricky and can include some overhead, not many classes in the framework are really thread-safe.
For a not thread safe class, the developer has to take care that the same object cannot be used by two threads at the same time.
Regards,
mav
|
|
|
|
|
Hi
Mav...
Nice explanation..!
Thanks
M.Sendilkumar
TVS Infotech Ltd
Chennai
|
|
|
|
|
you're welcome.
The problem with threads is that it's very easy to forget that they're there...
Recently I've stumbled across a problem where a customer called and complained about an error message in on of my programs saying that an enumeration cannot be modified within a foreach loop.
I was completely stumped because I had taken explicit care that I'm not removing items from a hashtable I was working with in a foreach, but still this error occurred.
After a while it dawned on me: I had a timer that was checking the entries in the hashtable and this function worked flawless. But I also had a FileSystemWatcher set up that was adding entries to the hashtable. And when this occurred just when the timer callback was running this error occurred.
Luckily, putting a lock(_myHashtable) { ... } here and there solved the problem quickly.
mav
|
|
|
|
|
hi!!
i'm looking for a way to
Managing User Accounts and Gruops at Runtime using C# code...
is that possible??
thanks!
Girls: 0 succeeded, 47 failed, 1 skipped
|
|
|
|
|
HOW TO: Add a User to the Local System by Using Directory Services and Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;306273
.NET Framework Class Library
System.DirectoryServices Namespace
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdirectoryservices.asp
|
|
|
|
|
Hi everybody, Am in great trouble.
I have a project MyApp.exe which is a big project. It has some 20-30 dll dependencies on it. The resource (including dialog boxes) is in a separate dll. This project had been developed in VC6 previously and hs now been ported to .NET. Its running fine.
The thing is, I want to make the dialog boxes appear with the Windows XP visual style. So, when an user selects Windows XP style from Control Panel->Appearance tab, the appearance of the dialogs should change too. It must not have the classic style appearance.
For this, I have followed the methods outlined in MSDN site. I am giving the links too.
1) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/xptheming.asp
2) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/userex/cookbook.asp
Th process given above works fine for a simple dialog-based project.
But, where, even the resource is in a separate dll, there, it doesn't work.
PLEASE DO GIVE ME ANY FEEDBACK OR SUGGESTIONS ASAP.
|
|
|
|
|
HI All,
Just an eager frame of mind an question arises on my mind that how the .net runtime engine bind an assembly to the code executed and also wants to know about the static and dynamic binding of the assembly.
Thanks
Pankaj Gupta
Sr Software Engineer
|
|
|
|
|
Hi ,
.Net provides the Reflection class for loading the assembly at runtime.
this is the dynamic binding of assembly.
For static binding you can go for the Addreference , to add the assembly at compile time.
Regards,
Sukesh.g
|
|
|
|
|
Hi,
I need to build a Web service for a chat application with .NET Remoting. It means the remote objects must be hosted in IIS but IIS is stateless and the only remote object type we can use is SingleCall. However, the application must manage the state of all users who is chatting and I need to use the Singeton object.
I heard that we can use Application state, Session state to keep the state of application like the way ASP.NET does but I don't know how to implement it with .NET Remoting.
Next, it is a service which hasn't got the main() function to construct parameters before the application really starts. So where can I construct these parameters?
Therefore, please help me:
1. How to construct parameters before the application runs?
2. How to keep the state of application?
If you have some examples, could you show me?
Thanks advance.
abc
|
|
|
|
|
|
Hi
We are using Authorization and profile application blocks (Microsoft Design patterns).We are trying to access the Azman Provider we are not able to access the dll which is added in the references already in the client application.If you can provide us some code snippets that would be really very helpful.I am providing my client application here.
*******************Code*********************
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
//Error ,in accessing the reference that is added
using Microsoft.ApplicationBlocks.Security.Provider; //cannot access the provider.
using Microsoft.ApplicationBlocks.Security.Authorization;
using Microsoft.ApplicationBlocks.Security.Profile;
using Microsoft.ApplicationBlocks.Common.Crypto;
using System.Security.Principal;
using System.Configuration.Assemblies;
using System.Threading;
using Microsoft.Interop.Security.AzRoles;
namespace myClient
{
public class WebForm1 : System.Web.UI.Page
{
string userRole="Manager";
private void Page_Load(object sender, System.EventArgs e)
{
Microsoft.ApplicationBlocks.Security.ExtendedPrincipal principal = Microsoft.ApplicationBlocks.Security.ExtendedPrincipal.Create(Thread.CurrentPrincipal.Identity);
Thread.CurrentPrincipal =principal;
principal.AuditIdentifier ="MyAuditIdentifer";
principal.AuthorizationProvider="azmanProvider";
principal.AuthorizationParameters.Add(AzManProvider.ApplicationName,"myApplication");
if(Thread.CurrentPrincipal.IsInRole(userRole))
{
((ExtendedPrincipal)Thread.CurrentPrincipal).AuthorizationParameters.Add("tasks",new string[1] {"AddOrderTask"});
if ( ((ExtendedPrincipal)Thread.CurrentPrincipal).CheckAccess())
{
//quickStart.AddOrder();
}
else
{
Response.Write("Add Order Access Denied");
}
}
Hashtable parameters = new Hashtable(5);
parameters.Add("principal",Thread.CurrentPrincipal);
((ProfileCollection)((ExtendedPrincipal)
Thread.CurrentPrincipal).Profile).
Initialize((ExtendedPrincipal)Thread.CurrentPrincipal);
// Accessing the Profile Information from the ProfileCollection:
Response.Write("Profile Information from the Profile Collection thru the ExtendedPrincipal");
Response.Write("Profile Information: 'Preferred Investment Type' is "+(string)((ProfileCollection)
((ExtendedPrincipal)Thread.CurrentPrincipal).
Profile)["stockProfile"]["preferredInvestmentType"].Value );
Response.Write("Profile Information: 'Trades Frequently' is " +
Boolean.Parse(((string)((ProfileCollection)
((ExtendedPrincipal)Thread.
CurrentPrincipal).Profile)["stockProfile"]
["tradesFrequently"].Value)));
Response.Write("Profile Information: 'Most Traded Stocks' is " +
(string)((ProfileCollection)
((ExtendedPrincipal)Thread.CurrentPrincipal).
Profile)["stockProfile"]["stockTrades"]
["mostTradedStocks"].Value);
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
With Many Thanks
kiran
|
|
|
|
|
This is probably one of the strangest things I think I've seen while working in .NET and I have yet to figure out even a workaround, much less why it might be occurring.
I've got a very strange bug happening which I was finally able to distill down to a problem with writing to ..\..\app.config after a file open dialog. It appears that if a standard file open dialog is closed with the "open" button then any future writes to app.config just magically disappear into the bit bucket (am I the only one still using that term?). No errors, no exceptions thrown. In fact, if you close the app.config stream and open it from scratch, the changes just written appear to be there but when the app finishes, they aren't there. This sounds like a buffering problem but I'm setting the stream to autoflush and flushing/closing it after the save. Also, if you have the file open in the IDE at the time, you can write to it and save it just fine. None of this happens when you hit the cancel key in the open file dialog even though I'm totally ignoring the return from the dialog in both cases. None of it happens with files other than ..\..\app.config (at least not with the sample file I tried in my temp directory).
I have no idea why the file open dialog and app.config would be tied together in such an inextricable manner. I don't know how I'd simulate such a strange situation WRT app.config even if I tried. The best I can think of is to overwrite app.config and change it's creation date back to what it was originally but this isn't happening because I can write to it from the IDE while this is happening and those writes aren't overwritten. This one definitey has me scratching my head.
To illustrate the bug I wrote a tiny app with a single button which calls the following function when the button is pressed. This pretty much illustrates everything I'm talking about (forgive the formatting - all my blank lines seem to drop out in the <pre> block - anybody know how to get them to show up?):
private void XMLBugSave()
{
const string strFile = @"..\..\app.config";
XmlTextReader xr = new XmlTextReader(strFile);
xdoc = new XmlDocument();
xdoc.Load(xr);
xr.Close();
Random rnd = new Random();
string strNodeName = "NODE_" + rnd.Next().ToString();
Console.WriteLine("Attempting to add Element " + strNodeName);
xdoc.DocumentElement.AppendChild(xdoc.CreateNode(XmlNodeType.Element, strNodeName, null));
OpenFileDialog ofd = new OpenFileDialog();
ofd.ShowDialog();
StreamWriter sw = new StreamWriter(strFile);
sw.AutoFlush = true;
xdoc.Save(sw);
sw.Flush();
sw.Close();
MessageBox.Show("Verify file...");
xr = new XmlTextReader(strFile);
xdoc = new XmlDocument();
xdoc.Load(xr);
xr.Close();
XmlNode xn = xdoc.SelectSingleNode(@"/configuration/" + strNodeName);
Console.WriteLine(xn == null ? "unverified" : "verified");
}
|
|
|
|