|
ok.....where can I get it and can you provide any examples of how I can use it?
Sorry, I am new to this stuff.
Brian
|
|
|
|
|
Download page[^].
Use the method LoadFile to load the pdf file.
AcroPDF1.LoadFile ("c:\a.pdf") . Good luck.
<italic>Work hard, Work effectively.
|
|
|
|
|
|
Can someone please help me with correcting the following code. Everything is fine until you expand the window (the text gets all messed up).
Create a new windows form 300x300 and put the following code into the constructer after the InitializeComponent call. An run it, you will see my problem.
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics dc = CreateGraphics();
// Set the bounds for redrawing, initial client size is 300x300
if (dc.ClipBounds.Top < 300 && dc.ClipBounds.Left < 300)
{
int screenHeight = Convert.ToInt32(ClientSize.Height);
int screenWidth = Convert.ToInt32(ClientSize.Width);
// Set up string.
string measureString = "This is just a test to see if this text will wrap the screen whilst also resizing with the window";
Font stringFont = new Font("Arial", 12);
// Set maximum layout size.
SizeF layoutSize = new SizeF(ClientSize.Width, ClientSize.Height);
// Measure string.
SizeF stringSize = new SizeF();
stringSize = dc.MeasureString(measureString, stringFont, layoutSize);
// Set the bounds for the text when drawn to screen
int quewidth = Convert.ToInt32(ClientSize.Width);
int queheight = Convert.ToInt32(stringSize.Height);
Rectangle questionRect = new Rectangle(0, 0, quewidth, queheight);
int screenheight = Convert.ToInt32(ClientSize.Height);
// Draw rectangle representing size of string.
dc.DrawRectangle(new Pen(Color.Red, 1), 0.0F, 0.0F, ClientSize.Width, stringSize.Height);
// Draw string to screen.
dc.DrawString(measureString, stringFont, Brushes.Black, questionRect);
dc.DrawString("quewidth = " + quewidth + "\n screenheight = " + screenheight + "\n", stringFont, Brushes.Black, new PointF(50, stringSize.Height+12.0F));
}
}
|
|
|
|
|
Had you set the ResizeRedraw property to true?
|
|
|
|
|
Where do i set that? I don't understand what you mean.
I managed to solve the messed up text by using dc.Clear(this.BackColor); at the start of the drawing loop.
It now works fine (be it not so smooth) but if you drag the window bigger width ways (redraws the text ok) , then drag the window smaller width ways nothing happens!!?? The text doesn't redraw until you minimize/maximize the form.
|
|
|
|
|
So you have to write in the Resize event of the form some code that makes the font smaller ,or just make the current size of the form is the minimum size so they can only maximize it or make it back to that size,but not smaller.
|
|
|
|
|
These two functions are not working in my forms. I want to close the 1st form when i open the 2nd one, that from a link on the first form(a button u understand). But i've tried all techniques dat my mind may hav told me 2 use, none of them are working. Tell me, please, how to use these two functions, as well as how to do wat i want to: close 1 form wen next opens(like in a game).
Please donot mind if i tell xtra things. This is my 1st message, and i dont frequent the net.
Jeea
|
|
|
|
|
Basically, it sounds like your trying to close a form that you can not close (unless you want your app to close that is). You haven't said what the forms are doing, so I'll have to take a guess...
Your startup form can't close, period. What you need to do is structure your app around a central form that manages your entire application. For instance, when newbies try to create a Splash screen for their application, they make the mistake of making the Splash screen the startup form. NO! Your main application must either startup from a custom Main or it must startup from your applications main form, not the Splash screen.
For some examples, search the articles for "splash screen".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am having a problem with creating a file in c#. More specifically, a problem that happens to the file after creation.
First off, here is my code:
<br />
string strFileName = "c:\Test\file.log";<br />
if(!System.IO.File.Exists(strFileName))<br />
{<br />
System.IO.File.Create(strFileName); <br />
}<br />
The file is created just fine. The probelm is that the aspnet_wp process keeps the file locked after it has been created so I can not write to the file. I can't even open it or delete the file manually. I have to go into Task Manager and kill the process.
Is there some sort of cleanup I am missing here? Is it my code or the environment or...???
Thanks.
|
|
|
|
|
|
That worked great! Thank you!
|
|
|
|
|
Basically what I have is a an IM program. I set up a delegate function that monitors messages from a server, and upon a given message coming in, it launches a new message window. I created my own component that extends the PictureBox class which holds info about the user in the list, and one of the components is a pointer to the Message form. If it is null then a new one is created, otherwise it appends the chat messages to the richtextbox. Now my problem is, when the message comes through, I create a new Message form if the pointer is null, set the pointer to the new message, and call message.Show(). This seems to cause the Message form to hang and it doesnt display any of the controls. However if I do ShowDialog() it all works perfectly except only one message gets displayed until the user closes the window, obviously. Any thoughts? I'm thinking it has something to do from where I'm calling it. Here are some snippets of code:
The GraphicComponents.ImageComponent is my extended PictureBox class with the window property that points to an instance of the Message class, or null, of which Window gets or sets.
private static void ProcessTextMessage(string msg)
{
String[] data = msg.Split(':');
String from = data[0];
String message = data[1];
Message msgWindow;
Debug.WriteLine("Message received from: "+from+" MSG {"+message+"}");
foreach(GraphicComponents.ImageComponent member in users)
{
if(member.UserName.Equals(from))
{
if(member.Window != null)
{
msgWindow = member.Window;
msgWindow.AppendData(from,message);
}
else
{
//The Show method is in the constructor, did have it
//here but still did not work
member.Window = new Message(from);
msgWindow.AppendData(from,message);
}
break;
}
}
}
Any thoughts? Thanks.
|
|
|
|
|
I bet the thread on which you're calling Show doesn't have a message pump. Is it a thread that you created on your own or a threadpool thread?
For Show to work, the thread that calls it must be running a message pump (Application.Run(...) ). ShowDialog creates its own message pump, so that's why it worked for you.
As a solution, you can either start a message pump on the thread that calls Show or you can marshal the call to an UI thread using BeginInvoke .
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
The basic rundown of execution is as follows:
Majo is the main class of which Application runs
A new instance of the Web project is instantiated and called
The delegate functions are set up in Majo as well as Web
The functions then receive messages sent from the server and this is where I am calling the Show() for a new Message form
I have a setupHandlers() method in Majo that instantiates the methods for receiving the messages:
ClientServer.messageEvent += new Web.ClientServer.MsgHandler(ProcessTextMessage);
ClientServer.connectEvent += new Web.ClientServer.MsgHandler(ProcessConnectMessage);
ClientServer.statusEvent += new Web.ClientServer.MsgHandler(ProcessStatusMessage);
Then with the code above, the ProcessTextMessage is called with the user that sent the message as well as the message itself and this is where I'm creating a new Message form that is more or less an IM window. If I were to implement one of the above solutions, how would I go about doing so? I have not worked with BeginInvoke before but I have a feeling that this could be the problem. I Just find it odd that when it creates the Message window, you can see the outline of the controls but they don't get drawn. Thanks for the reply.
|
|
|
|
|
I think not calling BeginInvoke is the problem. To know why, you have to understand how Windows messages work. Basically, any action that you do on the UI, like clicking on a button, gets translated to a message and is posted to the application's message queue. Every Winforms application is provided with a thread on startup, whose only job is to process messages in the message queue, also called message pumping. Without processing messages, none of the UI commands will go to their handlers, in fact, the window itself won't get rendered properly. Your event handler runs on a thread pool thread, which doesn't have a message pump and that's why you get a half drawn window.
In .NET, Application.Run(...) in the Main method of any Winforms application does the message pumping.
Do you have a reference to the main form (or one of the controls in that form) inside ProcessTextMessage? If so, you can just do
private delegate void ProcessTextMessageDelegate(string text);
private void ProcessTextMessage(string text)
{
if (control.InvokeRequired)
{
control.BeginInvoke(new ProcessTextMessageDelegate(ProcessTextMessage), new object[] {text});
return;
}
form.Show();
}
control is either the Form object or some control that is in the form. The above piece of code results in another call to ProcessTextMessage, but this time on the UI thread (which means there is a message pump).
In the second call, InvokeRequired will be false, so it won't go inside the if block.
If you want to know more about BeginInvoke/InvokeRequired, you can take a look here[^]
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Can anyone Suggest how I can display Multiple Line text in ListView Cell.
|
|
|
|
|
Hi all, I know this is a known question but so far I have not found anything that will help me.
Is there a way to format the background color or the text color of a an entire row (or a cell would be better) based on the contents of a cell?
Think of this with an example, if I want to register students passing scores and 7 is the minimum passing score, I want to show all the students with score les than 7 in red, and all others in blue.
Thanks to all.
Best regards,
Jose Guay
|
|
|
|
|
Have a look at DataGrid.Item.
For instance, you could loop through the DataGridItem collection of your DataGrid and change its backGround property based on the cell's contents
Hope this helps
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thanks for the tip Polis, but DataGridItem is for ASP.NET and I'm using WinForms.
If you can point me into another direction I'd really appreciate.
Best Regards,
Jose Guay
|
|
|
|
|
Oh I am sorry Jose.
It seems that for a reason I got the impression that u were dealing with ASP.NET. Anyways, even better. Have a look here[^] for your answer. In fact, have a look at the remaining part of that website. I am pretty sure that any other questions you might have regarding the DataGrid control have already been answered in there. It's an excellent resource.
Hope this helps.
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Can any one help me out how to write the code for addin in C# which creates a button on command bar and on click of that button entire document data shuld be saved to database.(not only word but this should work for every office application ppt,xls,doc..it shuld be generic to office applications)
text selection shuld be hidden from user how?
how to add customdocument property of an office application thru C#? this can be done i VB.NET but it has some issues with C# plz help me out
|
|
|
|
|
hi everyone i need to know how can i transfer the instant voice comes from the mic through the network to another client in chat Application any help with this ?
is there any one can help me with that option ?
Miss With The Best And Die Like The Rest
|
|
|
|
|
I'm writing a desktop security application which uses findwindow and showwindow API's to hide the desktop. The problem I have is if the user double clicks on the background the start menu appears. This also occurs if you set the policy value NoDesktop.
<br />
Hive: HKEY_CURRENT_USER<br />
Key: Software\Microsoft\Windows\CurrentVersion\Policies\Explorer<br />
Name: NoDesktop<br />
Type: REG_DWORD<br />
Value: 1<br />
Can anyone tell me how to stop the start menu from appearing?
Thanks in advance!
I reject your reality and substitute my own!
- Adam Savage, Mythbuster
- George W Bush
life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.
|
|
|
|
|
I have a property grid which shows a set of properties of a Label the user selects. I can move the label around and resize. When the user changes one of the properties the PropertyValueChanged event handler is fired, and it sets a flag to true (I use this flag to check if the programs has to save the work on exit). However, when I resize or move the labels with the mouse the values of Location and Size in a property grid don't change, and the handler isn't fired.
The question - how to make the property grid show these changes?
|
|
|
|
|