Jump to content
Xtreme .Net Talk

Cags

Avatar/Signature
  • Posts

    699
  • Joined

  • Last visited

Everything posted by Cags

  1. Basically what you need todo is the following steps ... - load the image into a picture box. - in the mouse down event of the picture box, add code to store the x & y co-ordinates of the cursor - in the mouse up event of the picture box, you do a calculation taking away the current x & y co-ordinates from those stored earlier. You may also wish to add code to the mouse move event, to draw an actual rectangle so you can see which bit you are selecting. If you need more help with the actuall code behind this then just say, but I don't personally know much of the VB.Net Syntax, as I've never used it.;
  2. I am developing an application for pocket pc (so compact framework), this application will contain many tabpages with many controls on each. At certain points i will need to run through a list of strings calling methods from the control with the ID property matching the list entry. My current thinking is that I could achieve this by doing something abit like this.... // For each Item on list for(int i = 0; i < myStrings.Length; i++) { // For each Page for(int j = 0; j < TabPages.TabPages.Count; j++) { // For each Control for(int k = 0; k < TabPages[j].Controls.Count; k++) { If(myStrings[i] == TabPages[j].Controls[k].ID) { //Call Method bFound = true; break; } } if(bFound) { bFound = false; break; } } But this seems like it could be really slow... Another way I thought about doing it would be as I add each control to a tab page, I also add a reference to it to an arraylist. That way I would only have to loop through the list, and the arraylist. The problem with this is I'm worried it would use alot of resourse which are in short supply with the PocketPC. So my question really is, will that method be much quicker, and how many more resources is it likely to use...
  3. Thats pretty much what I thought, but its always good to get clarifications, thanks.
  4. If i have a value that I wish to be used within a custom control. And this value is never accessed from outside of that control, I assume its better to set and get it by assigning and calling the variables as opposed to writting a property... is this the case? Also if i wanted to access a property from outside the control, what are the advantages of using a property over a public variable.
  5. I'd say your on the right lines, another method for turning string's into int's would be to use this line.. int.Parse(textbox.Text);
  6. I could be wrong, but surely the image is always going to be of a smaller file size, since if you reduce the resolution of the image, there will be less pixels, and thus less pixel data stored in the file.
  7. I don't know if its possible to add controls, but you could always set the FormBorderStyle to None, (thus not showing the titlebar), and make your own implementation of it.
  8. Controlling the position of the form on the screen is simple, just set the Location property of the form (or the left and top properties). As for preventing the user moving the form you could set the FormBorderStyle to none, this would prevent them from moving it. If you still required the control box controls in the top corner you could make a custom implementation of them.
  9. If the button is part of your program, then you can add the code to a seperate method, and call it from both the OnClick event, and the OnMouseMove event of the button. If you wish to click a button that isn't part of your program, then I'd have thought this could be used maliciously, and thus would not be answered by this forum. (Thats upto the admins I suppose).
  10. Cags

    Cast by string

    I'm obviously not explaining myself very well because nobody seems to understand what i'm trying todo (either that or I'm not understanding them). My application currently works fine with a known amount of controls, but I would like it to work with an unknown amount. Essentially what I want todo is eliminate the switch statement so that i do not have to change the code of the main application in order to support extra controls. Heres an example of the structure of my application... My control strucure is as follows... MainControl: Properties: UniqueID Heading MustComplete ChildControl1: Inherits Main Control Extra Properties: Count Labels[] ChildControl2: Inherits Main Control Extra Properties: ColumnCount RowCount And the way I would currently create my "Document" is as follows... private void LoadControls() { string sType = ReadXML(Type); Switch(sType) { Case "ChildControl1": ChildControl1 myChild1 = new ChildControl1(); LoadCommonProperties(myChild1); myChild1.Count = ReadXML(Count); // reads count from xml myChild1.Labels = ReadXML(Labels); // reads in the labels from xml myChild1.Parent = myPanel; break; Case "ChildControl2": ChildControl2 myChild2 = new ChildControl2(); LoadCommonProperties(myChild1); myChild1.RowCount = ReadXML(RowCount); // reads count from xml myChild1.ColumnCount = ReadXML(ColumnCount); // reads count from xml myChild1.Parent = myPanel; break; } } private void LoadCommonProperties(object myControl) { MainControl myTmpControl = new (MainControl)myControl myControl.UniqueID = ReadXML(ID); myControl.Heading = ReadXML(Heading); myControl.MustComplete = ReadXML(MustComplete); } Although in this example I read in the properties application side, I could obviously just add a method to the control todo this, and just pass it the xml. But the thing thats got me is in order todo this, I first need an object of the type ChildControl1, or ChildControl2, so that it calls the correct LoadProperty method. Any Ideas?
  11. Cags

    Cast by string

    I guess I'm not quite understanding how that method works divil. Since all the properties of a control will need setting (using data from the xml) when it is added to my "Document", and some of the controls have properties not implemented in the Master control, how do i then set these properties, without casting to a control of that type.
  12. Cags

    Cast by string

    I looked up this command on MSDN and it states that it must be passed a Type. For this reason I'm not understanding how the command would be usefull. All of my controls inherit from a MasterControl, so obviously I could pass that type which would assumably allow me to access the main inherited properties, but each control contains custom properties not implemented in the master control, so surely there would be no way of accessing them using this method.
  13. have you tried this... float fCost = (float)TextBox9.Text;
  14. Cags

    Cast by string

    Essentially the project I am working is an application that can read a data file (xml), and construct objects from the information it reads in. These objects are user controls created by myself. At the moment the way it works is it will read in a string such as "Matrix", it will then loop through a large Switch statement, find the case for "Matrix", and run code like this... Matrix myMatrix = new Matrix(); This works all very well at the moment, but in the future I may wish to create some new controls, when I do this I was hoping to be able to integrate them into my application without having to change the code of the main application. Thus the controls could be like 'plugins'.
  15. I'm not sure this is a very understandable explanation of what I am trying todo but here goes.... Using C# is it possible to take a string for example Control.Type.ToString() and then cast another object to that type using the string. So essentially what I want todo is to create a Type, using a string, then cast an object to that type.
  16. I am working on an application for the Compact Framework. The forms in this program will be fullscreen, the problem is, when I set the WindowState to maximised, everything looks fine for awhile, but every now and then the Top Taskbar of the PocketPC appears over the top of it. Does anyone know how to stop this happening?
  17. I don't quite understand the question, you say the first method works, so in that case, thats the method to use. The second method doesn't work because essentially I believe what it says is.. If CboBox1 is anything other than "" and CboBox2 is ""
  18. Problem solved. For anyone else with this problem the solution I found was to call the .Refresh method of all the controls on the tabpage before painting the buffer to it. This seems to ensure that everything is painted at the same time.
  19. I personally feel that a section devoted to all aspects of the Compact Framework would be usefull. Especially as it can be quite hard to find information specific to the CF.
  20. I'm working on an application using the .Net Compact Framewok have got an annoying little problem. The problem is basically a visible flash that is visible on a tab page. I have create my own component inherited from TabPage, and have then overridden the OnPaint method (essentially to draw an image to the tab page), i have done this by creating a graphics object, painting the bitmap to it (along with a few other things), then painting it to the screen. The problem occurs when there are other Controls on that tab page (which also incorporate buffering to a graphics object). The problem is essentially that the tabpage is not drawn where there is a control placed on it, so untill that controls OnPaint method had ran through, it just appears as a white square, is there any way of avoiding this? I essentially want to draw the complete tabpage, before starting to draw the controls....
  21. I'm using the C# syntax of the .Net Compact Framework to develop an application for PocketPC. I was wondering if anyone has any information that might help me to wrap a video player control, for embedding in my PocketPC application. I've looked on the Internet, but about the only information I can find involves the the use of a wrapper made by Odysy. Any usefull advice welcome, appologies if this is in the wrong section.
×
×
  • Create New...