本文将介绍HTML5-JS操作页面滚动条的详细情况,特别是关于禁止、隐藏、显示、不显示的相关信息。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主题,同时也将涉及一些关于C#查找其他应
本文将介绍HTML5-JS操作页面滚动条的详细情况,特别是关于禁止、隐藏、显示、不显示的相关信息。我们将通过案例分析、数据研究等多种方式,帮助您更全面地了解这个主题,同时也将涉及一些关于C# 查找其他应用程序并打开、显示、隐藏、关闭、C# 查找其他应用程序并打开、显示、隐藏、关闭的 API、css 之内容溢出滚动,隐藏滚动条(解决火狐浏览隐藏不了滚动条问题)、CSS-界面滚动时不显示滚动条的知识。
本文目录一览:- HTML5-JS操作页面滚动条(禁止、隐藏、显示、不显示)(js控制滚动条到页面某个位置)
- C# 查找其他应用程序并打开、显示、隐藏、关闭
- C# 查找其他应用程序并打开、显示、隐藏、关闭的 API
- css 之内容溢出滚动,隐藏滚动条(解决火狐浏览隐藏不了滚动条问题)
- CSS-界面滚动时不显示滚动条
HTML5-JS操作页面滚动条(禁止、隐藏、显示、不显示)(js控制滚动条到页面某个位置)
不显示滚动条(css)
::-webkit-scrollbar {
width: 0px;
}
禁止页面滚动条(js)
document.body.parentNode.style.overflowY = "hidden";
$("body").parent().css("overflow-y","hidden");
启用浏览器滚动条(js)
document.body.parentNode.style.overflowY = "auto";
$("body").parent().css("overflow-y","auto");
本文分享 CSDN - TrueDei。
如有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。
C# 查找其他应用程序并打开、显示、隐藏、关闭
软件开发中,有时迫不得已要用到第三方的软件,这时就涉及到在C#应用程序需要对第三方软件打开、显示、隐藏以及关闭。
下面列举了几个常用的方式
打开应用程序,下面是2种简单用法:
第一种:
public enum ShowWindowCommands : int
{
SW_HIDE = 0,
SW_SHOWNORMAL = 1, //用最近的大小和位置显示,激活
SW_NORMAL = 2,
SW_SHOWMINIMIZED = 3,
SW_SHOWMAXIMIZED = 4,
SW_MAXIMIZE = 5,
SW_SHOWNOACTIVATE = 6,
SW_SHOW = 7,
SW_MINIMIZE = 8,
SW_SHOWMINNOACTIVE = 9,
SW_SHOWNA = 10,
SW_RESTORE = 11,
SW_SHOWDEFAULT = 12,
SW_MAX = 13
}
[DllImport("shell32.dll")]
public static extern IntPtr ShellExecute(
IntPtr hwnd,
string lpszOp,
string lpszFile,
string lpszParams,
string lpszDir,
ShowWindowCommands FsShowCmd
);
ShellExecute(IntPtr.Zero, "open", @"D:\Program Files\OtherExe.exe", null, null, ShowWindowCommands.SW_SHOWMINIMIZED);
第二种:
Process myProcess = new Process();
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.FileName = @"D:\Program Files\OtherExe.exe";
myProcess.StartInfo.CreateNoWindow = false;
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
myProcess.Start();
而有时我们在打开其他软件时,又不想让其显示,只有在打开时将其隐藏掉了,虽然上面的例子中myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;涉及到窗口的显示状态,但有时并不是所想的那样显示,可能是本人水平有限,没有正确使用---。
下面我用到了另一种方式实现窗体的查找,隐藏及关闭
[DllImport("user32.dll", EntryPoint = "FindWindow")]
private extern static IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
[DllImport("User32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(IntPtr hWnd, int msg, uint wParam, uint lParam);
使窗体隐藏
IntPtr OtherExeWnd = new IntPtr(0);
OtherExeWnd = FindWindow("SunAwtFrame", null);
//判断这个窗体是否有效
if (OtherExeWnd != IntPtr.Zero)
{
Console.WriteLine("找到窗口");
ShowWindow(OtherExeWnd, 0);//0表示隐藏窗口
}
else
{
Console.WriteLine("没有找到窗口");
}
关闭窗体
IntPtr OtherExeWnd = new IntPtr(0);
OtherExeWnd = FindWindow("SunAwtFrame", null);
//判断这个窗体是否有效
if (OtherExeWnd != IntPtr.Zero)
{
Console.WriteLine("找到窗口");
SendMessage(OtherExeWnd, 16, 0, 0);//关闭窗口,通过发送消息的方式
}
else
{
Console.WriteLine("没有找到窗口");
}
C# 查找其他应用程序并打开、显示、隐藏、关闭的 API
软件开发中,有时迫不得已要用到第三方的软件,这时就涉及到在 C# 应用程序需要对第三方软件打开、显示、隐藏以及关闭。
下面列举了几个常用的方式
打开应用程序,下面是 2 种简单用法:
第一种:

public enum ShowWindowCommands : int
{
SW_HIDE = 0,
SW_SHOWNORMAL = 1, //用最近的大小和位置显示,激活
SW_NORMAL = 2,
SW_SHOWMINIMIZED = 3,
SW_SHOWMAXIMIZED = 4,
SW_MAXIMIZE = 5,
SW_SHOWNOACTIVATE = 6,
SW_SHOW = 7,
SW_MINIMIZE = 8,
SW_SHOWMINNOACTIVE = 9,
SW_SHOWNA = 10,
SW_RESTORE = 11,
SW_SHOWDEFAULT = 12,
SW_MAX = 13
}
[DllImport("shell32.dll")]
public static extern IntPtr ShellExecute(
IntPtr hwnd,
string lpszOp,
string lpszFile,
string lpszParams,
string lpszDir,
ShowWindowCommands FsShowCmd
);
ShellExecute(IntPtr.Zero, "open", @"D:\Program Files\OtherExe.exe", null, null, ShowWindowCommands.SW_SHOWMINIMIZED);

第二种:

Process myProcess = new Process();
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.FileName = @"D:\Program Files\OtherExe.exe";
myProcess.StartInfo.CreateNoWindow = false;
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
myProcess.Start();

而有时我们在打开其他软件时,又不想让其显示,只有在打开时将其隐藏掉了,虽然上面的例子中 myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal; 涉及到窗口的显示状态,但有时并不是所想的那样显示,可能是本人水平有限,没有正确使用 ---。
下面我用到了另一种方式实现窗体的查找,隐藏及关闭

[DllImport("user32.dll", EntryPoint = "FindWindow")]
private extern static IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
[DllImport("User32.dll", EntryPoint = "SendMessage")]
private static extern int SendMessage(IntPtr hWnd, int msg, uint wParam, uint lParam);

使窗体隐藏

IntPtr OtherExeWnd = new IntPtr(0);
OtherExeWnd = FindWindow("SunAwtFrame", null);
//判断这个窗体是否有效
if (OtherExeWnd != IntPtr.Zero)
{
Console.WriteLine("找到窗口");
ShowWindow(OtherExeWnd, 0);//0表示隐藏窗口
}
else
{
Console.WriteLine("没有找到窗口");
}

关闭窗体

IntPtr OtherExeWnd = new IntPtr(0);
OtherExeWnd = FindWindow("SunAwtFrame", null);
//判断这个窗体是否有效
if (OtherExeWnd != IntPtr.Zero)
{
Console.WriteLine("找到窗口");
SendMessage(OtherExeWnd, 16, 0, 0);//关闭窗口,通过发送消息的方式
}
else
{
Console.WriteLine("没有找到窗口");
}

css 之内容溢出滚动,隐藏滚动条(解决火狐浏览隐藏不了滚动条问题)
解决火狐浏览隐藏不了滚动条问题
1. 里层容器的 width 多 17px,外层容器溢出隐藏,能兼容各个浏览器
.outContainer {
width:350px;
height:300px;
overflow: hidden;
}
.inContainer {
height:300px;
width: 367px;
overflow-x:hidden;
overflow-y:scroll;
}
2. 设置 scrollbar-width: none,可兼容
.outContainer {
width:350px;
height:300px;
overflow: hidden;
}
.inContainer {
height:300px;
width: 350px;
overflow-x:hidden;
overflow-y:scroll;
scrollbar-width: none;
}
/* 使用伪类选择器 ::-webkit-scrollbar ,兼容chrome和safari浏览器 */
.inContainer::-webkit-scrollbar{
display: none;
}
/*兼容火狐*/
.inContainer {
scrollbar-width: none;
}
/* 兼容IE10+ */
.inContainer {
-ms-overflow-style: none;
}
html 如下
<body>
<div class="outContainer" >
<div class="inContainer">
<div class="inContent" ></div>
<div class="inContent inContent2"></div>
<div class="inContent" ></div>
</div>
</div>
</body>
CSS-界面滚动时不显示滚动条
设置滚动条的样式:
div::-webkit-scrollbar {
width: 0;
}
关于::-webkit-scrollbar
::-webkit-scrollbar css伪类选择器影响了一个元素的滚动条的样式
::-webkit-scrollbar 仅仅在支持WebKit的浏览器 (例如,谷歌Chrome,苹果Safari)可以使用.
css滚动条选择器
你可以使用以下伪元素选择器去修改各式webkit浏览器的滚动条样式:
- ::-webkit-scrollbar — 整个滚动条.
- ::-webkit-scrollbar-button — 滚动条上的按钮 (上下箭头).
- ::-webkit-scrollbar-thumb — 滚动条上的滚动滑块.
- ::-webkit-scrollbar-track — 滚动条轨道.
- ::-webkit-scrollbar-track-piece — 滚动条没有滑块的轨道部分.
- ::-webkit-scrollbar-corner — 当同时有垂直滚动条和水平滚动条时交汇的部分.
- ::-webkit-resizer — 某些元素的corner部分的部分样式(例:textarea的可拖动按钮).
语法
::-webkit-scrollbar { styles here }
豌豆资源搜索网站https://55wd.com 电脑刺绣绣花厂 ttp://www.szhdn.com
例子
.invisible-scrollbar::-webkit-scrollbar {
display: none;
}
.mostly-customized-scrollbar::-webkit-scrollbar {
width: 5px;
height: 8px;
background-color: #aaa; /* or add it to the track */
}
.mostly-customized-scrollbar::-webkit-scrollbar-thumb {
background: #000;
}
总结
以上是小编为你收集整理的CSS-界面滚动时不显示滚动条全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
我们今天的关于HTML5-JS操作页面滚动条和禁止、隐藏、显示、不显示的分享就到这里,谢谢您的阅读,如果想了解更多关于C# 查找其他应用程序并打开、显示、隐藏、关闭、C# 查找其他应用程序并打开、显示、隐藏、关闭的 API、css 之内容溢出滚动,隐藏滚动条(解决火狐浏览隐藏不了滚动条问题)、CSS-界面滚动时不显示滚动条的相关信息,可以在本站进行搜索。
本文标签: