- 博客(61)
- 资源 (3)
- 收藏
- 关注

原创 leetcode 题解目录
leetcode 083 Remove Duplicates from Sorted List(难易度:Easy)leetcode 169 Majority Element(难易度:Easy)leetcode 217 Contains Duplicate(难易度:Easy)leetcode 226 Invert Binary Tree(难易度:Easy)
2015-09-06 11:53:27
277
原创 win32 / WTL 开发多线程应用,子线程传递大对象给UI线程(主窗口)的方法
2、这个win32 API 是异步的,如果传递的指针指向的是一个局部变量,比如在 线程函数中声明的cv::Mat对象,这种对象是在栈上的,一旦超出对象的作用域,对象就会自动销毁,不能保证当主窗口收到消息进行处理时,接收到的指针指向的有效性,有可能指向的对象已经销毁了。
2024-11-13 18:14:57
410
1
原创 一个win32 / WTL下多线程库(CThread类)的使用心得
说一下Run方法:是一个循环,只要没在外部调用子线程的Stop方法,子线程就一直运行。一旦在外部什么地方调用子线程的Stop()方法,循环就退出了,子线程执行结束。然后,在类中定义需要的成员变量,比如,一般都要有一个窗口句柄,这个窗口就是你这个子线程要和哪个窗口进行交互,或者子线程的执行结果要返回给哪个窗口。2、多个子线程中的变量数据是单独的,有自己的地址空间,不干扰。在类的外部,比如在主窗口(对话框)类CMainDlg中(由于我用的是WTL库,主窗口类名叫这个),定义一个子线程对象。
2024-11-12 21:56:10
551
原创 Win32图片库CxImage在vs2022下的编译和使用
1、下载CxImage_702库的源码:在下面的链接中下载2、解压到某一目录,vs2022打开CxImageFull_vc10.sln解决方案文件,提示升级点确定3、先编译下面的这几个项目4、然后重点来了,打开CxImageFull_vc10解决方案下的cximage项目(第一个项目就是),打开ximadef.h文件,找到大概96行的位置,修改为 #include
2024-10-19 22:08:31
559
原创 Flutter 图表插件 fl_chart 使用研究(二)
在上一篇博文中 ,我们用fl_chart插件画出了一个最简单的两条曲线的折线图,下面再说以下其余的参数的含义。回顾以下上一篇结尾的代码:return LineChart( LineChartData( lineBarsData: [ LineChartBarData( spots: spots1, ), LineChartBarData( spots: spots
2020-09-18 21:59:24
2490
1
原创 Flutter 图表插件 fl_chart 使用研究(一)
Flutter 图表插件 fl_chart 使用研究(以Line chart 为例子)LineChart( LineChartData( // 大部分属性都在这里面写 ),);看LineChart的源码,发现LineChart构造函数还有一个命名参数:swapAnimationDuration,猜测是控制动画的时间间隔,默认是150毫秒,也就是说,fl_chart默认支持动画。进入LineChartData类中,其构造函数的参数较多,其中,最重要的一个,也就是我们放数据的地.
2020-09-18 16:34:59
7626
转载 WM_INITDIALOG与WM_CREATE消息的区别
WM_CREATE是所有窗口都能响应的消息,表明本窗口已经创建完毕(可以安全的使用这个窗口了,例如在它上面画控件等)。在响应WM_CREATE消息响应函数的时候,对话框及子控件还未创建完成,亦是说只是通知系统说要开始创建窗口啦,这个消息响应完之后,对话框和子控件才开始创建。因此在此消息响应函数中无法对控件进行修改和初始化。 WM_INITDIALOG消息是对话框才能收到的消息
2016-07-15 13:22:33
673
转载 Vc中自定义消息及其触发使用
Vc中自定义消息及其触发使用 如何在VC++中加入自定义消息,我的做法:这里我以一个对话框为例子,环境:VS 2008,新建一个工程,选择对话框:以编译器给出的对话框为蓝本,自己新建一个按钮如图:把名字改成如图的,其他比如ID什么的都不改了,默认。1 首先在ownermessageDlg.h中定义消息:例如define WM_MYMESSAGE (WM_USER
2016-06-16 10:58:05
384
转载 Combo Box(组合框)控件使用总结
Combo Box(组合框)控件很简单,可以节省空间。从用户角度来看,这个控件是由一个文本输入控件和一个下拉菜单组成的。用户可以从一个预先定义的列表里选择一个选项,同时也可以直接在文本框里面输入文本。1.改变下拉框大小 1)直接在控件上操作,先点向下的箭头,就可以调整下拉框大小; 2)为了让列表框变的更宽,可以用setdroppedwidth(int width)函数来调整列表框的
2016-05-25 16:22:58
4837
转载 MFC相关问题汇总
1. “fatal error LNK1561: 必须定义入口点”解决方法解决方案上,右键->属性->链接器->系统->子系统,下拉框选择:窗口 (/SUBSYSTEM:WINDOWS)
2016-05-24 15:00:23
370
转载 MFC 非模态对话框 创建 销毁
采用成员变量创建一个非模态对话框 首先在你所要编写的类的头文件中声明一个指针变量:[cpp] view plain copyprivate: CTestDialog *pTD; 然后再在相应的CPP文件,在你要创建对话框的位置添加如下代码:[cpp] view
2016-05-17 11:23:22
1125
转载 VS如何为基于对话框的MFC添加菜单及菜单项事件
方法/步骤新建一个基于对话框的MFC工程。在资源视图中,右键单击-->添加 资源-->Menu--新建,并命名ID为IDR_MENU1在对话框的属性表中,找到Menu属性,并选择ID_MENU1,至此,菜单就添加到对话框中。打开菜单文件,编辑自己的菜单项在具体的菜单项中,右键单击,选择添加事件处理程序添加编辑后
2016-05-16 14:26:21
3075
原创 leetcode 328 Odd Even Linked List(难易度:Easy)
Odd Even Linked ListGiven a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.
2016-02-10 20:41:03
392
原创 leetcode 326 Power of Three(难易度:Easy)
Power of ThreeGiven an integer, write a function to determine if it is a power of three.Follow up:Could you do it without using any loop / recursion?代码:bool isPowerOfThree(int n) { if
2016-02-03 22:57:17
361
原创 leetcode 009 Palindrome Number(难易度:Easy)
Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If you ar
2015-12-08 11:11:22
293
原创 leetcode 112 Path Sum(难易度:Easy)
Path SumGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary t
2015-12-03 13:25:45
340
原创 leetcode 107 Binary Tree Level Order Traversal II(难易度:Easy)
Binary Tree Level Order Traversal IIGiven a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:
2015-10-23 08:25:26
321
原创 leetcode 198 House Robber(难易度:Easy)
House RobberYou are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is tha
2015-10-14 11:00:50
326
原创 leetcode 292 Nim Game(难易度:Easy)
Nim GameYou are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone
2015-10-13 10:08:59
518
原创 leetcode 102 Binary Tree Level Order Traversal(难易度:Easy)
Binary Tree Level Order TraversalGiven a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,9,20,#,
2015-10-07 16:35:49
282
原创 leetcode 118 Pascal's Triangle(难易度:Easy)
Pascal's TriangleGiven numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]代码:/*
2015-10-05 12:14:24
318
原创 leetcode 066 Plus One(难易度:Easy)
Plus OneGiven a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.代码:/*** R
2015-10-02 12:34:10
288
原创 leetcode 231 Power of Two(难易度:Easy)
Power of TwoGiven an integer, write a function to determine if it is a power of two.代码:bool isPowerOfTwo(int n) { return (n > 0) && (!(n &(n - 1)));}原题地址:https://leetcode.com/problems/power
2015-09-30 07:51:13
270
原创 leetcode 101 Symmetric Tree
Symmetric TreeGiven a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3
2015-09-29 10:41:34
267
原创 leetcode 027 Remove Element(难易度:Easy)
Remove ElementGiven an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the
2015-09-29 01:31:52
503
原创 leetcode 080 Remove Duplicates from Sorted Array II(难易度:Medium)
Remove Duplicates from Sorted Array IIFollow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Your function shoul
2015-09-26 10:19:09
270
原创 leetcode 283 Move Zeroes(难易度:Easy)
Move ZeroesGiven an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after
2015-09-24 08:20:22
238
原创 leetcode 120 Triangle(难易度:Medium)
TriangleGiven a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the following triangle[ [2], [
2015-09-23 16:16:39
358
原创 leetcode 026 Remove Duplicates from Sorted Array(难易度:Easy)
Remove Duplicates from Sorted ArrayGiven a sorted array, remove the duplicates in place such that each element appear onlyonce and return the new length.Do not allocate extra space for another
2015-09-22 10:56:47
245
原创 leetcode 110 Balanced Binary Tree(难易度:Easy)
Balanced Binary TreeGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees o
2015-09-18 10:56:53
419
原创 leetcode 202 Happy Number(难易度:Easy)
Happy NumberWrite an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum
2015-09-17 09:35:20
314
原创 leetcode 070 Climbing Stairs(难易度:Easy)
Climbing StairsYou are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?代码:int clim
2015-09-16 10:42:54
256
原创 leetcode 206 Reverse Linked List(难易度:Easy)
Reverse Linked ListReverse a singly linked list.Hint:A linked list can be reversed either iteratively or recursively. Could you implement both?代码:/** * Definition for singly-linked li
2015-09-16 10:29:53
430
原创 leetcode 232 Implement Queue using Stacks(难易度:Easy)
Implement Queue using Stacks
2015-09-16 09:44:27
262
原创 leetcode 013 Roman to Integer(难易度:Easy)
Roman to IntegerGiven a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.代码:int romanCharToInt(char c);int romanToInt(char* s){ int num =
2015-09-14 11:04:07
244
原创 leetcode 70 Climbing Stairs(难易度:Easy)
Climbing StairsYou are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?代码:int clim
2015-09-08 07:01:58
222
原创 leetcode 083 Remove Duplicates from Sorted List(难易度:Easy)
Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, retur
2015-09-07 19:45:01
262
原创 leetcode 169 Majority Element(难易度:Easy)
Majority ElementGiven an array of size n, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋ times.You may assume that the array is non-empty and the ma
2015-09-06 11:48:13
252
原创 leetcode 217 Contains Duplicate(难易度:Easy)
Contains DuplicateGiven an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false
2015-09-05 20:23:28
253
原创 leetcode 226 Invert Binary Tree(难易度:Easy)
Invert Binary TreeInvert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1Trivia:This problem was inspired by this origin
2015-09-02 14:09:10
330
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人