保存彩色和大胆的粘滞便笺 [英] Saving a colored and bold sticky note

查看:87
本文介绍了保存彩色和大胆的粘滞便笺的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我看到使用C#粘贴便笺(简单申请) [ ^ ],但它不是C#2010,我无法理解如何在粘滞便笺中保存和加载彩色和粗体注释。

Hello
I saw Sticky notes with C# (Simple application)[^], but it is not C# 2010 and I cannot understand how it save and load a colored and bold notes in sticky note.

推荐答案

检查一下创建粘贴应用程序的简单方法

粘滞便笺类型应用程序使用C#







技术:C#.NET



此应用程序中使用的.NET的主要组件:

Windows窗格
文本框控件

序列化概念



什么是便签?

Ans :粘滞便笺是保持Windows应用程序的简单注释。它仍然位于每个窗口的顶部。我们可以用它来记下需要经常关注的小笔记。



序列化概念:

保存粘滞便笺的当前状态我们可以使用序列化概念。序列化是将对象转换为字节流以便存储对象或将其传输到内存,数据库或文件的过程。其主要目的是保存对象的状态,以便能够在需要时重新创建它。反向过程称为反序列化。



创建此实用程序的步骤:

在IDE中创建基于Windows窗体的项目。

在Windows窗体上添加TextBox控件

设置TextBox控件的以下属性:

要填充的Dock样式

Multiline to True

Code Snippnets:

//在我的窗口文档中存储笔记



FileStream mynotes = new FileStream( Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)+\\mynotes.nfc,FileMode.Create);



BinaryFormatter format = new BinaryFormatter();

format.Serialize(mynotes,txtUser.Text);

mynotes.Close();







//在应用程序启动时打开备注

if(File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)+\ \ mynotes.nfc))

{

FileStream opennotes = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)+\\mynotes.nfc,FileMode.Open);

BinaryFormatter format = new BinaryFormatter();

txtUser.Text =(string)format.Deserialize(opennotes);

opennotes.Close();

}
check it out a simple way of creating sticky application
Sticky Notes type application using C#



Technology: C#.NET

Major components of .NET used in this app:
Windows Form
Text Box control
Serialization concept

What is "sticky notes"?
Ans: Sticky note is a simple note keeping application of Windows. It remains on the top of the every window. We can use it to write down small notes that requires frequent attention.

Concept of serialization:
To save the current state of sticky note we can use Serialization concept. Serialization is the process of converting an object into a stream of bytes in order to store the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called deserialization.

Steps to create this utility:
Create a Windows Form based project in IDE.
Add TextBox control on the Windows form
Set following properties of the TextBox control:
Dock Style to Fill
Multiline to True
Code Snippnets:
//storing notes in My Documents of windows

FileStream mynotes = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\mynotes.nfc", FileMode.Create);

BinaryFormatter format = new BinaryFormatter();
format.Serialize(mynotes, txtUser.Text);
mynotes.Close();



//opening notes on application launch
if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\mynotes.nfc"))
{
FileStream opennotes = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\mynotes.nfc", FileMode.Open);
BinaryFormatter format = new BinaryFormatter();
txtUser.Text = (string)format.Deserialize(opennotes);
opennotes.Close();
}


这篇关于保存彩色和大胆的粘滞便笺的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆