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


C# Gtk.GetSize方法代码示例

本文整理汇总了C#中Gtk.GetSize方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.GetSize方法的具体用法?C# Gtk.GetSize怎么用?C# Gtk.GetSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk的用法示例。


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

示例1: CenterChildToParent

        public static void CenterChildToParent(Gtk.Window parent,Gtk.Window child)
        {
            if (parent==null || child == null)
                return;

            int parentX = 0;
            int parentY = 0;
            int parentW = 0;
            int parentH = 0;

            parent.GetPosition(out parentX,out parentY);
            parent.GetSize(out parentW,out parentH);

            int w = 0;
            int h = 0;
            child.GetSize(out w,out h);

            var x = parentX + Convert.ToInt32( (parentW-w) / 2);
            var y = parentY + Convert.ToInt32( (parentH-h) / 2);

            if (x<=0) x =0;
            if (y<=0) y =0;

            child.Move(x,y);
            child.KeepAbove = true;
        }
开发者ID:petrj,项目名称:MP3Tagger,代码行数:26,代码来源:Dialogs.cs

示例2: FadeIn

        public static void FadeIn(Gtk.Window window, uint millisecondsTimeout)
        {
            int screenHeight = window.Screen.Height;
            int winWidth, winHeight;
            int winX, winY;

            // Hide Window At Bottom of The Screen
            window.GetPosition(out winX, out winY);
            //int firstWinY = winY;
            window.GetSize(out winWidth, out winHeight);
            window.Move(winX, screenHeight);

            // Rise Window
            do {
                window.GetPosition(out winX, out winY);
                window.Move(winX, winY - 1);
                //System.Threading.Thread.Sleep(millisecondsTimeout);
                TimeUtils.Sleep(millisecondsTimeout);
            //} while (winY >= firstWinY);
            } while (winY > (screenHeight - winHeight));
        }
开发者ID:BackupTheBerlios,项目名称:niry-sharp-svn,代码行数:21,代码来源:WindowUtils.cs

示例3: ResizeIfNeeded

 public static void ResizeIfNeeded(Gtk.Window win)
 {
     int winX, winY;
     win.GetSize(out winX, out winY);
     int maxY = ScreenHeightFitted(true);
     if(winY > maxY)
         win.Resize(winX, maxY);
 }
开发者ID:dineshkummarc,项目名称:chronojump,代码行数:8,代码来源:utilGtk.cs

示例4: CenterWindow

 /// <summary>Centers a window relative to its parent.</summary>
 static void CenterWindow(Gtk.Window child, Gtk.Window parent)
 {
     child.Child.Show ();
     int w, h, winw, winh, x, y, winx, winy;
     if (child.Visible)
         child.GetSize (out w, out h);
     else {
         w = child.DefaultSize.Width;
         h = child.DefaultSize.Height;
     }
     parent.GetSize (out winw, out winh);
     parent.GetPosition (out winx, out winy);
     x = Math.Max (0, (winw - w) /2) + winx;
     y = Math.Max (0, (winh - h) /2) + winy;
     child.Move (x, y);
 }
开发者ID:Michael--,项目名称:DockingFramework,代码行数:17,代码来源:MessageService.cs

示例5: SaveViewerGeometry

 public void SaveViewerGeometry(Gtk.Window w)
 {
     int width, height;
     w.GetSize (out width, out height);
     gconfClient.Set ("/apps/csboard/viewer/session/width",
              width);
     gconfClient.Set ("/apps/csboard/viewer/session/height",
              height);
 }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:9,代码来源:Session.cs

示例6: WriteConfiguration

        /// <summary>
        /// Writes the configuration file for this application. 
        /// </summary>
        /// <param name="window">
        /// A <see cref="Gtk.Window"/> that is the main application's window
        /// </param>
        /// <param name="cfgFileName">
        /// A <see cref="System.String"/> containing the name of the config file.
        /// </param>
        /// <param name="recentFiles">
        /// A <see cref="System.Array"/> containing the recently used files.
        /// The first one, lastFiles[ 0 ] is the last file used by the application.
        /// </param>
        public static void WriteConfiguration(Gtk.Window window, string cfgFileName, string[] recentFiles)
        {
            int width;
                int height;
                string lastFile = "";
                StringBuilder recentFilesLine = null;

                // Prepare window size
                window.GetSize( out width, out height );

                // Prepare last file name. It is the first of the recent files.
                if ( recentFiles.Length > 0 ) {
                    lastFile = recentFiles[ 0 ];
                }

                // Prepare last files - first one is the current open
                if ( recentFiles.Length > 1 ) {
                    recentFilesLine = new StringBuilder();

                    for(int i = 1; i < recentFiles.Length; ++i) {
                        recentFilesLine.Append( recentFiles[ i ] );
                        recentFilesLine.Append( ',' );
                    }

                    // Remove last ','
                    recentFilesLine.Remove( recentFilesLine.Length -1, 1 );
                }

                // Write configuration
                try {
                    var file = new StreamWriter( cfgFileName );

                    // Write window size
                    file.WriteLine( "{0}={1}", EtqWidth, width );
                    file.WriteLine( "{0}={1}", EtqHeight, height );

                    // Write last file name
                    if ( lastFile.Length > 0 ) {
                        file.WriteLine( "{0}={1}", EtqLastFile, lastFile );
                    }

                    // Write list of recent files
                    if ( recentFilesLine != null ) {
                        file.WriteLine( "{0}={1}", EtqRecent, recentFilesLine.ToString() );
                    }

                    file.WriteLine();
                    file.Close();
                } catch(Exception exc)
                {
                    Util.MsgError( window, window.Title, exc.Message );
                }

                return;
        }
开发者ID:Baltasarq,项目名称:GtkUtil,代码行数:68,代码来源:GtkUtil.cs

示例7: ReadConfiguration

        /// <summary>
        /// Reads a configuration file for this application. 
        /// </summary>
        /// <param name="window">
        /// A <see cref="Gtk.Window"/> that is the main window of the application.
        /// </param>
        /// <param name="cfgFileName">
        /// A <see cref="System.String"/> the name of the configuration file.
        /// </param>
        /// <returns>
        /// A <see cref="System.Array"/> with the list of recently used files.
        /// </returns>
        public static string[] ReadConfiguration(Gtk.Window window, string cfgFileName)
        {
            string lastFileName = "";
                string[] recentFiles = new string[]{};
                List<string> files = null;
                int width;
                int height;
                StreamReader file = null;
                string line;

                window.GetSize( out width, out height );

                try {
                    try {
                        file = new StreamReader( cfgFileName );
                    } catch(Exception) {
                        return null;
                    }

                    line = file.ReadLine();
                    while( !file.EndOfStream ) {
                    if ( line.ToLower().StartsWith( EtqLastFile, StringComparison.InvariantCulture ) ) {
                            int pos = line.IndexOf( '=' );

                            if ( pos > 0 ) {
                                lastFileName = line.Substring( pos + 1 ).Trim();
                            }
                        }
                        else
                        if ( line.ToLower().StartsWith( EtqWidth, StringComparison.InvariantCulture ) ) {
                            int pos = line.IndexOf( '=' );

                            if ( pos > 0 ) {
                                width = System.Convert.ToInt32( line.Substring( pos + 1 ).Trim() );
                            }
                        }
                        else
                        if ( line.ToLower().StartsWith( EtqHeight, StringComparison.InvariantCulture ) ) {
                            int pos = line.IndexOf( '=' );

                            if ( pos > 0 ) {
                                height = System.Convert.ToInt32( line.Substring( pos + 1 ).Trim() );
                            }
                        }
                        else
                        if ( line.ToLower().StartsWith( EtqRecent, StringComparison.InvariantCulture ) ) {
                            int pos = line.IndexOf( '=' );

                            if ( pos > 0 ) {
                                recentFiles = line.Substring( pos + 1 ).Split( ',' );
                            }
                        }

                            line = file.ReadLine();
                        }

                    file.Close();

                    // Now apply cfg
                    ApplyNewSize( window, width, height );

                    // Create list of recent files, plus the last file
                    files = new List<string>();
                    files.Add( lastFileName );
                    foreach(var f in recentFiles) {
                        files.Add( f );
                    }

                    return files.ToArray();
                } catch(Exception exc)
                {
                    Util.MsgError( window, window.Title, exc.Message );
                }

                return null;
        }
开发者ID:Baltasarq,项目名称:GtkUtil,代码行数:88,代码来源:GtkUtil.cs

示例8: CenterWindow

 /// <summary>Centers a window relative to its parent.</summary>
 static void CenterWindow(Gtk.Window child, Gtk.Window parent)
 {
     child.Child.Show ();
     int w, h, winw, winh, x, y, winx, winy;
     child.GetSize (out w, out h);
     parent.GetSize (out winw, out winh);
     parent.GetPosition (out winx, out winy);
     x = Math.Max (0, (winw - w) /2) + winx;
     y = Math.Max (0, (winh - h) /2) + winy;
     child.Move (x, y);
 }
开发者ID:RevolutionSmythe,项目名称:xwt,代码行数:12,代码来源:MessageService.cs

示例9: getWindowSize

 private static void getWindowSize(Gtk.Window win)
 {
     win.GetSize(out winHeight , out winWidth);
 }
开发者ID:xmalmorthen,项目名称:DashBoard,代码行数:4,代码来源:main.cs


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