|
I have tried all, with or without EnableVisualStyles(), with or without manifest file. Nothing works.
It actually worked for me for a while, but at some point during coding(probably after I changed the font to some labels on the toolbar), it disappeared and would never get back.
Anders Molin wrote:
Does it work if you dont call Application.EnableVisualStyles()?
I have stopped using that, and just put a manifest file together with my app, much less problems...
|
|
|
|
|
|
After a research using Diff tools, I found the problem was the font of the tool bar. It worked fine under default font, but if I change it to any other font, even after I changed it back to the original default font, the images on toolbar will disappear!!!
I don't know why, it's probably a bug of Microsoft.
I wrote a small Windows Form app, it works fine. It's only in my application that the font change will affect the toolbar images.
Thanks,
Jason
|
|
|
|
|
Hi,
In VC++ 6, I can put "\t" in the text of a static control and it will show as a tab. But in VC# .Net, it doesn't work for me? How can I insert a tab?
Thanks!
|
|
|
|
|
Assigning a string to Label.Text (which inherits form Control.Text ) internally calls the SetWindowText native function (most controls encapsulate common controls and Windows Management APIs). SetWindowText does not expand tab characters.
To get this effect, you might consider extending Label and overriding the OnPaint protected method (when extending, override the methods that raise the corresponding events instead of handling the events - it's faster and gives you more control (like deciding whether or not to call base.OnEventName )).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I have a form where I have assigned the left and right cursor keys to perform functions, using the following code:
private void SAPtastic_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
e.Handled = true;
switch(e.KeyCode)
{
case Keys.D1: movecopysap("1"); break;
case Keys.D2: movecopysap("2"); break;
case Keys.D3: movecopysap("3"); break;
case Keys.D4: movecopysap("4"); break;
case Keys.D5: movecopysap("5"); break;
case Keys.D7: movecopysap("Unclassified"); break;
case Keys.NumPad1: movecopysap("1"); break;
case Keys.NumPad2: movecopysap("2"); break;
case Keys.NumPad3: movecopysap("3"); break;
case Keys.NumPad4: movecopysap("4"); break;
case Keys.NumPad5: movecopysap("5"); break;
case Keys.NumPad7: movecopysap("Unclassified"); break;
case Keys.Space: movecopysap("Unclassified"); break;
case Keys.Back: if (apnt > 0) {apnt = apnt - 1; LoadnScale();} break;
case Keys.Left: if (apnt > 0) {apnt = apnt - 1; LoadnScale();} break;
case Keys.Right: if (apnt < (al.Count-1))
{apnt = apnt + 1; LoadnScale();} break;
case Keys.Home: apnt = 0; LoadnScale(); break;
case Keys.End: apnt = al.Count -1; LoadnScale(); break;
default: e.Handled = true; break;
}
}
The odd thing about this was that whilst I did create an override on IsInputKey to allow me access to the cursor keys, it is never called - if I remove it there is no difference to the operation of the program.
That is not the REALLY WEIRD THING, I added a toolbar at user's request and now the cursor keys need to be pressed twice in order to get them to function. The above code is not called on the first keypress, but is on the second.
I gets worse... I included an option to not display the toolbar, if the toolbar is disabled - the keys work fine!
Any assistance would prevent me having yet another sleepless night and so would be much appreciated!
Chris
|
|
|
|
|
Is this code in a Form to handle the various inputs? If so, set Form.KeyPreview to true . Since child controls will have the focus, the parent Form will not receive key notification messages unless KeyPreview is true .
I'm not sure why the toolbar would change things, but I'm guess that internally (the native Toolbar common control) is that it routes messages to the parent, perhaps causing other child controls to do it, too. Not sure, though.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks for the reply - I was beginning to wonder if anyone would answer my plea!
That property is already set, I too am unsure why the addition of the toolbar would change things. With this in mind I returned to a previous version of the code before the toolbar was added, the mear addition of the toolbar without adding buttons or changing settings resulted in the same behaviour.
I may have to replace the toolbar with a groupbox and ordinary buttons ;-(
|
|
|
|
|
I have been trying to monitor the handshake (signal) from
a printer for each page it printed but i have not been
able to do so. Can any out there help me.
|
|
|
|
|
That might be a little too low level for C# to handle easily. In the Windows DDK there are a set of parallel port functions you can try to hook into (like IOCTL_INTERNAL_GET_PARALLEL_PORT_INFO ) but I don't think any of them have been exposed in C#. And that assumes that you are using a parallel port printer.
If you are doing lower level OS I/O, C# tends to be a poor choice to use. The abstraction layer PrintDocument is there to avoid the messy OS level details of talking to the hardware. Why are you interested in the hardware communication?
|
|
|
|
|
Am interested because am writting a printer monitoring program that will monitor the printerout from any printer.where am having problem is getting the actual number of pages printed and also to be able to know when a page is printed in a situation where there is more than one page of the document.
|
|
|
|
|
I have written my first .NET app (yes, I'm a .NET newbie) very simple app just testing out some of the form functionality. Everything works well on my machine but when I copy it to our network and execute it from there I get
a System.Security.SecurityException thrown (Additional Information: "Request Failed") when creating the main form, Form1.
I know this is probably something simple but would really appreciate the help. I haven't done anything related to security yet (at least not that I know of!) so I would have thought that security wasn't an issue
Help! I'm going nuts
thanks in advance
CJE
|
|
|
|
|
1) Open Control Panel -> Administrative Tools -> Microsoft .NET Framework Configuration.
2) Expand Runtime Security Policy -> Machine -> Code Groups -> All Code.
3) Select Properties from the right-click menu of LocalIntranet_Zone.
4) On the Permission Set tab change the Permission Set to FullTrust.
|
|
|
|
|
YES!! you are a life saver...thanks
|
|
|
|
|
This is not necessarily the best idea. You're saying that you fully trust ANY code running from the Intranet zone. If you're so sure, you could do this, but a better way is to right-click on either All_Code under the machine policy, or the Intranet_Zone and add a new Url membership using the server name and directory like so: file://SERVERNAME/Directory/* (you can use more directories if you like). If you did this with the Internet_Zone code group, you're opening your machine up for any kind of .NET attack possible. The Intranet_Zone could contain code just as harmful, either intentionally or unintentionally.
You'd be better off managing separate code groups for your applications and leaving the default permissions.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Quick Question: How can I rotate an image using GDI?
Extended Question: I am playing around with an application that is a very quick and dirty fax viewer, the user loads an image into a picture box and from there can apply various transforms on it to make the fax more legible.
When the user selects a transform, I retrieve the image object attached to the picture box and get the graphics object from that image, from there is all gets a bit fluffy, I have tried using
g.RotateTransform(90)
g.Transform.Rotate(90)
And also creating a matrix and transforming using that (as described in the MSDN), but none of these methods seem to work. After some trawling through CP I havent found anything that using rotational transformations (although the articles by Christian Graus in the C# GDI section are brilliant, the only thing he doesnt do is rotation)
post.mode = signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
|
Thanks for the reply, obviously missed that one
Just incase anybody is searching the forums for the same answer as I was. The project above does exactly what it says on the tin, but it over complicates something that turns out to be quite simple.
I found that an bitmap object has a RotateFlip method, that allows you to specify certain flip and rotation methods.
e.g.
myBmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
myBmp.RotateFlip(RotateFlipType.RotateNoneFlipX);
....(and many more)
These work as they should, but you need to bear in mind that the rotation is carried out in memory so you need to write back the amended data into the bitmap object.
e.g.
System.IO.Stream imgStream = new System.IO.MemoryStream();
myBmp.Save(imgStream, destFormat);
post.mode = signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
Does anyone know how to add a linefeed to a XML comment. I can add them manually inside the comment, but NDOC wants to bunch the text together.
Example
becomes
This is a test
in the documentation file.
How do I get it to do this
This
is
a
test
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Use <br /> . And to be fair (since I'm on the NDoc team), any XML parser canonicalizes text based on the canonicalization method used by the parser. All parsers of which I'm aware treat line breaks as spaces between matching tags and ignore them (depending on the whitespace settings) between adjacent tags. It's not NDoc that's ignoring them, it's the XML parser we use (which is, of course, the parser in the System.Xml.dll assembly).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks that did the trick
Heath Stewart wrote:
And to be fair (since I'm on the NDoc team), ...
I wasn't complaining, I was just pointing out that it behaved differently than I expected.
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
Actually I want in my application that when a user presses right click on the button than a popup menu will open with different options. How can i develop this popup menu.
If there are any articles regarding this also write them in the answer
Thanx in advance
Regards
MInamKhan
Inam
|
|
|
|
|
From toolbox add a ContextMenu to your form and add options to it. Then set the ContextMenu property of button to the name of this ContextMenu .
Mazy
No sig. available now.
|
|
|
|
|
Hi,
I want to automate a frequently download on a web site that provides data. This one uses cookies to recognize its members an autorize them to download.
The problem is that using the WebRequest class to access this file, the Server I want to connect to doesn't search cookies on my computer, and so doesn't recognize me as a member.
How can I do ?
Thank you very very much ...
|
|
|
|
|
See the HttpWebRequest.CookieContainer property documentation in the .NET Framework SDK. Provide a CookieContainer to store cookies.
Also, a server does not search your cookie collection. That would be extremely dangerous (although there are security holes in implementations some times that allow servers to request a different cookie)! The browser sends cookies for the server and path relative to the request.
You'll have to devise a way to get the cookie and put it in the CookieContainer , though. The HttpWebRequest.Credentials property may help as well since you require authentication, those forms authentication makes implementations like this difficult.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|