工具栏顶置
在电子教学的屏幕录制领域,屏幕录制仿若东方仙盟的灵镜,将知识的乾坤万象清晰映照。而其中的粉笔标记,恰似仙盟高手以灵力勾勒的神秘符文,醒目且关键,能瞬间聚焦重点,引导学生目光如灵蝶追香,精准落在知识的花蕊上。
至于工具栏,它宛如仙盟宝库的机关枢纽,蕴藏着众多如法宝般的实用工具。画笔如灵笔可绘天地妙象,橡皮擦似清尘仙力能修正谬误。但为何工具栏要置顶呢?这是因为在东方仙盟的诸多奇珍异宝中,最为关键的法宝总是被供奉在最显眼、最易触及之处,以便在关键时刻能迅速取用。同样,将工具栏置顶,就如同将这些知识传承的 “仙盟法宝” 置于触手可及的高位,教师在教学过程中能如仙者自如施展法术般,毫无阻滞地按需取用。无论是需要突出重点时挥动画笔,还是修正讲解失误时运用橡皮擦,置顶的工具栏都能让教师在知识的广袤仙域中自由驰骋,不会因寻找工具而打乱教学节奏,从而为学生雕琢出一条顺畅的求知仙途,让知识的传承与启迪如仙盟的光辉,熠熠生辉,照亮学子的漫漫求学之路
防阻塞切换
工具栏UI
<Window x:Class="Captura.CyberWin_Main.CyberWin_FloatingToolbarWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:viewModels="clr-namespace:Captura.ViewModels" Title="未来之窗教学录制工具Floating Toolbar" Height="Auto" Width="50" WindowStyle="None" AllowsTransparency="True" Background="#90e50000" Topmost="True" ShowInTaskbar="False" ResizeMode="NoResize"> <Window.Resources> <!-- 按钮样式 --> <Style TargetType="Button" x:Key="FloatingButtonStyle"> <Setter Property="Width" Value="30" /> <Setter Property="Height" Value="50" /> <Setter Property="Margin" Value="5" /> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderBrush" Value="Transparent" /> <Setter Property="Foreground" Value="White" /> <Setter Property="Cursor" Value="Hand" /> <Setter Property="materialDesign:ButtonAssist.CornerRadius" Value="10" /> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="#50FFFFFF" /> </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="Background" Value="#80FFFFFF" /> </Trigger> </Style.Triggers> </Style> </Window.Resources> <!-- 主容器,支持拖拽 --> <Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown" HorizontalAlignment="Center" Background="Transparent"> <!-- 垂直排列的按钮 --> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5"> <Label Foreground="#FFFFFF" FontSize="14" Width="30">电子</Label> <Label Foreground="#FFFFFF" FontSize="14" Width="30" >教学</Label> <!-- 录制控制 --> <Button Command="{Binding StartRecordingCommand}" Style="{StaticResource FloatingButtonStyle}" ToolTip="开始录制"> <materialDesign:PackIcon Kind="Play" Width="25" Height="25" /> </Button> <Button Command="{Binding PauseRecordingCommand}" Style="{StaticResource FloatingButtonStyle}" ToolTip="暂停录制"> <materialDesign:PackIcon Kind="Pause" Width="25" Height="25" /> </Button> <!-- <Button Command="{Binding StopRecordingCommand}" Style="{StaticResource FloatingButtonStyle}" ToolTip="停止录制"> <materialDesign:PackIcon Kind="Stop" Width="25" Height="25" /> </Button> --> <Separator Height="15" Visibility="Hidden" /> <!-- 工具控制 --> <Button Command="{Binding ToggleMagnifierCommand}" Style="{StaticResource FloatingButtonStyle}" ToolTip="放大镜"> <materialDesign:PackIcon Kind="Magnify" Width="25" Height="25" /> </Button> <Button Command="{Binding TogglePencilTechCommand}" Style="{StaticResource FloatingButtonStyle}" ToolTip="讲课粉笔模式,通过快捷键切换"> <materialDesign:PackIcon Kind="Pencil" Width="25" Height="25" /> </Button> <Button Command="{Binding ToggleCursorCommand}" Style="{StaticResource FloatingButtonStyle}" ToolTip="光标模式,通过快捷键切换"> <materialDesign:PackIcon Kind="CursorPointer" Width="25" Height="25" /> </Button> <Button Command="{Binding TogglePencilPaletteCommand}" Style="{StaticResource FloatingButtonStyle}" ToolTip="画笔-颜色"> <!-- 推荐使用调色板图标 --> <materialDesign:PackIcon Kind="Palette" Width="25" Height="25" /> </Button> </StackPanel> </Grid> </Window>操作系统级别函数
public static CyberWin_FloatingToolbarWindow _instance; //2025-12-15 // Windows API 常量(用于设置顶层窗口) private const int HWND_TOPMOST = -1; private const uint SWP_NOSIZE = 0x0001; private const uint SWP_NOMOVE = 0x0002; private const uint SWP_NOACTIVATE = 0x0010; // 不激活窗口,关键:避免抢占焦点 // Windows API 声明(设置窗口位置和层级) [DllImport("user32.dll")] private static extern bool SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); // Windows API 声明(设置窗口扩展样式,禁用焦点) [DllImport("user32.dll")] private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); [DllImport("user32.dll")] private static extern int GetWindowLong(IntPtr hWnd, int nIndex); private const int GWL_EXSTYLE = -20; private const int WS_EX_NOACTIVATE = 0x08000000; // 窗口不接收激活焦点 private const int WS_EX_TOOLWINDOW = 0x00000080; // 工具窗口,不在任务栏显示(可选,增强体验)修改软件标题
// 修改窗口标题的API [DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)] private static extern bool SetWindowText(IntPtr hWnd, string lpString);阿雪技术观
在科技发展浪潮中,我们不妨积极投身技术共享。不满足于做受益者,更要主动担当贡献者。无论是分享代码、撰写技术博客,还是参与开源项目维护改进,每一个微小举动都可能蕴含推动技术进步的巨大能量。东方仙盟是汇聚力量的天地,我们携手在此探索硅基生命,为科技进步添砖加瓦。
Hey folks, in this wild tech - driven world, why not dive headfirst into the whole tech - sharing scene? Don't just be the one reaping all the benefits; step up and be a contributor too. Whether you're tossing out your code snippets, hammering out some tech blogs, or getting your hands dirty with maintaining and sprucing up open - source projects, every little thing you do might just end up being a massive force that pushes tech forward. And guess what? The Eastern FairyAlliance is this awesome place where we all come together. We're gonna team up and explore the whole silicon - based life thing, and in the process, we'll be fueling the growth of technology.