当前位置: 首页>>代码示例>>C#>>正文


C# System.IntPtr类代码示例

本文整理汇总了C#中System.IntPtr的典型用法代码示例。如果您正苦于以下问题:C# System.IntPtr类的具体用法?C# System.IntPtr怎么用?C# System.IntPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


System.IntPtr类属于命名空间,在下文中一共展示了System.IntPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetXDisplay

    /// <summary>
    /// Retrieve the X11 Display* to pass to VTK's vtkRenderWindow::SetDisplayId
    /// </summary>
    private System.IntPtr GetXDisplay()
    {
      System.Type xplatui = System.Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
      if (xplatui != null)
      {
        System.IntPtr DisplayHandle = (System.IntPtr)xplatui.
          GetField("DisplayHandle", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).
          GetValue(null);
        XDisplay = DisplayHandle;

        // Also, may need possibly:
        // Setup correct X visual and colormap so that VTK OpenGL stuff
        // works properly on mono/X11. Cache the display value so that we
        // can use it to set the RenderWindowId in OnCreated.

        //System.IntPtr RootWindow = (System.IntPtr)xplatui.GetField("RootWindow", System.Reflection.BindingFlags.Static |
        //System.Reflection.BindingFlags.NonPublic).GetValue(null);
        //int ScreenNo = (int)xplatui.GetField("ScreenNo", System.Reflection.BindingFlags.Static | 
        //System.Reflection.BindingFlags.NonPublic).GetValue(null);
        //int[] dblBuf = new int[] { 5, (int)GLXFlags.GLX_RGBA, (int)GLXFlags.GLX_RED_SIZE, 1, (int)GLXFlags.GLX_GREEN_SIZE, 
        //1, (int)GLXFlags.GLX_BLUE_SIZE, 1, (int)GLXFlags.GLX_DEPTH_SIZE, 1, 0 };
        //GLXVisualInfo = glXChooseVisual(DisplayHandle, ScreenNo, dblBuf);
        //XVisualInfo xVisualInfo = (XVisualInfo)Marshal.PtrToStructure(GLXVisualInfo, typeof(XVisualInfo));
        //System.IntPtr visual = System.IntPtr.Zero; // xVisualInfo.visual;
        //System.IntPtr colormap = XCreateColormap(DisplayHandle, RootWindow, visual, 0/*AllocNone*/);
        //xplatui.GetField("CustomVisual", System.Reflection.BindingFlags.Static | 
        //System.Reflection.BindingFlags.NonPublic).SetValue(null, visual);
        //xplatui.GetField("CustomColormap", System.Reflection.BindingFlags.Static | 
        //System.Reflection.BindingFlags.NonPublic).SetValue(null, colormap);
      }

      return XDisplay;
    }
开发者ID:Powerino,项目名称:activizdotnet,代码行数:36,代码来源:RenderWindowControl.Designer.cs

示例2: ModifiedUTF8StringData

 public ModifiedUTF8StringData(string value)
     : base(IntPtr.Zero)
 {
     byte[] data = ModifiedUTF8Encoding.GetBytes(value);
     _data = Marshal.AllocHGlobal(data.Length);
     Marshal.Copy(data, 0, _data, data.Length);
 }
开发者ID:fjnogueira,项目名称:JavaForVS,代码行数:7,代码来源:ModifiedUTF8StringData.cs

示例3: STPActionT4

        public void STPActionT4()
        {
            IntPtr p = new IntPtr(int.MaxValue);
            Guid guid = Guid.NewGuid();

            IPAddress ip = IPAddress.Parse("1.2.3.4");
            IWorkItemResult wir = _stp.QueueWorkItem(Action4, long.MinValue, p, ip, guid);
            Assert.IsNull(wir.State);
        }
开发者ID:amibar,项目名称:SmartThreadPool,代码行数:9,代码来源:TestFalseFillStateWithParams.cs

示例4: ActionT4

        public void ActionT4()
        {
            IntPtr p = new IntPtr(int.MaxValue);
            Guid guid = Guid.NewGuid();

            IPAddress ip = IPAddress.Parse("1.2.3.4");
            IWorkItemResult wir = _wig.QueueWorkItem(Action4, long.MinValue, p, ip, guid);
            object[] args = wir.State as object[];

            Assert.IsNotNull(args);
            Assert.AreEqual(args.Length, 4);
            Assert.AreEqual(args[0], long.MinValue);
            Assert.AreEqual(args[1], p);
            Assert.AreEqual(args[2], ip);
            Assert.AreEqual(args[3], guid);
        }
开发者ID:amibar,项目名称:SmartThreadPool,代码行数:16,代码来源:TestWIGFillStateWithParams.cs

示例5: AttachWindowsForm

        /// <summary>
        /// Allows a windows form to be used as the UI for an anchor window
        /// </summary>
        public static void AttachWindowsForm(
            IVisio.Window anchor_window,
            System.Windows.Forms.Form the_form)
        {
            if (anchor_window == null)
            {
                throw new System.ArgumentNullException(nameof(anchor_window));
            }

            if (the_form == null)
            {
                throw new System.ArgumentNullException(nameof(the_form));
            }

            // Show the form as a modeless dialog.
            the_form.Show();

            // Get the window handle of the form.
            int hwnd = the_form.Handle.ToInt32();
            var hwnd_as_intptr = new System.IntPtr(hwnd);

            // Set the window properties to make it a visible child window.
            const int window_prop_index = Internal.Interop.NativeMethods.GWL_STYLE;
            const int window_prop_value = Internal.Interop.NativeMethods.WS_CHILD | Internal.Interop.NativeMethods.WS_VISIBLE;
            Internal.Interop.NativeMethods.SetWindowLong(hwnd_as_intptr, window_prop_index, window_prop_value);

            // Set the anchor bar window as the parent of the form.
            Internal.Interop.NativeMethods.SetParent(hwnd, anchor_window.WindowHandle32);

            // Force a resize of the anchor bar so it will refresh.
            int left, top, width, height;
            anchor_window.GetWindowRect(out left, out top, out width, out height);
            anchor_window.SetWindowRect(left, top, width - 1, height - 1);
            anchor_window.SetWindowRect(left, top, width, height);

            // Set the dock property of the form to fill, so that the form
            // automatically resizes to the size of the anchor bar.
            the_form.Dock = System.Windows.Forms.DockStyle.Fill;

            // had to set to false to prevent a resizing problem (it was originally set to true)
            the_form.AutoSize = true;
        }
开发者ID:firestream99,项目名称:VisioAutomation,代码行数:45,代码来源:UserInterfaceHelper.cs

示例6: Open

    public bool Open(string FileName)
    {
        // open the existing file for reading
        handle = CreateFile
        (
            FileName,
            GENERIC_READ,
            0,
            0,
            OPEN_EXISTING,
            0,
            0
        );

        if (handle != System.IntPtr.Zero)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
开发者ID:terryjintry,项目名称:OLSource1,代码行数:23,代码来源:how-to--use-the-windows-readfile-function--csharp-programming-guide-_1.cs

示例7: g_object_get

		static extern void g_object_get (gpointer @object, string property_name, out gboolean value, IntPtr nullTerminator);
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:1,代码来源:GtkPlus.cs

示例8: GtkPlus

		protected GtkPlus ()
		{
			widgets = new GtkWidgetPointer [WidgetTypeCount];
			styles = new GtkStylePointer [WidgetTypeCount];
			window = gtk_window_new (GtkWindowType.GTK_WINDOW_TOPLEVEL);
			@fixed = gtk_fixed_new ();
			gtk_container_add (window, @fixed);
			#region Widget types
			#region Button
			gtk_container_add (@fixed, widgets [(int)WidgetType.Button] = gtk_button_new ());
			GTK_WIDGET_SET_FLAGS (widgets [(int)WidgetType.Button], GtkWidgetFlags.GTK_CAN_DEFAULT);
			#endregion
			#region CheckBox
			gtk_container_add (@fixed, widgets [(int)WidgetType.CheckBox] = gtk_check_button_new ());
			#endregion
			#region ComboBox
			gtk_container_add (@fixed, widgets [(int)WidgetType.ComboBox] = gtk_combo_box_entry_new ());
			gtk_widget_realize (widgets [(int)WidgetType.ComboBox]);
			combo_box_drop_down_toggle_button = GetFirstChildWidgetOfType.Get (widgets [(int)WidgetType.ComboBox], gtk_toggle_button_get_type ());
			gtk_widget_realize (combo_box_drop_down_toggle_button);
			combo_box_drop_down_arrow = GetFirstChildWidgetOfType.Get (combo_box_drop_down_toggle_button, gtk_arrow_get_type ());
			g_object_ref (combo_box_drop_down_toggle_button_style = GetWidgetStyle (combo_box_drop_down_toggle_button));
			g_object_ref (combo_box_drop_down_arrow_style = GetWidgetStyle (combo_box_drop_down_arrow));
			#endregion
			#region GroupBox
			gtk_container_add (@fixed, widgets [(int)WidgetType.GroupBox] = gtk_frame_new (null));
			#endregion
			#region ProgressBar
			gtk_container_add (@fixed, widgets [(int)WidgetType.ProgressBar] = gtk_progress_bar_new ());
			#endregion
			#region RadioButton
			gtk_container_add (@fixed, widgets [(int)WidgetType.RadioButton] = gtk_radio_button_new (IntPtr.Zero));
			#endregion
			#region ScrollBar
			gtk_container_add (@fixed, widgets [(int)WidgetType.HScrollBar] = gtk_hscrollbar_new (IntPtr.Zero));
			gtk_container_add (@fixed, widgets [(int)WidgetType.VScrollBar] = gtk_vscrollbar_new (IntPtr.Zero));
			#endregion
			#region StatusBar
			gtk_container_add (@fixed, widgets [(int)WidgetType.StatusBar] = gtk_statusbar_new ());
			#endregion
			#region TabControl
			gtk_container_add (@fixed, widgets [(int)WidgetType.TabControl] = gtk_notebook_new ());
			#endregion
			#region TextBox
			gtk_container_add (@fixed, widgets [(int)WidgetType.TextBox] = gtk_entry_new ());
			#endregion
			#region ToolBar
			gtk_container_add (@fixed, widgets [(int)WidgetType.ToolBar] = gtk_toolbar_new ());

			GtkToolItemPointer tool_button = gtk_tool_button_new (IntPtr.Zero, null);
			gtk_toolbar_insert (widgets [(int)WidgetType.ToolBar], tool_button, -1);
			tool_bar_button = gtk_bin_get_child (tool_button);
			g_object_ref (tool_bar_button_style = GetWidgetStyle (tool_bar_button));

			GtkToolItemPointer toggle_tool_button = gtk_toggle_tool_button_new ();
			gtk_toolbar_insert (widgets [(int)WidgetType.ToolBar], toggle_tool_button, -1);
			tool_bar_toggle_button = gtk_bin_get_child (toggle_tool_button);
			g_object_ref (tool_bar_toggle_button_style = GetWidgetStyle (tool_bar_toggle_button));
			#endregion
			#region TrackBar
			gtk_container_add (@fixed, widgets [(int)WidgetType.HorizontalTrackBar] = gtk_hscale_new_with_range (0, 1, 1));
			gtk_container_add (@fixed, widgets [(int)WidgetType.VerticalTrackBar] = gtk_vscale_new_with_range (0, 1, 1));
			#endregion
			#region TreeView
			gtk_container_add (@fixed, widgets [(int)WidgetType.TreeView] = gtk_tree_view_new ());
			tree_view_column = gtk_tree_view_column_new ();
			gtk_tree_view_insert_column (widgets [(int)WidgetType.TreeView], tree_view_column, -1);
			GtkTreeViewColumn column_structure = (GtkTreeViewColumn)Marshal.PtrToStructure (tree_view_column, typeof (GtkTreeViewColumn));
			tree_view_column_button = column_structure.button;
			g_object_ref (tree_view_column_button_style = GetWidgetStyle (tree_view_column_button));
			#endregion
			#region UpDown
			GtkAdjustmentPointer adjustment = gtk_adjustment_new (0, 0, 0, 0, 0, 0);
			gtk_container_add (@fixed, widgets [(int)WidgetType.UpDown] = gtk_spin_button_new (adjustment, 0, 0));
			#endregion
			#endregion
			for (int widget_index = 0; widget_index < WidgetTypeCount; widget_index++)
				g_object_ref (styles [widget_index] = GetWidgetStyle (widgets [widget_index]));
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:79,代码来源:GtkPlus.cs

示例9: Func4

 private IPAddress Func4(long p1, IntPtr p2, IPAddress p3, Guid p4)
 {
     return IPAddress.None;
 }
开发者ID:amibar,项目名称:SmartThreadPool,代码行数:4,代码来源:TestWIGFillStateWithParams.cs

示例10: Action4

 private void Action4(long p1, IntPtr p2, IPAddress p3, Guid p4)
 {
 }
开发者ID:amibar,项目名称:SmartThreadPool,代码行数:3,代码来源:TestWIGFillStateWithParams.cs

示例11: ObjectIsolation

        public void ObjectIsolation()
        {
            numRows = image.Height;
            numCols = image.Width;
            data = image.LockBits(new Rectangle(0,0,numCols,numRows), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
            stride=data.Stride;
            ptr=data.Scan0;
            nOffset=stride - image.Width*3;
            unsafe
            {
                byte* p;

                p = (byte*)(void*)ptr;
                //p+=stride;
                for (int y = 1; y < numRows - 1; y++)
                {
                    //p+=3;
                    for (int x = 1; x < numCols - 3; x++)
                    {
                        if ((p + x * 3 + stride * y)[0] == 0)
                        {
                            label++;
                            try
                            {
                                startY = 10000;
                                finalY = 0;
                                startX = int.MaxValue;
                                finalX = 0;
                                search(label, y, x);
                                Object singleObject = new Object();
                                singleObject.StartX = startX;
                                singleObject.StartY = startY;
                                singleObject.FinalX = finalX;
                                singleObject.FinalY = finalY;
                                singleObject.Label = label;
                                objects.Add(singleObject);
                            }
                            catch (System.StackOverflowException)
                            {
                                return;
                            }
                        }
                        //p+=3;
                    }
                    //p+=stride;
                }
                int t = 0;
                t++;
            }
            image.UnlockBits(data);
        }
开发者ID:aweeesome,项目名称:scribex,代码行数:51,代码来源:ConnectedComponents.cs

示例12:

		static extern void g_object_unref (gpointer @object);
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:1,代码来源:GtkPlus.cs

示例13: Paint

			public abstract void Paint (GtkStylePointer style, GdkWindowPointer window, GdkRectangle area, GtkWidgetPointer widget, gint x, gint y, gint width, gint height, GtkPlus gtkPlus);
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:1,代码来源:GtkPlus.cs

示例14: AttachStyle

			public virtual void AttachStyle (WidgetType widgetType, GdkDrawablePointer drawable, GtkPlus gtkPlus)
			{
				gtkPlus.styles [(int)widgetType] = gtk_style_attach (gtkPlus.styles [(int)widgetType], drawable);
			}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:4,代码来源:GtkPlus.cs

示例15: GTK_WIDGET_SET_FLAGS

		static void GTK_WIDGET_SET_FLAGS (GtkWidgetPointer wid, GtkWidgetFlags flag)
		{
			GtkObject @object = (GtkObject)Marshal.PtrToStructure (wid, typeof (GtkObject));
			@object.flags |= (guint32)flag;
			Marshal.StructureToPtr (@object, wid, false);
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:6,代码来源:GtkPlus.cs


注:本文中的System.IntPtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。