|
You need to put all of your painting code in your form/controls Paint event.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
LOL - you beat me by microseconds.
I'm at the summit, shame you couldn't make it. It's been pretty cool.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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: I'm at the summit, shame you couldn't make it. It's been pretty cool.
Crap! Hopefully next year!
Next time you're in Toronto, let me know. I'll see if I can convince the wife we need a quick get-a-way to Niagra Falls or something! Besides, it'd be interesting to see where all this CP stuff, my wife calls it "porn", in stored.
Christian Graus wrote: LOL - you beat me by microseconds.
You gotta be quick around here!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: Next time you're in Toronto, let me know.
Next Wednesday... Or, did you mean after that ?
Dave Kreskowiak wrote: You gotta be quick around here!
Yeah, it's getting that way.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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: Next Wednesday... Or, did you mean after that ?
Yeah, after that! I'm a bit broke right now.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
In C++, you should have done the same thing you should do in C# - draw your shapes in the Paint event handler of the form, so it gets told to redraw itself when the form is obscured in any way and then shown again.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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.
Regards.
Tasleem Arif
|
|
|
|
|
I am using c# 2005 express Edition and want to create a report in crystal report. I do not see any crystal report icon in the toolbox. Any idea?
-- modified at 7:58 Thursday 15th March, 2007
|
|
|
|
|
Appologise for my earlier post, as mention before i am a new programmer and my posting etiquette needs improving.... again i appologies.
Can anyone help me with a problem of loading in a backgroun onto my form. I know you can load a picture box from the tool box and set this as your background but this is not what i'm try to achieve.
The problem appears to be in this line of my code (code added at bottom)
Bitmap background = new Bitmap(GetType(), "background.jpg");
I get the following error when press F5 to run my app.....
Resource 'background.jpg' cannot be found in class 'Game.Form1'
I have added this image as a resource (solution explorer > title properties > resources > add image.
This is my code in full:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data;
namespace Game
{
public partial class Form1 : Form
{
// insert private bitmap background
// and movement int x/y move etc.....
private Bitmap background = new Bitmap(640, 320);
//private Bitmap car;
//private Bitmap player;
public Form1()
{
InitializeComponent();
//player = new Bitmap(GetType(), "player.jpg");
//car = new Bitmap(GetType(), "car.jpg");
Bitmap background = new Bitmap(GetType(), "background.jpg");
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.UserPaint, true);
Graphics g = Graphics.FromImage(background);
for (int x = 0; x < 640; x += 90)
for (int y = 0; y <= 290; y += 90)
{
g.DrawImage(background, new Rectangle(x, y, 90, 90)); // GraphicsUnit.Pixel);
}
}
}
}
Regards,
Thank you for taking the time to read this
|
|
|
|
|
If you've added the image as a resource, and you're using Visual Studio 2005, you can access it like this:
Bitmap playerBitmap = Properties.Resources.player;
|
|
|
|
|
This is a very strange problem I came across and it's a show stopper for my current app. It happens all the time on the site I'm trying to interact with and it occasionally happens on google.com (or any site I'd imagine).
I'm trying to run a series of events depending on what URL is currently being navigated.
In my WebBrowser's DocumentCompleted event I have a switch which runs a different set of methods based on the URL.
After a document is complete, it'll run the switch fine but it runs what's inside of the case I'm trying to detect more than once. It's easy to see by placing a messagebox output. It'll come up 2 times instead of once.
I tried other ways of determining which page I'm currently on. Like using the DocumentTitleChanged event instead of DocumentCompleted, but I think DocumentCompleted is safer because it won't do anything until the document is loaded. Either way, the problem exists with DocumentTitleChanged too.
Any ideas? Btw I excluded the site where it occurs all the time because it requires a login and unfortunately I can't share it publicly. If you want to do a test, just throw together an app really quick and drop a messagebox into the DocumentChanged event, then have a textbox where you can enter different addresses -- it's bound to come up.
|
|
|
|
|
ThisIsMyUserName2 wrote: It happens all the time on the site I'm trying to interact with and it occasionally happens on google.com (or any site I'd imagine).
ThisIsMyUserName2 wrote: Any ideas?
They hide that information in the DOCUMENTATION[^]
Remarks
The value of the URL parameter might not match the URL that was originally given to the WebBrowser Control. One possible reason for this is that the URL might be converted to a qualified form. For example, if an application specified a URL of www.microsoft.com in a call to the Navigate or Navigate2 method, then the URL passed into DocumentComplete is http://www.microsoft.com/. In addition, if the server has redirected the browser to a different URL, the redirected URL is passed into the URL parameter.
The WebBrowser Control fires the DocumentComplete event when the document has completely loaded and the READYSTATE property has changed to READYSTATE_COMPLETE. Here are some important points regarding the firing of this event.
* In pages with no frames, this event fires once after loading is complete.
* In pages where multiple frames are loaded, this event fires for each frame where the DownloadBegin event has fired.
* This event's pDisp parameter is the same as the IDispatch interface pointer of the frame in which this event fires.
* In the loading process, the highest level frame (which is not necessarily the top-level frame) fires the final DocumentComplete event. At this time, the pDisp parameter will be the same as the IDispatch interface pointer of the highest level frame.
led mike
|
|
|
|
|
Hmm, what can I do to get what I'm looking to do working (only having it trigger once)? It still happens on the DocumentTitleChanged event, I'm out of ideas on determining which URL is currently being navigated.
Here are the cases I look for and the actions that take place depending on which step (URL) I'm on.
At a login screen
-- automatically login
-- goto the search screen
At a search screen
-- search for xx (a number that the user of the app enters which gets auto-incremented)
-- determine if the search returned a result
---- if it did, then move on to the "scrape phase"
---- if it did NOT, go back to the search screen and log it
-- auto increment (here's the part where having it load twice is killing me)
At the Scrape phase (which is the same URL as the search screen except it has a "#search_result" in the URL)
-- Parse out 2 URLs from the search result and navigate to the first address
At first URL result
-- Check for xx (which is entered in my app but will be a constant in the session)
---- if it found it, move onto the second URL
---- if it did NOT find it, go back to the search page
At second URL result
-- Scrape a few pieces of information and store it into a DataSet
-- Go back to the search page and start over
I can't use the WebClient class because it requires slight user interaction due to a random character generator (on their site) coming up on various steps of the procedure. To counter that I check the page source for a specific string that only exists when this page is shown and I perform this check before I run the switch.
|
|
|
|
|
ThisIsMyUserName2 wrote: what can I do to get what I'm looking to do working
Well since you have not stated "what I'm looking to do", I have no idea.
led mike
|
|
|
|
|
Something that would do exactly what DocumentCompleted/DocumentTitleChanged does except only fire once.
ie. Have the ability to figure out which URL is being navigated after a page is loaded and do something based on what URL that is.
|
|
|
|
|
Since you have zero control over the firing of events, I'll refer you to the red text[^] again. You can try counting the number of times the DownloadBegin event fires, incrementing a counter by 1. When the DocumentComplete event fires, decrement that counter. When you reach 0, the page should be done. You might want to double-check with the READYSTATE to see what it says too.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I don't think the Web Browser control has a DownloadBegin event. Remember I am using the Web Browser included with .net 2.0 in c#.
As for the readystate, I tried "if the readystate is Complete then do the switch...", and it still ran it twice.
Also as far as I can see the site is not using frames. At least not frames in a standard sense. They might be using javascript to insert "layers" into the page though.
|
|
|
|
|
Hi:
I have a windows Form in C#. In my project I have multiple namespace1 & namespace2 and 1 Form.
On the Form I have a Button, when clicking this button I need to call-out to namspace2. Is it possible to do this. Please Help.
THanks,
Eyungwah
|
|
|
|
|
Eyungwah wrote: Is it possible to do this.
using Eyungwah.GetAClue
led mike
|
|
|
|
|
You can't call a namespace. Namespaces contain things like classes, interfaces, enums and so on.
If you are in namespace A and you want to use a class in namespace B you have two options.
Option 1: Put a using statement at the top of the file in which you wish to use the namespace. e.g. using B
Option 2: Fully qualify the class, interface, enum, etc. name with the namespace. e.g. B.MyClass
|
|
|
|
|
hi,
can anyone tell me
what is the advantage of xml in small data storage?
why not use access or excel file?
and how can I use xml in desktop application beside that?
thanx
|
|
|
|
|
I prefer XML because it's quite flexible, its output carries a small footprint and works very well with the DataSet class.
Example:
I wrote a small app that gathers data daily from a web site. Usually about 200 things.
I just have it record the information straight into a DataSet, then use the DataSet's built in SaveToXML ability. If I need to open that list at a later time, the DataSet can read the XML file without any extra work.
Also if I decide to send the results to someone I can be sure they'll be able to open it, rather than have to set them up with access, excel, or a custom app that displays the contents within a DataGrid or whatever.
Lastly if I ever decided to publish the results online it wouldn't take much effort to get them into an SQL database.
|
|
|
|
|
maybe when you combine your app with web app
xml as it's adventages
but for desktop app i don't see its better then
access db
am i right?
|
|
|
|
|
The main arguments the other poster mentioned do not depend upon the fact whether your application is a web or windows application. A XML file simply can be read with the simplest text editor, most systems provide some way to display them in a nice way (via browser for example )and there are many ways for further processing of the XML data for example via XSLT or import into other applications. In that way it has its advantages no matter what type of application you use it in.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
i have to make an application that will simply have one form and one DataGrid control on the Form. i have to query from oracle database based on some criteria entered by the user. DataBase can consist of 100 Tera Bytes of data that is why i want to use paging. i tried to find some sample code/artical that will tell me how to do paging in C#. Every one is doing paing with some tricky select command using in clause for omitting the results that user don't want to see. In case of small data this select technique will work fine but in case of large data will it not be very slow. so my question is, Is there any other way to do paging.
Thanks & Regards,
Omar Lodhi
|
|
|
|