Want to move InkCanvas in the background

Asked 2 years ago, Updated 2 years ago, 84 views


while the application (currently the application you want to create) is starting. I want to keep drawing lines in the application window while I'm using other apps (game and browser), but I don't know how to do it

Thank you for your cooperation.

C#

using System;
using System.Collections.General;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace mouz
{
    /// <summary>
    /// Mouz.xaml Interaction Logic
    /// </summary>
    public partial class Mouz —Window
    {
        public Mouz()
        {
            InitializeComponent();
        }

        private DrawingAttributes ink = new DrawingAttributes();
        private IntPtrHook;


        private void left_mouz_down(object sender, MouseButtonEventArgse)
        {

            changeColor(e);

        }

        private void left_mouz_up(object sender, MouseButtonEventArgse)
        {
            mouzCanvas.Strokes.Clear();
        }
        private void mouse_move(object sender, MouseEventArgse)
        {

            changeColor(e);
        }

        private void right_mouz_down (object sender, MouseEventArgse)
        {
            mouzCanvas.Strokes.Clear();
        }

        private void MouzCanvas_Loaded (object sender, RoutedEventArgse)
        {
            var mouse_capture=Mouse.Capture(this);

            ink.Width = 10;
            ink.Height=10;
            Color myColor=(Color)ColorConverter.ConvertFromString("#30FFFFFF";

            ink.Color=myColor;

            mouzCanvas.DefaultDrawingAttributes=ink;
            _=Mouse.Capture(this);
        }

        private void changeColor (MouseEventArgse)
        {
            if(e.LeftButton==MouseButtonState.Pressed)
            {
                Color myColor=newColor();
                myColor=(Color)ColorConverter.ConvertFromString("#30FF0000";
                ink.Color=myColor;

                mouzCanvas.DefaultDrawingAttributes=ink;
            }
            else
            {
                Color myColor=newColor();
                myColor=(Color)ColorConverter.ConvertFromString("#30FFFFFF";
                ink.Color=myColor;

                mouzCanvas.DefaultDrawingAttributes=ink;
            }
        }
    }
}

xaml

<Window:Class="mouz.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns: x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns: mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:mouz"
        mc —Ignorable="d"
        Title="MainWindow"Height="337.271"Width="206.435"Background="#FF000000"WindowStyle="SingleBorderWindow">
    <Grid>
        <Button Content="Start" HorizontalAlignment="Left" Margin="10,15,0,0" VerticalAlignment="Top" Width="175" Height="87" Click="Start_Button" FontSize="30"/gt;
        <Button Content="Quit" HorizontalAlignment="Left" Margin="10,129,0,0" VerticalAlignment="Top" Width="175" Height="87" Click="Quit_Button" FontSize="30"/gt;
        <Button Content="Quit" HorizontalAlignment="Left" Margin="10,226,0,0" VerticalAlignment="Top" Width="175" Height="87" Click="Button_Click"FontSize="30"/gt;

    </Grid>
</Window>

c# wpf

2022-09-30 18:01

1 Answers

What I really want to do is to put a transparent application window on the topmost, transparent, and display and manipulate InkCanvas on top of that?
Why don't you do something like Microsoft Edge's Web Note functionality across your desktop?

Add Notes to the Site in Microsoft Edge/Write to the Web
How-to Web Notes (Create and Save Notes)

Below is a sample article that demonstrates these capabilities.

Created an app to write comments and other graffiti on the desktop., CodePlex site,

For the first time, we assume the following usage.

What you're doing
It's very simple to do it in a programmatic way.
Create a full-screen translucent window, keep it front-facing, and
Just put InkCanvas on this window so you can scribble.

"However, ""I want to continue drawing lines in the application window while I'm working on other apps (games and browsers)"" is not . There is only one application available at one time."

The author seems to have tried various functions as follows.
If you need a feature that allows you to quickly switch between apps, why not add it yourself?

Other Miscellaneous Texts
At first, I made this application to reside in the task tray as a resident application.
You can also set up a hotkey so that you can boot from the hotkey at any time.However, it is an app that is very conscious of tablet operation like writing comments by hand, so
When I actually tried it, booting from the task tray was troublesome and uncomfortable.


2022-09-30 18:01

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.