|
Interaction.InputBox returns when it is done
If the user clicks Cancel, a zero-length string is returned, otherwise the actual input.
That tells it all, doesnt it ?
|
|
|
|
|
yes but suppose user does not want to enter the reason i mean reason is optional
then if user click ok then the string is blank right?/
how to differentiate in this case when user want to enter a bank reason and clicks ok
|
|
|
|
|
You can set DefaultResponse to something, it will be returned when the user does not
enter anything but clicks OK; I guess it will also show as the initial value.
Examples:
- "Please specify reason"
- "?"
- " "
each of these will be erased on cancel, and possibly modified and returned on OK
If that does not suit you, write your own form !
|
|
|
|
|
Hello,
I'm using the webbrowser in my litle email client. I'm editing the message in the browser, then accessing it over DocumentText and sending later.
Does anyone know how to change webbrowser's encoding from code?I tried:
webbrowser.Document.Encoding = "windows-1250";
and actually it puts the correct encoding into the html code, but it deletes all the special characters in the html.So I will get:
<META http-equiv=Content-Type content="text/html; charset=windows-1250">
which is correct but eg. for this
Čeština je krásná
I get just:
<br />
<p>etina je krsn</p><br />
This happens when I'm changing the encoding after the editing of the document is finished. I tried to first change it to windows-1250 and then edit the content, but actually every time I edit something in webbrowser it changes back to utf-8, which is default I suppose.
Any help on this appriciated
Thanks
Honga
|
|
|
|
|
Hi!
I have the following situation:
A panel called "BayContainer" some custom-controls from type "Bay" should be filled by file-drag&drop.
So i created a method called "insert", that gets the position, the filename and the "BayContainer.Controls"-Object, where the newly created custom-control should be placed, as parameters
When dropping a file into the panel the position is being calculated, the control is created, size and position are set. The first file works fine, but the 2nd control is not being painted (allthough it seems to be there because it received events, that are being connected to the new control).
Any ideas, why the 2nd, 3rd, etc... control do not appear inside the panel?
Thanx for help!
J.
|
|
|
|
|
Hi,
I would like to know one thing. On installation some applications restart
the machine and automatically run some dlls on system reboot. But this dll
will not run on every reboot. It runs only on this application installation
process.
Can this be done in C#? Any one please put some light on this...
Thanks in advance:
Rakesh
Rakesh
|
|
|
|
|
dlls cannot be run, without a host program to run them. To run an app on reboot, put an entry in the 'runonce' key in the registry.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks a lot for the Idea. This runonce concept definetly solves my purpose.
But I am facing some issue here. I have placed a string value "E:\test\runtoadd.bat". And this batch file consists of a command which runs a registry file which inturn resets a registry key.
Then I reboot my machine and observed that the batch file and .reg are running on the reboot but the the thing is the registry key is not getting effected. Can you please let me know what is mistake here.
Thanks:
Rakesh
Rakesh
|
|
|
|
|
perhaps your batch file does not have permission to make the change ? What if yuo run it from the command line, does it change then ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yes. When I run from the command prompt it changes...
Rakesh
|
|
|
|
|
As Christian says it may be a permissions problem, which registry key are you trying to change ?
|
|
|
|
|
Greetings all,
I can drag and drop a bitmap from a small picture box (pictureBox1) to a larger picture box (pictureBox2) and it works fine until a repaint, at which point the large picture box reverts back to what it was before the drag and drop. Thank you in advance. Any ideas to fix this would be appreciated. (Thanks to Rehan Nadeem for the Win32Support code!)
private void pictureBox2_DragDrop(object sender, DragEventArgs e)
{
if ((e.Data.GetDataPresent(DataFormats.Bitmap)))
{
Point largeBitmapLocation = this.pictureBox2.PointToClient(new Point(e.X, e.Y));
// 1. Get a handle to the large bitmap device context
Graphics largeBitmapDC = this.pictureBox2.CreateGraphics();
IntPtr largeBitmapHdc = largeBitmapDC.GetHdc();
// 2. Get a handle to the small bitmap device context
Bitmap smallBitmap = (Bitmap)(e.Data.GetData(DataFormats.Bitmap));
int smallBitmapHeight = smallBitmap.Height;
int smallBitmapWidth = smallBitmap.Width;
IntPtr smallBitmapHdc = Win32Support.CreateCompatibleDC(largeBitmapHdc); // in-memory
Win32Support.SelectObject(smallBitmapHdc, smallBitmap.GetHbitmap());
// 3. draw the smallBitmap on the largeBitmap
Win32Support.BitBlt(
largeBitmapHdc, // largeBitmap is target
largeBitmapLocation.X, largeBitmapLocation.Y, // destination
smallBitmapWidth, smallBitmapHeight, // source width, height
smallBitmapHdc, // smallBitmap is source
0, 0, // source x,y
Win32Support.TernaryRasterOperations.SRCCOPY);
Graphics memDC = Graphics.FromHdc(smallBitmapHdc); // for ReleaseHdc
IntPtr hMemdc = memDC.GetHdc();
memDC.ReleaseHdc(hMemdc);
largeBitmapDC.ReleaseHdc(largeBitmapHdc);
}
}
charles922
cepeasley@earthlink.net
|
|
|
|
|
charles922 wrote: this.pictureBox2.CreateGraphics();
This is why. If you create a graphics object, then as soon as the paint event is called, it will overdraw whatever you drew. Why on earth would you draw on top of a picture box, that' kind of redundant, isn't it ?
Do your drawing in the paint event, then whenever the control is invalidated, your code will draw what you want drawn.
Why are you using BitBlt instead of using the GDI+ methods ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: draw on top of a picture box
That is a bit on the redundant side...
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
A lot of people seem to grab a picture box as 'the thing to use for a picture', then call CreateGraphics to draw on top of it. I'm curious to know how they find out about this method, while simultaneously completely failing to understand what it is for, is there a bad article on CP that points them in that direction ? I keep meaning to write an article on what CreateGraphics is and isn't good for, and why it's redundant to create a control, just to draw on top of it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: is there a bad article on CP that points them in that direction ?
I am not sure why it is.
Christian Graus wrote: I keep meaning to write an article on what CreateGraphics is and isn't good for, and why it's redundant to create a control, just to draw on top of it.
Go for it. You got my support
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
I havent seen a reason for this misconception either.
Is the name confusing, should it have been called an ImageBox ?
And what is next ? painting text over a TextBox ?
Anyway, I dont use PictureBox at all; I prefer to paint on a Panel.
On one hand I then have to load the image file and do the DrawImage,
on the other hand I can easily add text, borders, whatever, and have the scaling match up.
Greetings.
|
|
|
|
|
Exactly - a lot of the questions relating the picture box involve the assumption that it's a lot more than it is ( I've seen people ask about transitions like Powerpoint, for example )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
>>Why on earth would you draw on top of a picture box, that' kind of redundant, isn't it ?
Christian, thanks for your prompt response. Perhaps it is redundant. Imagine a wall full of empty photograph frames. That's the destination picture box. Now imagine a number of photographs, perhaps in a shoebox on the floor. The photos in the shoebox are the smaller bitmaps (also displayed in picture boxes) that our intrepid user will be dragging to one of the frames on the wall.
>>Do your drawing in the paint event, then whenever the control is invalidated, your code will draw what you want drawn.
Please excuse my brain malfunction. It must have been the UFO's. I had the code in the paint event, and for some reason moved it. <<insert homer="" simpson="" 'doh!'="" sound="" here="">> I put it back in the paint event and all is well now. Thanks again. (Proof that working 8 hours a day on old C code will indeed rot your brain.)
>>Why are you using BitBlt instead of using the GDI+ methods ?
Excellent question. Answer: (1) Old habits die hard (2) I had read "on the Internet" that BitBlt was so fast; however, DrawImage() is working plenty fast for me. (Lots of overloads for DrawImage() ! )
charles922
|
|
|
|
|
Hi,
I want to show how my datas make progress ,while they are being sent from My Computer to the Web Server. Here is the scenerio :
I have a web service and some pictures is being gone to the web server including my Web Service stuffs and my webservice takes the pictures and blah blah blah. and i send these pictures as byte and from my computer using a windows apps coded with c#.After i click on the send button,a little form must be appeared and show the progress how made to users. The datas are being sent to web server from my computer.as a result that i want to inform the users with a progressbar control . I hope I could descripe my problem to whom wanna help me.
Thanks in advance.
I am not a perfect programmer,but i have perfect's programmers' habits.
|
|
|
|
|
atarikg wrote: i want to inform the users with a progressbar control
Just do it then. What exactly is your question? Opening a little form when you click on a button is very easy to do. Are you trying to figure out how to update the data flow metrics to the progressbar control?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
yeap. This is what exactly i want.
How can i do that ?
Paul Conrad wrote: Are you trying to figure out how to update the data flow metrics to the progressbar control?
I am not a perfect programmer,but i have perfect's programmers' habits.
|
|
|
|
|
What I want to do is programmically assign a Form to be displayed on a specific monitor connected to my computer. Say that I have more than one video card in my computer, what I wish to do is choose which card displays a Form.
I've been looking at the Screen[^] class, and it seems to have the functionality I need. Some code snippets I've found here and there show to take the Bounds property of a specific Screen and assign its value to the Bounds property of a Form . The Form will then be displayed in the specified screen.
However, the above, I think, assumes a multi-monitor situation in which the desktop is being displayed across two or more monitors. That's not my situation. I want to have more than one monitor that are independent of each other. The idea ultimately is to have a video being displayed on one form using Managed DirectX and another video being displayed on another form, both in full screen mode (and on seperate screens).
Unfortunately, I only have one monitor connected to my computer at this time, or I would experiment to see what happens. Before I go out and purchase a second video card, I thought I would post my query here to see if anyone can offer any insights into how I can accomplish what I described above. Thanks for your time.
|
|
|
|
|
Hi Leslie,
I dont have all the info, but here is some:
1.
in desktop-across-multiple-monitors, you get one large desktop, and the coordinates of
your Form decide where it will appear i.e. on which monitor(s), it could be split
over more than one. They dont have to have same dimension, nor same settings.
Task bar would be in primary monitor. IIRC maximize expands the form to a single monitor,
the one it occupied most or something like that.
2.
what is against multi-monitor desktop ? You can still have one form fill the first monitor,
another form fill the second monitor (etc etc)
3.
lots of laptops have a video out connector, often with a separate video controller
behind it. My Dell Inspiron can switch between off, same image as own monitor, or
separate monitor; so you could combine your monitor with someone's laptop and experiment.
Hope this helps
|
|
|
|
|
Luc Pattyn wrote: what is against multi-monitor desktop ? You can still have one form fill the first monitor,
another form fill the second monitor (etc etc)
My goal is to give a multi-media presentation in which I have one or more screens in the background playing videos. When the videos are not playing, the screens should be blank, i.e. not showing the desktop. I don't want the audience being able to see the mouse moving around or elements of the desktop on the screen.
One obvious way to prevent this would be to switch off the display devices when there's no media playing, but I'd like to automate this as much as possible from the computer. Blanking out the screens may be possible using a mult-monitor set up, though.
Luc Pattyn wrote: lots of laptops have a video out connector, often with a separate video controller
behind it. My Dell Inspiron can switch between off, same image as own monitor, or
separate monitor; so you could combine your monitor with someone's laptop and experiment.
That's a good suggestion, thanks.
At this point, I'm doing research for a client I've done work for in the past. If I can demonstrate that I can create the type of functionality I described above, I'll be able to move forward and do the job for them.
|
|
|
|