|
Hi,
In my windows application if I'm getting ExternalException when I use the following to methods if the text parameter is too large.
g.MeasureString(text, font, size, format);
g.DrawString(text, font, color, rectangle, format);
I have tried to make the size and rectangle parameters to be large so that it fits the text, but I still get the same exception with Message : "A Genric error occurred"
Please let me know how I can fix this.
Thanks
Ben
|
|
|
|
|
How big is your string ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Length of the string 103325
|
|
|
|
|
Well, that's just silly
That error generally means you've used too much of a resource, or you've tried to use a resource that's not available to you. With that many chars, I am not surprised.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Is there any work around?
|
|
|
|
|
Instead of trying to draw one large string why don't you break it up and draw them individually?
█▒▒▒▒▒██▒█▒██
█▒█████▒▒▒▒▒█
█▒██████▒█▒██
█▒█████▒▒▒▒▒█
█▒▒▒▒▒██▒█▒██
|
|
|
|
|
I can, but I'm more interested in find out if there is a cutoff on the length of the string that gdi+ can handle thru these 2 methods.
|
|
|
|
|
GDI+ works with strings that are either "Pascal strings" (length + data) or "C strings"
(null terminated), so it has a explicit notion of string length (which gets set to -1
for C strings).
And I would not be surprised there are some 16-bit limitations to integer quantities
(hence max 65535 or even 32767 since -1 suggests signed integers are used for lengths).
one thing I found after a quick Google was:
"Due to a limitation of the GDI+ decoder, an System.ArgumentException is thrown if you construct a bitmap from a .png image file with a single dimension greater than 65,535 pixels."
If you really want to know, continue searching, or perform some experiments.
I would suggest trying string lengths of 32700, 32800, 65500 and 65600.
Luc Pattyn
|
|
|
|
|
|
Hi,
I have added a reference for a managed c++ dll to a c# project. I can view the c++ classes and their methods in the object browser. I can also create an instance of the class objects in c#. However, intellisense does not show the object's methods, and if I try to call them, I get an error about them not being defined.
Anyone experienced this in the past? Any suggestions?
Thanks,
-----------------
Genaro
|
|
|
|
|
Are you using the namespace they are in, or scoping it explicitly ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
They are not wrapped in a namespace. Do they have to be?
-----------------
Genaro
|
|
|
|
|
I expect so. There's no global namespace in C#.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi everyone.
I've been asked to research for a way to retrieve information from a remote pc, which only has modem conectivity, without internet access.
I would just like to know if there's any way of doing this with c#. A good hint to start research would be helpfull as well.
Thanks for everyone's time.
daniel sovino
|
|
|
|
|
I know regular way is to open StringBuilder&StringWriter, etc. Which work fine for flat text.
But overall I believe I need to specify one printFont at end of this method and that is all.
What if I want to print document with pictures and lot's of different fonts (multipage...). Is there some better way to do this?
Thanks!!!
|
|
|
|
|
OK I figured out WebBrowser actually have it's own Print method so scratch that one.
RitchText box is still problem though I have found some solution that involve calling some win32 api methods but it's over complicated and it make program overweight too much.
|
|
|
|
|
|
Hi,
I am working on our new company's website. I have created a dynamic JavaScript script that will generate dynamic links that are based on user's client parameters such as screen width, height etc.
In order to debug and test my scripts, I am looking for a way to created automated tests for different client scenarios.
I am currently using c# 2.0. I have created a form with a WebBrowser object that will simulate different client scenarios. What I am trying to load our website and extract the links from the web client component but here is the catch - I need to extract the links from the document and not from the page source. The reason for it is that when you look on the source, you will not find the links since they are being generated by the JavaScript file. I am confident that there is a way to do it since if I will right click on the links in the webclient component and select to copy the link or if I hover the links, I see the correct ones.
Can you advice on what is the best way to get it done? Will the IHTMLDocument2 component be able to extract those links? If not, is there another way to do it?
Thanks,
Joe
|
|
|
|
|
So, you want to extract the hyperlinks from the actual IHTMLDocument2? This MSDN article[^] covers that scenario.
|
|
|
|
|
I found the HTML Agility pack tool [^]to be very useful.What it does is that it parses any HTML files and extract HTML tag (hyperlinks being one of them).
|
|
|
|
|
|
I want my application to cancel any key stroke from keyboard, any function keys such as Ctrl, Alt, especially Start key and of course any combination of keys
such as Ctrl+C, Alt+F4, Ctrl+Alt+Delete and etc.
Is there any way to do so?
And if there no way to cancel any key stroke generally, is there any way to assign a new functionality to a combination of keys.
As example:
I want Ctrl+Alt+Delete to call some method or make some operations in my application, instead of opening Task Manager.
|
|
|
|
|
Application software really should not do this. Those keys are there for a reason -- I can only imagine the hell if every application overrided the CTRL+ALT+Delete key combo.
If you have a truely legitimate reason for doing this (say, you're on some sort of console and there are no other apps running on the system, and you don't want users to be able to get to the desktop), you can look into Windows keyboard Hooks. There are some articles on this site describing how to do it.
|
|
|
|
|
Yeah, don't do that. Would you want to use an application that did that? I wouldn't.
|
|
|
|
|
Like I said, there could be legitimate reasons (console/kiosk app). If this is vanilla application software for Windows, then no, it's not a legitimate reason, and no, I would not want to use such software.
|
|
|
|