Results 1 to 3 of 3

Thread: C# for Invoking a Property

  1. #1
    CarterBaker is offline Senior Member
    Join Date
    Dec 2009
    Posts
    210
    Rep Power
    3

    Default C# for Invoking a Property

    I am new in C#; I am having some issue with editing properties across threads. For that I thought that I would have to use the Invoke () method. But I am not confident how to use that. This is my code:

    Imge1 is twisted by the main thread.
    In a different thread I have the following C# code

    imge1.Left = imge1.Left + 1

    though this throws up an error. Please solve my problem as soon as possible.

  2. #2
    HowardAdams is offline Senior Member
    Join Date
    Dec 2009
    Posts
    214
    Rep Power
    3

    Default

    1) There is no “left “property in Image class. Properties of the Image class are given below.

    o FrameDimensionsList - Gets an array of GUIDs that be the dimensions of frames in this Image.

    o Palette - Gets or sets the color palette used for this Image.

    o Height - Gets the height, in pixels, of this Image.

    o Flags - Gets attribute flags for the pixel data of this Image.

    o HorizontalResolution - Gets the horizontal resolution, in pixels per inch, of this Image.

    o Tag - Gets or sets an object that provides additional data about the image.

    o RawFormat - Gets the file format of this Image.

    o VerticalResolution - Gets the vertical resolution, in pixels per inch, of this Image

    o Width - Gets the width, in pixels, of this Image.

  3. #3
    BarnesHarris is offline Senior Member
    Join Date
    Dec 2009
    Posts
    213
    Rep Power
    3

    Default

    2) I believe that the "Left" property does not belong in the class image. Also, for the invocation, the trick is to use the Control.BeginInvoke method to force the method to be executed in the same thread as that of control. The difference between the invocation and BeginInvoke is that the first is modern, while the second is asynchronous. BeginInvoke starts a new thread passing along an object representing the method to be invoked and parameters to be passed to it. Using BeginInvoke makes more sense as the whole idea is to create effective multi-threaded application.

Similar Threads

  1. Unable to set the Read only property on a folder
    By HallMiller in forum Windows Vista
    Replies: 1
    Last Post: 05-13-2010, 01:32 PM
  2. AutoPostBack Property
    By SmithJohnson in forum Programming
    Replies: 1
    Last Post: 01-30-2010, 02:22 PM
  3. CSS property window
    By HowardAdams in forum Operating System
    Replies: 1
    Last Post: 01-29-2010, 05:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48